summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garcia Campos <cgarcia@igalia.com>2021-04-28 14:32:53 +0200
committerCarlos Garcia Campos <cgarcia@igalia.com>2021-04-30 11:49:32 +0200
commit8e69d510625afaad0d2957f20465ee662406c983 (patch)
tree405abd9bf9663a7e648ec6c1240a387da3a9fe39
parent465b32bba89ec4c5647dc80398419a397ec798e9 (diff)
downloadlibsoup-carlosgc/client-side-certs2.tar.gz
ssl-test: test request-certificate-password synchronously toocarlosgc/client-side-certs2
-rw-r--r--tests/ssl-test.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/ssl-test.c b/tests/ssl-test.c
index 1a209892..4f1828c6 100644
--- a/tests/ssl-test.c
+++ b/tests/ssl-test.c
@@ -219,6 +219,17 @@ request_certificate_cb (SoupMessage *msg,
return TRUE;
}
+static gboolean
+request_certificate_password_cb (SoupMessage *msg,
+ GTlsPassword *tls_password,
+ const guchar *password)
+{
+ g_tls_password_set_value (tls_password, password, -1);
+ soup_message_tls_client_certificate_password_request_complete (msg);
+
+ return TRUE;
+}
+
typedef struct {
SoupMessage *msg;
GTlsCertificate *certificate;
@@ -403,6 +414,21 @@ do_tls_interaction_msg_test (gconstpointer data)
msg = soup_message_new_from_uri ("GET", uri);
soup_message_add_flags (msg, SOUP_MESSAGE_NEW_CONNECTION);
g_signal_connect (msg, "request-certificate",
+ G_CALLBACK (request_certificate_cb),
+ pkcs11_certificate);
+ g_signal_connect (msg, "request-certificate-password",
+ G_CALLBACK (request_certificate_password_cb),
+ "ABC123");
+ body = soup_test_session_async_send (session, msg, NULL, &error);
+ g_assert_no_error (error);
+ g_clear_error (&error);
+ g_bytes_unref (body);
+ g_object_unref (msg);
+
+ /* Handling the request-certificate-password signal asynchronously */
+ msg = soup_message_new_from_uri ("GET", uri);
+ soup_message_add_flags (msg, SOUP_MESSAGE_NEW_CONNECTION);
+ g_signal_connect (msg, "request-certificate",
G_CALLBACK (request_certificate_async_cb),
pkcs11_certificate);
g_signal_connect (msg, "request-certificate-password",