PROP_SSH_KEY_PASSPHRASE,
PROP_SSH_KNOWNHOSTS,
PROP_SSH_HOST_PUBLIC_KEY_MD5,
+ PROP_SSH_HOST_PUBLIC_KEY_SHA256,
PROP_SSH_ACCEPT_UNKNOWNHOST
};
"remote host's public key",
NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+#if CURL_AT_LEAST_VERSION(7, 80, 0)
+ g_object_class_install_property (gobject_class,
+ PROP_SSH_HOST_PUBLIC_KEY_SHA256,
+ g_param_spec_string ("ssh-host-pubkey-sha256",
+ "SHA256 checksum of the remote host's public key",
+ "SHA256 checksum (Base64 encoded) of the remote host's public key",
+ NULL, G_PARAM_READWRITE | GST_PARAM_CONDITIONALLY_AVAILABLE |
+ G_PARAM_STATIC_STRINGS));
+#endif
+
g_object_class_install_property (gobject_class, PROP_SSH_ACCEPT_UNKNOWNHOST,
g_param_spec_boolean ("ssh-accept-unknownhost",
"SSH accept unknown host",
sink->ssh_key_passphrase = NULL;
sink->ssh_knownhosts = NULL;
sink->ssh_host_public_key_md5 = NULL;
+ sink->ssh_host_public_key_sha256 = NULL;
sink->ssh_accept_unknownhost = FALSE;
}
g_free (this->ssh_key_passphrase);
g_free (this->ssh_knownhosts);
g_free (this->ssh_host_public_key_md5);
+ g_free (this->ssh_host_public_key_sha256);
G_OBJECT_CLASS (parent_class)->finalize (gobject);
}
sink->ssh_host_public_key_md5);
break;
+ case PROP_SSH_HOST_PUBLIC_KEY_SHA256:
+ g_free (sink->ssh_host_public_key_sha256);
+ sink->ssh_host_public_key_sha256 = g_value_dup_string (value);
+ GST_DEBUG_OBJECT (sink, "ssh_host_public_key_sha256 set to %s",
+ sink->ssh_host_public_key_sha256);
+ break;
+
case PROP_SSH_ACCEPT_UNKNOWNHOST:
sink->ssh_accept_unknownhost = g_value_get_boolean (value);
GST_DEBUG_OBJECT (sink, "ssh_accept_unknownhost set to %d",
g_value_set_string (value, sink->ssh_host_public_key_md5);
break;
+ case PROP_SSH_HOST_PUBLIC_KEY_SHA256:
+ g_value_set_string (value, sink->ssh_host_public_key_sha256);
+ break;
+
case PROP_SSH_ACCEPT_UNKNOWNHOST:
g_value_set_boolean (value, sink->ssh_accept_unknownhost);
break;
return FALSE;
}
}
+#if CURL_AT_LEAST_VERSION(7, 80, 0)
+ if (sink->ssh_host_public_key_sha256) {
+ if ((curl_err =
+ curl_easy_setopt (bcsink->curl, CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256,
+ sink->ssh_host_public_key_sha256)) != CURLE_OK) {
+ bcsink->error = g_strdup_printf ("failed to set remote host's public "
+ "key SHA256: %s", curl_easy_strerror (curl_err));
+ return FALSE;
+ }
+ }
+#endif
/* make sure we only accept PASSWORD or PUBLICKEY auth methods
* (can be extended later) */
gchar *res_passphrase = NULL;
gchar *res_kh_file = NULL;
gchar *res_host_pubkey_md5 = NULL;
+ gchar *res_host_pubkey_sha256 = NULL;
guint res_auth_type = 0;
gboolean res_accept_unkh = FALSE;
g_object_set (G_OBJECT (sink), "ssh-knownhosts", "known_hosts", NULL);
g_object_set (G_OBJECT (sink), "ssh-host-pubkey-md5",
"00112233445566778899aabbccddeeff", NULL);
+#if CURL_AT_LEAST_VERSION(7, 80, 0)
+ g_object_set (G_OBJECT (sink), "ssh-host-pubkey-sha256",
+ "TQtiu1/zwGEEKG4z/PDfPE/ak47AF9nbWHykx4CWcu9", NULL);
+#endif
g_object_set (G_OBJECT (sink), "ssh-accept-unknownhost", TRUE, NULL);
g_object_set (G_OBJECT (sink), "ssh-key-passphrase", "SoMePaSsPhRaSe", NULL);
"create-dirs", &res_create_dirs, "ssh-key-passphrase", &res_passphrase,
NULL);
+#if CURL_AT_LEAST_VERSION(7, 80, 0)
+ g_object_get (sink, "ssh-host-pubkey-sha256", &res_host_pubkey_sha256, NULL);
+#endif
+
fail_unless (strncmp (res_location, "test_location", strlen ("test_location"))
== 0);
fail_unless (strncmp (res_user, "test_user", strlen ("test_user")) == 0);
== 0);
fail_unless (strncmp (res_host_pubkey_md5, "00112233445566778899aabbccddeeff",
strlen ("00112233445566778899aabbccddeeff")) == 0);
+#if CURL_AT_LEAST_VERSION(7, 80, 0)
+ fail_unless (strncmp (res_host_pubkey_sha256,
+ "TQtiu1/zwGEEKG4z/PDfPE/ak47AF9nbWHykx4CWcu9",
+ strlen ("TQtiu1/zwGEEKG4z/PDfPE/ak47AF9nbWHykx4CWcu9")) == 0);
+#endif
fail_unless (strncmp (res_passphrase, "SoMePaSsPhRaSe",
strlen ("SoMePaSsPhRaSe")) == 0);
fail_unless (res_accept_unkh == TRUE);
g_free (res_passphrase);
g_free (res_kh_file);
g_free (res_host_pubkey_md5);
+ g_free (res_host_pubkey_sha256);
/* ------- change properties ------------- */
g_object_set (G_OBJECT (sink), "ssh-knownhosts", "/zzz/known_hosts", NULL);
g_object_set (G_OBJECT (sink), "ssh-host-pubkey-md5",
"ffeeddccbbaa99887766554433221100", NULL);
+#if CURL_AT_LEAST_VERSION(7, 80, 0)
+ g_object_set (G_OBJECT (sink), "ssh-host-pubkey-sha256",
+ "TUtitut/wGEEKG4z/PDfPE/ak47AF7nbWHykAxCWcu5", NULL);
+#endif
g_object_set (G_OBJECT (sink), "ssh-accept-unknownhost", FALSE, NULL);
g_object_set (G_OBJECT (sink), "ssh-key-passphrase", "OtherPASSphrase", NULL);
"ssh-key-passphrase", &res_passphrase, "create-dirs", &res_create_dirs,
NULL);
+#if CURL_AT_LEAST_VERSION(7, 80, 0)
+ g_object_get (sink, "ssh-host-pubkey-sha256", &res_host_pubkey_sha256, NULL);
+#endif
+
fail_unless (strncmp (res_location, "new_location", strlen ("new_location"))
== 0);
fail_unless (strncmp (res_user, "new_user", strlen ("new_user")) == 0);
strlen ("/zzz/known_host")) == 0);
fail_unless (strncmp (res_host_pubkey_md5, "ffeeddccbbaa99887766554433221100",
strlen ("ffeeddccbbaa99887766554433221100")) == 0);
+#if CURL_AT_LEAST_VERSION(7, 80, 0)
+ fail_unless (strncmp (res_host_pubkey_sha256,
+ "TUtitut/wGEEKG4z/PDfPE/ak47AF7nbWHykAxCWcu5",
+ strlen ("TUtitut/wGEEKG4z/PDfPE/ak47AF7nbWHykAxCWcu5")) == 0);
+#endif
fail_unless (strncmp (res_passphrase, "OtherPASSphrase",
strlen ("OtherPASSphrase")) == 0);
fail_unless (res_accept_unkh == FALSE);
g_free (res_passphrase);
g_free (res_kh_file);
g_free (res_host_pubkey_md5);
+ g_free (res_host_pubkey_256);
cleanup_curlsftpsink (sink);
}