1 /* GIO - GLib Input, Output and Streaming Library
3 * Copyright © 2010 Red Hat, Inc
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
22 #include "gtlsconnection.h"
23 #include "gcancellable.h"
24 #include "gioenumtypes.h"
26 #include "gtlsbackend.h"
27 #include "gtlscertificate.h"
28 #include "gtlsclientconnection.h"
29 #include "gtlsdatabase.h"
30 #include "gtlsinteraction.h"
34 * SECTION:gtlsconnection
35 * @short_description: TLS connection type
38 * #GTlsConnection is the base TLS connection class type, which wraps
39 * a #GIOStream and provides TLS encryption on top of it. Its
40 * subclasses, #GTlsClientConnection and #GTlsServerConnection,
41 * implement client-side and server-side TLS, respectively.
49 * Abstract base class for the backend-specific #GTlsClientConnection
50 * and #GTlsServerConnection types.
55 G_DEFINE_ABSTRACT_TYPE (GTlsConnection, g_tls_connection, G_TYPE_IO_STREAM)
57 static void g_tls_connection_get_property (GObject *object,
61 static void g_tls_connection_set_property (GObject *object,
72 static guint signals[LAST_SIGNAL] = { 0 };
77 PROP_REQUIRE_CLOSE_NOTIFY,
78 PROP_REHANDSHAKE_MODE,
79 PROP_USE_SYSTEM_CERTDB,
83 PROP_PEER_CERTIFICATE,
84 PROP_PEER_CERTIFICATE_ERRORS
88 g_tls_connection_class_init (GTlsConnectionClass *klass)
90 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
92 gobject_class->get_property = g_tls_connection_get_property;
93 gobject_class->set_property = g_tls_connection_set_property;
96 * GTlsConnection:base-io-stream:
98 * The #GIOStream that the connection wraps
102 g_object_class_install_property (gobject_class, PROP_BASE_IO_STREAM,
103 g_param_spec_object ("base-io-stream",
105 P_("The GIOStream that the connection wraps"),
108 G_PARAM_CONSTRUCT_ONLY |
109 G_PARAM_STATIC_STRINGS));
111 * GTlsConnection:use-system-certdb:
113 * Whether or not the system certificate database will be used to
114 * verify peer certificates. See
115 * g_tls_connection_set_use_system_certdb().
117 * Deprecated: 2.30: Use GTlsConnection:database instead
119 g_object_class_install_property (gobject_class, PROP_USE_SYSTEM_CERTDB,
120 g_param_spec_boolean ("use-system-certdb",
121 P_("Use system certificate database"),
122 P_("Whether to verify peer certificates against the system certificate database"),
126 G_PARAM_STATIC_STRINGS));
128 * GTlsConnection:database:
130 * The certificate database to use when verifying this TLS connection.
131 * If no cerificate database is set, then the default database will be
132 * used. See g_tls_backend_get_default_database().
136 g_object_class_install_property (gobject_class, PROP_DATABASE,
137 g_param_spec_object ("database",
139 P_("Certificate database to use for looking up or verifying certificates"),
142 G_PARAM_STATIC_STRINGS));
144 * GTlsConnection:interaction:
146 * A #GTlsInteraction object to be used when the connection or certificate
147 * database need to interact with the user. This will be used to prompt the
148 * user for passwords where necessary.
152 g_object_class_install_property (gobject_class, PROP_INTERACTION,
153 g_param_spec_object ("interaction",
155 P_("Optional object for user interaction"),
156 G_TYPE_TLS_INTERACTION,
158 G_PARAM_STATIC_STRINGS));
160 * GTlsConnection:require-close-notify:
162 * Whether or not proper TLS close notification is required.
163 * See g_tls_connection_set_require_close_notify().
167 g_object_class_install_property (gobject_class, PROP_REQUIRE_CLOSE_NOTIFY,
168 g_param_spec_boolean ("require-close-notify",
169 P_("Require close notify"),
170 P_("Whether to require proper TLS close notification"),
174 G_PARAM_STATIC_STRINGS));
176 * GTlsConnection:rehandshake-mode:
178 * The rehandshaking mode. See
179 * g_tls_connection_set_rehandshake_mode().
183 g_object_class_install_property (gobject_class, PROP_REHANDSHAKE_MODE,
184 g_param_spec_enum ("rehandshake-mode",
185 P_("Rehandshake mode"),
186 P_("When to allow rehandshaking"),
187 G_TYPE_TLS_REHANDSHAKE_MODE,
188 G_TLS_REHANDSHAKE_SAFELY,
191 G_PARAM_STATIC_STRINGS));
193 * GTlsConnection:certificate:
195 * The connection's certificate; see
196 * g_tls_connection_set_certificate().
200 g_object_class_install_property (gobject_class, PROP_CERTIFICATE,
201 g_param_spec_object ("certificate",
203 P_("The connection's certificate"),
204 G_TYPE_TLS_CERTIFICATE,
206 G_PARAM_STATIC_STRINGS));
208 * GTlsConnection:peer-certificate:
210 * The connection's peer's certificate, after the TLS handshake has
211 * completed and the certificate has been accepted. Note in
212 * particular that this is not yet set during the emission of
213 * #GTlsConnection::accept-certificate.
215 * (You can watch for a #GObject::notify signal on this property to
216 * detect when a handshake has occurred.)
220 g_object_class_install_property (gobject_class, PROP_PEER_CERTIFICATE,
221 g_param_spec_object ("peer-certificate",
222 P_("Peer Certificate"),
223 P_("The connection's peer's certificate"),
224 G_TYPE_TLS_CERTIFICATE,
226 G_PARAM_STATIC_STRINGS));
228 * GTlsConnection:peer-certificate-errors:
230 * The errors noticed-and-ignored while verifying
231 * #GTlsConnection:peer-certificate. Normally this should be 0, but
232 * it may not be if #GTlsClientConnection:validation-flags is not
233 * %G_TLS_CERTIFICATE_VALIDATE_ALL, or if
234 * #GTlsConnection::accept-certificate overrode the default
239 g_object_class_install_property (gobject_class, PROP_PEER_CERTIFICATE_ERRORS,
240 g_param_spec_flags ("peer-certificate-errors",
241 P_("Peer Certificate Errors"),
242 P_("Errors found with the peer's certificate"),
243 G_TYPE_TLS_CERTIFICATE_FLAGS,
246 G_PARAM_STATIC_STRINGS));
249 * GTlsConnection::accept-certificate:
250 * @conn: a #GTlsConnection
251 * @peer_cert: the peer's #GTlsCertificate
252 * @errors: the problems with @peer_cert.
254 * Emitted during the TLS handshake after the peer certificate has
255 * been received. You can examine @peer_cert's certification path by
256 * calling g_tls_certificate_get_issuer() on it.
258 * For a client-side connection, @peer_cert is the server's
259 * certificate, and the signal will only be emitted if the
260 * certificate was not acceptable according to @conn's
261 * #GTlsClientConnection:validation_flags. If you would like the
262 * certificate to be accepted despite @errors, return %TRUE from the
263 * signal handler. Otherwise, if no handler accepts the certificate,
264 * the handshake will fail with %G_TLS_ERROR_BAD_CERTIFICATE.
266 * For a server-side connection, @peer_cert is the certificate
267 * presented by the client, if this was requested via the server's
268 * #GTlsServerConnection:authentication_mode. On the server side,
269 * the signal is always emitted when the client presents a
270 * certificate, and the certificate will only be accepted if a
271 * handler returns %TRUE.
273 * Note that if this signal is emitted as part of asynchronous I/O
274 * in the main thread, then you should not attempt to interact with
275 * the user before returning from the signal handler. If you want to
276 * let the user decide whether or not to accept the certificate, you
277 * would have to return %FALSE from the signal handler on the first
278 * attempt, and then after the connection attempt returns a
279 * %G_TLS_ERROR_HANDSHAKE, you can interact with the user, and if
280 * the user decides to accept the certificate, remember that fact,
281 * create a new connection, and return %TRUE from the signal handler
284 * If you are doing I/O in another thread, you do not
285 * need to worry about this, and can simply block in the signal
286 * handler until the UI thread returns an answer.
288 * Returns: %TRUE to accept @peer_cert (which will also
289 * immediately end the signal emission). %FALSE to allow the signal
290 * emission to continue, which will cause the handshake to fail if
291 * no one else overrides it.
295 signals[ACCEPT_CERTIFICATE] =
296 g_signal_new (I_("accept-certificate"),
297 G_TYPE_TLS_CONNECTION,
299 G_STRUCT_OFFSET (GTlsConnectionClass, accept_certificate),
300 g_signal_accumulator_true_handled, NULL,
303 G_TYPE_TLS_CERTIFICATE,
304 G_TYPE_TLS_CERTIFICATE_FLAGS);
308 g_tls_connection_init (GTlsConnection *conn)
313 g_tls_connection_get_property (GObject *object,
318 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
322 g_tls_connection_set_property (GObject *object,
327 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
331 * g_tls_connection_set_use_system_certdb:
332 * @conn: a #GTlsConnection
333 * @use_system_certdb: whether to use the system certificate database
335 * Sets whether @conn uses the system certificate database to verify
336 * peer certificates. This is %TRUE by default. If set to %FALSE, then
337 * peer certificate validation will always set the
338 * %G_TLS_CERTIFICATE_UNKNOWN_CA error (meaning
339 * #GTlsConnection::accept-certificate will always be emitted on
340 * client-side connections, unless that bit is not set in
341 * #GTlsClientConnection:validation-flags).
343 * Deprecated: 2.30: Use g_tls_connection_set_database() instead
346 g_tls_connection_set_use_system_certdb (GTlsConnection *conn,
347 gboolean use_system_certdb)
349 g_return_if_fail (G_IS_TLS_CONNECTION (conn));
351 g_object_set (G_OBJECT (conn),
352 "use-system-certdb", use_system_certdb,
357 * g_tls_connection_get_use_system_certdb:
358 * @conn: a #GTlsConnection
360 * Gets whether @conn uses the system certificate database to verify
361 * peer certificates. See g_tls_connection_set_use_system_certdb().
363 * Returns: whether @conn uses the system certificate database
365 * Deprecated: 2.30: Use g_tls_connection_get_database() instead
368 g_tls_connection_get_use_system_certdb (GTlsConnection *conn)
370 gboolean use_system_certdb;
372 g_return_val_if_fail (G_IS_TLS_CONNECTION (conn), TRUE);
374 g_object_get (G_OBJECT (conn),
375 "use-system-certdb", &use_system_certdb,
377 return use_system_certdb;
381 * g_tls_connection_set_database:
382 * @conn: a #GTlsConnection
383 * @database: a #GTlsDatabase
385 * Sets the certificate database that is used to verify peer certificates.
386 * This is set to the default database by default. See
387 * g_tls_backend_get_default_database(). If set to %NULL, then
388 * peer certificate validation will always set the
389 * %G_TLS_CERTIFICATE_UNKNOWN_CA error (meaning
390 * #GTlsConnection::accept-certificate will always be emitted on
391 * client-side connections, unless that bit is not set in
392 * #GTlsClientConnection:validation-flags).
397 g_tls_connection_set_database (GTlsConnection *conn,
398 GTlsDatabase *database)
400 g_return_if_fail (G_IS_TLS_CONNECTION (conn));
401 g_return_if_fail (database == NULL || G_IS_TLS_DATABASE (database));
403 g_object_set (G_OBJECT (conn),
404 "database", database,
409 * g_tls_connection_get_database:
410 * @conn: a #GTlsConnection
412 * Gets the certificate database that @conn uses to verify
413 * peer certificates. See g_tls_connection_set_database().
415 * Returns: (transfer none): the certificate database that @conn uses or %NULL
420 g_tls_connection_get_database (GTlsConnection *conn)
422 GTlsDatabase *database = NULL;
424 g_return_val_if_fail (G_IS_TLS_CONNECTION (conn), NULL);
426 g_object_get (G_OBJECT (conn),
427 "database", &database,
430 g_object_unref (database);
435 * g_tls_connection_set_certificate:
436 * @conn: a #GTlsConnection
437 * @certificate: the certificate to use for @conn
439 * This sets the certificate that @conn will present to its peer
440 * during the TLS handshake. For a #GTlsServerConnection, it is
441 * mandatory to set this, and that will normally be done at construct
444 * For a #GTlsClientConnection, this is optional. If a handshake fails
445 * with %G_TLS_ERROR_CERTIFICATE_REQUIRED, that means that the server
446 * requires a certificate, and if you try connecting again, you should
447 * call this method first. You can call
448 * g_tls_client_connection_get_accepted_cas() on the failed connection
449 * to get a list of Certificate Authorities that the server will
450 * accept certificates from.
452 * (It is also possible that a server will allow the connection with
453 * or without a certificate; in that case, if you don't provide a
454 * certificate, you can tell that the server requested one by the fact
455 * that g_tls_client_connection_get_accepted_cas() will return
461 g_tls_connection_set_certificate (GTlsConnection *conn,
462 GTlsCertificate *certificate)
464 g_return_if_fail (G_IS_TLS_CONNECTION (conn));
465 g_return_if_fail (G_IS_TLS_CERTIFICATE (certificate));
467 g_object_set (G_OBJECT (conn), "certificate", certificate, NULL);
471 * g_tls_connection_get_certificate:
472 * @conn: a #GTlsConnection
474 * Gets @conn's certificate, as set by
475 * g_tls_connection_set_certificate().
477 * Returns: (transfer none): @conn's certificate, or %NULL
482 g_tls_connection_get_certificate (GTlsConnection *conn)
484 GTlsCertificate *certificate;
486 g_return_val_if_fail (G_IS_TLS_CONNECTION (conn), NULL);
488 g_object_get (G_OBJECT (conn), "certificate", &certificate, NULL);
490 g_object_unref (certificate);
496 * g_tls_connection_set_interaction:
497 * @conn: a connection
498 * @interaction: (allow-none): an interaction object, or %NULL
500 * Set the object that will be used to interact with the user. It will be used
501 * for things like prompting the user for passwords.
503 * The @interaction argument will normally be a derived subclass of
504 * #GTlsInteraction. %NULL can also be provided if no user interaction
505 * should occur for this connection.
510 g_tls_connection_set_interaction (GTlsConnection *conn,
511 GTlsInteraction *interaction)
513 g_return_if_fail (G_IS_TLS_CONNECTION (conn));
514 g_return_if_fail (interaction == NULL || G_IS_TLS_INTERACTION (interaction));
516 g_object_set (G_OBJECT (conn), "interaction", interaction, NULL);
520 * g_tls_connection_get_interaction:
521 * @conn: a connection
523 * Get the object that will be used to interact with the user. It will be used
524 * for things like prompting the user for passwords. If %NULL is returned, then
525 * no user interaction will occur for this connection.
527 * Returns: (transfer none): The interaction object.
532 g_tls_connection_get_interaction (GTlsConnection *conn)
534 GTlsInteraction *interaction = NULL;
536 g_return_val_if_fail (G_IS_TLS_CONNECTION (conn), NULL);
538 g_object_get (G_OBJECT (conn), "interaction", &interaction, NULL);
540 g_object_unref (interaction);
546 * g_tls_connection_get_peer_certificate:
547 * @conn: a #GTlsConnection
549 * Gets @conn's peer's certificate after the handshake has completed.
550 * (It is not set during the emission of
551 * #GTlsConnection::accept-certificate.)
553 * Returns: (transfer none): @conn's peer's certificate, or %NULL
558 g_tls_connection_get_peer_certificate (GTlsConnection *conn)
560 GTlsCertificate *peer_certificate;
562 g_return_val_if_fail (G_IS_TLS_CONNECTION (conn), NULL);
564 g_object_get (G_OBJECT (conn), "peer-certificate", &peer_certificate, NULL);
565 if (peer_certificate)
566 g_object_unref (peer_certificate);
568 return peer_certificate;
572 * g_tls_connection_get_peer_certificate_errors:
573 * @conn: a #GTlsConnection
575 * Gets the errors associated with validating @conn's peer's
576 * certificate, after the handshake has completed. (It is not set
577 * during the emission of #GTlsConnection::accept-certificate.)
579 * Returns: @conn's peer's certificate errors
584 g_tls_connection_get_peer_certificate_errors (GTlsConnection *conn)
586 GTlsCertificateFlags errors;
588 g_return_val_if_fail (G_IS_TLS_CONNECTION (conn), 0);
590 g_object_get (G_OBJECT (conn), "peer-certificate-errors", &errors, NULL);
595 * g_tls_connection_set_require_close_notify:
596 * @conn: a #GTlsConnection
597 * @require_close_notify: whether or not to require close notification
599 * Sets whether or not @conn expects a proper TLS close notification
600 * before the connection is closed. If this is %TRUE (the default),
601 * then @conn will expect to receive a TLS close notification from its
602 * peer before the connection is closed, and will return a
603 * %G_TLS_ERROR_EOF error if the connection is closed without proper
604 * notification (since this may indicate a network error, or
605 * man-in-the-middle attack).
607 * In some protocols, the application will know whether or not the
608 * connection was closed cleanly based on application-level data
609 * (because the application-level data includes a length field, or is
610 * somehow self-delimiting); in this case, the close notify is
611 * redundant and sometimes omitted. (TLS 1.1 explicitly allows this;
612 * in TLS 1.0 it is technically an error, but often done anyway.) You
613 * can use g_tls_connection_set_require_close_notify() to tell @conn
614 * to allow an "unannounced" connection close, in which case the close
615 * will show up as a 0-length read, as in a non-TLS
616 * #GSocketConnection, and it is up to the application to check that
617 * the data has been fully received.
619 * Note that this only affects the behavior when the peer closes the
620 * connection; when the application calls g_io_stream_close() itself
621 * on @conn, this will send a close notification regardless of the
622 * setting of this property. If you explicitly want to do an unclean
623 * close, you can close @conn's #GTlsConnection:base-io-stream rather
624 * than closing @conn itself.
629 g_tls_connection_set_require_close_notify (GTlsConnection *conn,
630 gboolean require_close_notify)
632 g_return_if_fail (G_IS_TLS_CONNECTION (conn));
634 g_object_set (G_OBJECT (conn),
635 "require-close-notify", require_close_notify,
640 * g_tls_connection_get_require_close_notify:
641 * @conn: a #GTlsConnection
643 * Tests whether or not @conn expects a proper TLS close notification
644 * when the connection is closed. See
645 * g_tls_connection_set_require_close_notify() for details.
647 * Returns: %TRUE if @conn requires a proper TLS close
653 g_tls_connection_get_require_close_notify (GTlsConnection *conn)
655 gboolean require_close_notify;
657 g_return_val_if_fail (G_IS_TLS_CONNECTION (conn), TRUE);
659 g_object_get (G_OBJECT (conn),
660 "require-close-notify", &require_close_notify,
662 return require_close_notify;
666 * g_tls_connection_set_rehandshake_mode:
667 * @conn: a #GTlsConnection
668 * @mode: the rehandshaking mode
670 * Sets how @conn behaves with respect to rehandshaking requests.
672 * %G_TLS_REHANDSHAKE_NEVER means that it will never agree to
673 * rehandshake after the initial handshake is complete. (For a client,
674 * this means it will refuse rehandshake requests from the server, and
675 * for a server, this means it will close the connection with an error
676 * if the client attempts to rehandshake.)
678 * %G_TLS_REHANDSHAKE_SAFELY means that the connection will allow a
679 * rehandshake only if the other end of the connection supports the
680 * TLS `renegotiation_info` extension. This is the default behavior,
681 * but means that rehandshaking will not work against older
682 * implementations that do not support that extension.
684 * %G_TLS_REHANDSHAKE_UNSAFELY means that the connection will allow
685 * rehandshaking even without the `renegotiation_info` extension. On
686 * the server side in particular, this is not recommended, since it
687 * leaves the server open to certain attacks. However, this mode is
688 * necessary if you need to allow renegotiation with older client
694 g_tls_connection_set_rehandshake_mode (GTlsConnection *conn,
695 GTlsRehandshakeMode mode)
697 g_return_if_fail (G_IS_TLS_CONNECTION (conn));
699 g_object_set (G_OBJECT (conn),
700 "rehandshake-mode", mode,
705 * g_tls_connection_get_rehandshake_mode:
706 * @conn: a #GTlsConnection
708 * Gets @conn rehandshaking mode. See
709 * g_tls_connection_set_rehandshake_mode() for details.
711 * Returns: @conn's rehandshaking mode
716 g_tls_connection_get_rehandshake_mode (GTlsConnection *conn)
718 GTlsRehandshakeMode mode;
720 g_return_val_if_fail (G_IS_TLS_CONNECTION (conn), G_TLS_REHANDSHAKE_NEVER);
722 g_object_get (G_OBJECT (conn),
723 "rehandshake-mode", &mode,
729 * g_tls_connection_handshake:
730 * @conn: a #GTlsConnection
731 * @cancellable: (allow-none): a #GCancellable, or %NULL
732 * @error: a #GError, or %NULL
734 * Attempts a TLS handshake on @conn.
736 * On the client side, it is never necessary to call this method;
737 * although the connection needs to perform a handshake after
738 * connecting (or after sending a "STARTTLS"-type command) and may
739 * need to rehandshake later if the server requests it,
740 * #GTlsConnection will handle this for you automatically when you try
741 * to send or receive data on the connection. However, you can call
742 * g_tls_connection_handshake() manually if you want to know for sure
743 * whether the initial handshake succeeded or failed (as opposed to
744 * just immediately trying to write to @conn's output stream, in which
745 * case if it fails, it may not be possible to tell if it failed
746 * before or after completing the handshake).
748 * Likewise, on the server side, although a handshake is necessary at
749 * the beginning of the communication, you do not need to call this
750 * function explicitly unless you want clearer error reporting.
751 * However, you may call g_tls_connection_handshake() later on to
752 * renegotiate parameters (encryption methods, etc) with the client.
754 * #GTlsConnection::accept_certificate may be emitted during the
757 * Returns: success or failure
762 g_tls_connection_handshake (GTlsConnection *conn,
763 GCancellable *cancellable,
766 g_return_val_if_fail (G_IS_TLS_CONNECTION (conn), FALSE);
768 return G_TLS_CONNECTION_GET_CLASS (conn)->handshake (conn, cancellable, error);
772 * g_tls_connection_handshake_async:
773 * @conn: a #GTlsConnection
774 * @io_priority: the [I/O priority][io-priority] of the request
775 * @cancellable: (allow-none): a #GCancellable, or %NULL
776 * @callback: callback to call when the handshake is complete
777 * @user_data: the data to pass to the callback function
779 * Asynchronously performs a TLS handshake on @conn. See
780 * g_tls_connection_handshake() for more information.
785 g_tls_connection_handshake_async (GTlsConnection *conn,
787 GCancellable *cancellable,
788 GAsyncReadyCallback callback,
791 g_return_if_fail (G_IS_TLS_CONNECTION (conn));
793 G_TLS_CONNECTION_GET_CLASS (conn)->handshake_async (conn, io_priority,
795 callback, user_data);
799 * g_tls_connection_handshake_finish:
800 * @conn: a #GTlsConnection
801 * @result: a #GAsyncResult.
802 * @error: a #GError pointer, or %NULL
804 * Finish an asynchronous TLS handshake operation. See
805 * g_tls_connection_handshake() for more information.
807 * Returns: %TRUE on success, %FALSE on failure, in which
808 * case @error will be set.
813 g_tls_connection_handshake_finish (GTlsConnection *conn,
814 GAsyncResult *result,
817 g_return_val_if_fail (G_IS_TLS_CONNECTION (conn), FALSE);
819 return G_TLS_CONNECTION_GET_CLASS (conn)->handshake_finish (conn, result, error);
825 * Gets the TLS error quark.
827 * Returns: a #GQuark.
831 G_DEFINE_QUARK (g-tls-error-quark, g_tls_error)
834 * g_tls_connection_emit_accept_certificate:
835 * @conn: a #GTlsConnection
836 * @peer_cert: the peer's #GTlsCertificate
837 * @errors: the problems with @peer_cert
839 * Used by #GTlsConnection implementations to emit the
840 * #GTlsConnection::accept-certificate signal.
842 * Returns: %TRUE if one of the signal handlers has returned
843 * %TRUE to accept @peer_cert
848 g_tls_connection_emit_accept_certificate (GTlsConnection *conn,
849 GTlsCertificate *peer_cert,
850 GTlsCertificateFlags errors)
852 gboolean accept = FALSE;
854 g_signal_emit (conn, signals[ACCEPT_CERTIFICATE], 0,
855 peer_cert, errors, &accept);