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, write to the
17 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18 * Boston, MA 02111-1307, USA.
24 #include "gtlsconnection.h"
25 #include "gcancellable.h"
26 #include "gioenumtypes.h"
28 #include "gtlsbackend.h"
29 #include "gtlscertificate.h"
30 #include "gtlsclientconnection.h"
31 #include "gtlsdatabase.h"
32 #include "gtlsinteraction.h"
36 * SECTION:gtlsconnection
37 * @short_description: TLS connection type
40 * #GTlsConnection is the base TLS connection class type, which wraps
41 * a #GIOStream and provides TLS encryption on top of it. Its
42 * subclasses, #GTlsClientConnection and #GTlsServerConnection,
43 * implement client-side and server-side TLS, respectively.
51 * Abstract base class for the backend-specific #GTlsClientConnection
52 * and #GTlsServerConnection types.
57 G_DEFINE_ABSTRACT_TYPE (GTlsConnection, g_tls_connection, G_TYPE_IO_STREAM)
59 static void g_tls_connection_get_property (GObject *object,
63 static void g_tls_connection_set_property (GObject *object,
74 static guint signals[LAST_SIGNAL] = { 0 };
79 PROP_REQUIRE_CLOSE_NOTIFY,
80 PROP_REHANDSHAKE_MODE,
81 PROP_USE_SYSTEM_CERTDB,
85 PROP_PEER_CERTIFICATE,
86 PROP_PEER_CERTIFICATE_ERRORS
90 g_tls_connection_class_init (GTlsConnectionClass *klass)
92 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
94 gobject_class->get_property = g_tls_connection_get_property;
95 gobject_class->set_property = g_tls_connection_set_property;
98 * GTlsConnection:base-io-stream:
100 * The #GIOStream that the connection wraps
104 g_object_class_install_property (gobject_class, PROP_BASE_IO_STREAM,
105 g_param_spec_object ("base-io-stream",
107 P_("The GIOStream that the connection wraps"),
110 G_PARAM_CONSTRUCT_ONLY |
111 G_PARAM_STATIC_STRINGS));
113 * GTlsConnection:use-system-certdb:
115 * Whether or not the system certificate database will be used to
116 * verify peer certificates. See
117 * g_tls_connection_set_use_system_certdb().
119 * Deprecated: 2.30: Use GTlsConnection:database instead
121 g_object_class_install_property (gobject_class, PROP_USE_SYSTEM_CERTDB,
122 g_param_spec_boolean ("use-system-certdb",
123 P_("Use system certificate database"),
124 P_("Whether to verify peer certificates against the system certificate database"),
128 G_PARAM_STATIC_STRINGS));
130 * GTlsConnection:database:
132 * The certificate database to use when verifying this TLS connection.
133 * If no cerificate database is set, then the default database will be
134 * used. See g_tls_backend_get_default_database().
138 g_object_class_install_property (gobject_class, PROP_DATABASE,
139 g_param_spec_object ("database",
141 P_("Certificate database to use for looking up or verifying certificates"),
144 G_PARAM_STATIC_STRINGS));
146 * GTlsConnection:interaction:
148 * A #GTlsInteraction object to be used when the connection or certificate
149 * database need to interact with the user. This will be used to prompt the
150 * user for passwords where necessary.
154 g_object_class_install_property (gobject_class, PROP_INTERACTION,
155 g_param_spec_object ("interaction",
157 P_("Optional object for user interaction"),
158 G_TYPE_TLS_INTERACTION,
160 G_PARAM_STATIC_STRINGS));
162 * GTlsConnection:require-close-notify:
164 * Whether or not proper TLS close notification is required.
165 * See g_tls_connection_set_require_close_notify().
169 g_object_class_install_property (gobject_class, PROP_REQUIRE_CLOSE_NOTIFY,
170 g_param_spec_boolean ("require-close-notify",
171 P_("Require close notify"),
172 P_("Whether to require proper TLS close notification"),
176 G_PARAM_STATIC_STRINGS));
178 * GTlsConnection:rehandshake-mode:
180 * The rehandshaking mode. See
181 * g_tls_connection_set_rehandshake_mode().
185 g_object_class_install_property (gobject_class, PROP_REHANDSHAKE_MODE,
186 g_param_spec_enum ("rehandshake-mode",
187 P_("Rehandshake mode"),
188 P_("When to allow rehandshaking"),
189 G_TYPE_TLS_REHANDSHAKE_MODE,
190 G_TLS_REHANDSHAKE_SAFELY,
193 G_PARAM_STATIC_STRINGS));
195 * GTlsConnection:certificate:
197 * The connection's certificate; see
198 * g_tls_connection_set_certificate().
202 g_object_class_install_property (gobject_class, PROP_CERTIFICATE,
203 g_param_spec_object ("certificate",
205 P_("The connection's certificate"),
206 G_TYPE_TLS_CERTIFICATE,
208 G_PARAM_STATIC_STRINGS));
210 * GTlsConnection:peer-certificate:
212 * The connection's peer's certificate, after the TLS handshake has
213 * completed and the certificate has been accepted. Note in
214 * particular that this is not yet set during the emission of
215 * #GTlsConnection::accept-certificate.
217 * (You can watch for a #GObject::notify signal on this property to
218 * detect when a handshake has occurred.)
222 g_object_class_install_property (gobject_class, PROP_PEER_CERTIFICATE,
223 g_param_spec_object ("peer-certificate",
224 P_("Peer Certificate"),
225 P_("The connection's peer's certificate"),
226 G_TYPE_TLS_CERTIFICATE,
228 G_PARAM_STATIC_STRINGS));
230 * GTlsConnection:peer-certificate-errors:
232 * The errors noticed-and-ignored while verifying
233 * #GTlsConnection:peer-certificate. Normally this should be 0, but
234 * it may not be if #GTlsClientConnection:validation-flags is not
235 * %G_TLS_CERTIFICATE_VALIDATE_ALL, or if
236 * #GTlsConnection::accept-certificate overrode the default
241 g_object_class_install_property (gobject_class, PROP_PEER_CERTIFICATE_ERRORS,
242 g_param_spec_flags ("peer-certificate-errors",
243 P_("Peer Certificate Errors"),
244 P_("Errors found with the peer's certificate"),
245 G_TYPE_TLS_CERTIFICATE_FLAGS,
248 G_PARAM_STATIC_STRINGS));
251 * GTlsConnection::accept-certificate:
252 * @conn: a #GTlsConnection
253 * @peer_cert: the peer's #GTlsCertificate
254 * @errors: the problems with @peer_cert.
256 * Emitted during the TLS handshake after the peer certificate has
257 * been received. You can examine @peer_cert's certification path by
258 * calling g_tls_certificate_get_issuer() on it.
260 * For a client-side connection, @peer_cert is the server's
261 * certificate, and the signal will only be emitted if the
262 * certificate was not acceptable according to @conn's
263 * #GTlsClientConnection:validation_flags. If you would like the
264 * certificate to be accepted despite @errors, return %TRUE from the
265 * signal handler. Otherwise, if no handler accepts the certificate,
266 * the handshake will fail with %G_TLS_ERROR_BAD_CERTIFICATE.
268 * For a server-side connection, @peer_cert is the certificate
269 * presented by the client, if this was requested via the server's
270 * #GTlsServerConnection:authentication_mode. On the server side,
271 * the signal is always emitted when the client presents a
272 * certificate, and the certificate will only be accepted if a
273 * handler returns %TRUE.
275 * Note that if this signal is emitted as part of asynchronous I/O
276 * in the main thread, then you should not attempt to interact with
277 * the user before returning from the signal handler. If you want to
278 * let the user decide whether or not to accept the certificate, you
279 * would have to return %FALSE from the signal handler on the first
280 * attempt, and then after the connection attempt returns a
281 * %G_TLS_ERROR_HANDSHAKE, you can interact with the user, and if
282 * the user decides to accept the certificate, remember that fact,
283 * create a new connection, and return %TRUE from the signal handler
286 * If you are doing I/O in another thread, you do not
287 * need to worry about this, and can simply block in the signal
288 * handler until the UI thread returns an answer.
290 * Return value: %TRUE to accept @peer_cert (which will also
291 * immediately end the signal emission). %FALSE to allow the signal
292 * emission to continue, which will cause the handshake to fail if
293 * no one else overrides it.
297 signals[ACCEPT_CERTIFICATE] =
298 g_signal_new (I_("accept-certificate"),
299 G_TYPE_TLS_CONNECTION,
301 G_STRUCT_OFFSET (GTlsConnectionClass, accept_certificate),
302 g_signal_accumulator_true_handled, NULL,
305 G_TYPE_TLS_CERTIFICATE,
306 G_TYPE_TLS_CERTIFICATE_FLAGS);
310 g_tls_connection_init (GTlsConnection *conn)
315 g_tls_connection_get_property (GObject *object,
320 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
324 g_tls_connection_set_property (GObject *object,
329 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
333 * g_tls_connection_set_use_system_certdb:
334 * @conn: a #GTlsConnection
335 * @use_system_certdb: whether to use the system certificate database
337 * Sets whether @conn uses the system certificate database to verify
338 * peer certificates. This is %TRUE by default. If set to %FALSE, then
339 * peer certificate validation will always set the
340 * %G_TLS_CERTIFICATE_UNKNOWN_CA error (meaning
341 * #GTlsConnection::accept-certificate will always be emitted on
342 * client-side connections, unless that bit is not set in
343 * #GTlsClientConnection:validation-flags).
345 * Deprecated: 2.30: Use g_tls_connection_set_database() instead
348 g_tls_connection_set_use_system_certdb (GTlsConnection *conn,
349 gboolean use_system_certdb)
351 g_return_if_fail (G_IS_TLS_CONNECTION (conn));
353 g_object_set (G_OBJECT (conn),
354 "use-system-certdb", use_system_certdb,
359 * g_tls_connection_get_use_system_certdb:
360 * @conn: a #GTlsConnection
362 * Gets whether @conn uses the system certificate database to verify
363 * peer certificates. See g_tls_connection_set_use_system_certdb().
365 * Return value: whether @conn uses the system certificate database
367 * Deprecated: 2.30: Use g_tls_connection_get_database() instead
370 g_tls_connection_get_use_system_certdb (GTlsConnection *conn)
372 gboolean use_system_certdb;
374 g_return_val_if_fail (G_IS_TLS_CONNECTION (conn), TRUE);
376 g_object_get (G_OBJECT (conn),
377 "use-system-certdb", &use_system_certdb,
379 return use_system_certdb;
383 * g_tls_connection_set_database:
384 * @conn: a #GTlsConnection
385 * @database: a #GTlsDatabase
387 * Sets the certificate database that is used to verify peer certificates.
388 * This is set to the default database by default. See
389 * g_tls_backend_get_default_database(). If set to %NULL, then
390 * peer certificate validation will always set the
391 * %G_TLS_CERTIFICATE_UNKNOWN_CA error (meaning
392 * #GTlsConnection::accept-certificate will always be emitted on
393 * client-side connections, unless that bit is not set in
394 * #GTlsClientConnection:validation-flags).
399 g_tls_connection_set_database (GTlsConnection *conn,
400 GTlsDatabase *database)
402 g_return_if_fail (G_IS_TLS_CONNECTION (conn));
403 g_return_if_fail (database == NULL || G_IS_TLS_DATABASE (database));
405 g_object_set (G_OBJECT (conn),
406 "database", database,
411 * g_tls_connection_get_database:
412 * @conn: a #GTlsConnection
414 * Gets the certificate database that @conn uses to verify
415 * peer certificates. See g_tls_connection_set_database().
417 * Return value: (transfer none): the certificate database that @conn uses or %NULL
422 g_tls_connection_get_database (GTlsConnection *conn)
424 GTlsDatabase *database = NULL;
426 g_return_val_if_fail (G_IS_TLS_CONNECTION (conn), NULL);
428 g_object_get (G_OBJECT (conn),
429 "database", &database,
432 g_object_unref (database);
437 * g_tls_connection_set_certificate:
438 * @conn: a #GTlsConnection
439 * @certificate: the certificate to use for @conn
441 * This sets the certificate that @conn will present to its peer
442 * during the TLS handshake. For a #GTlsServerConnection, it is
443 * mandatory to set this, and that will normally be done at construct
446 * For a #GTlsClientConnection, this is optional. If a handshake fails
447 * with %G_TLS_ERROR_CERTIFICATE_REQUIRED, that means that the server
448 * requires a certificate, and if you try connecting again, you should
449 * call this method first. You can call
450 * g_tls_client_connection_get_accepted_cas() on the failed connection
451 * to get a list of Certificate Authorities that the server will
452 * accept certificates from.
454 * (It is also possible that a server will allow the connection with
455 * or without a certificate; in that case, if you don't provide a
456 * certificate, you can tell that the server requested one by the fact
457 * that g_tls_client_connection_get_accepted_cas() will return
463 g_tls_connection_set_certificate (GTlsConnection *conn,
464 GTlsCertificate *certificate)
466 g_return_if_fail (G_IS_TLS_CONNECTION (conn));
467 g_return_if_fail (G_IS_TLS_CERTIFICATE (certificate));
469 g_object_set (G_OBJECT (conn), "certificate", certificate, NULL);
473 * g_tls_connection_get_certificate:
474 * @conn: a #GTlsConnection
476 * Gets @conn's certificate, as set by
477 * g_tls_connection_set_certificate().
479 * Return value: (transfer none): @conn's certificate, or %NULL
484 g_tls_connection_get_certificate (GTlsConnection *conn)
486 GTlsCertificate *certificate;
488 g_return_val_if_fail (G_IS_TLS_CONNECTION (conn), NULL);
490 g_object_get (G_OBJECT (conn), "certificate", &certificate, NULL);
492 g_object_unref (certificate);
498 * g_tls_connection_set_interaction:
499 * @conn: a connection
500 * @interaction: (allow-none): an interaction object, or %NULL
502 * Set the object that will be used to interact with the user. It will be used
503 * for things like prompting the user for passwords.
505 * The @interaction argument will normally be a derived subclass of
506 * #GTlsInteraction. %NULL can also be provided if no user interaction
507 * should occur for this connection.
512 g_tls_connection_set_interaction (GTlsConnection *conn,
513 GTlsInteraction *interaction)
515 g_return_if_fail (G_IS_TLS_CONNECTION (conn));
516 g_return_if_fail (interaction == NULL || G_IS_TLS_INTERACTION (interaction));
518 g_object_set (G_OBJECT (conn), "interaction", interaction, NULL);
522 * g_tls_connection_get_interaction:
523 * @conn: a connection
525 * Get the object that will be used to interact with the user. It will be used
526 * for things like prompting the user for passwords. If %NULL is returned, then
527 * no user interaction will occur for this connection.
529 * Returns: (transfer none): The interaction object.
534 g_tls_connection_get_interaction (GTlsConnection *conn)
536 GTlsInteraction *interaction = NULL;
538 g_return_val_if_fail (G_IS_TLS_CONNECTION (conn), NULL);
540 g_object_get (G_OBJECT (conn), "interaction", &interaction, NULL);
542 g_object_unref (interaction);
548 * g_tls_connection_get_peer_certificate:
549 * @conn: a #GTlsConnection
551 * Gets @conn's peer's certificate after the handshake has completed.
552 * (It is not set during the emission of
553 * #GTlsConnection::accept-certificate.)
555 * Return value: (transfer none): @conn's peer's certificate, or %NULL
560 g_tls_connection_get_peer_certificate (GTlsConnection *conn)
562 GTlsCertificate *peer_certificate;
564 g_return_val_if_fail (G_IS_TLS_CONNECTION (conn), NULL);
566 g_object_get (G_OBJECT (conn), "peer-certificate", &peer_certificate, NULL);
567 if (peer_certificate)
568 g_object_unref (peer_certificate);
570 return peer_certificate;
574 * g_tls_connection_get_peer_certificate_errors:
575 * @conn: a #GTlsConnection
577 * Gets the errors associated with validating @conn's peer's
578 * certificate, after the handshake has completed. (It is not set
579 * during the emission of #GTlsConnection::accept-certificate.)
581 * Return value: @conn's peer's certificate errors
586 g_tls_connection_get_peer_certificate_errors (GTlsConnection *conn)
588 GTlsCertificateFlags errors;
590 g_return_val_if_fail (G_IS_TLS_CONNECTION (conn), 0);
592 g_object_get (G_OBJECT (conn), "peer-certificate-errors", &errors, NULL);
597 * g_tls_connection_set_require_close_notify:
598 * @conn: a #GTlsConnection
599 * @require_close_notify: whether or not to require close notification
601 * Sets whether or not @conn expects a proper TLS close notification
602 * before the connection is closed. If this is %TRUE (the default),
603 * then @conn will expect to receive a TLS close notification from its
604 * peer before the connection is closed, and will return a
605 * %G_TLS_ERROR_EOF error if the connection is closed without proper
606 * notification (since this may indicate a network error, or
607 * man-in-the-middle attack).
609 * In some protocols, the application will know whether or not the
610 * connection was closed cleanly based on application-level data
611 * (because the application-level data includes a length field, or is
612 * somehow self-delimiting); in this case, the close notify is
613 * redundant and sometimes omitted. (TLS 1.1 explicitly allows this;
614 * in TLS 1.0 it is technically an error, but often done anyway.) You
615 * can use g_tls_connection_set_require_close_notify() to tell @conn
616 * to allow an "unannounced" connection close, in which case the close
617 * will show up as a 0-length read, as in a non-TLS
618 * #GSocketConnection, and it is up to the application to check that
619 * the data has been fully received.
621 * Note that this only affects the behavior when the peer closes the
622 * connection; when the application calls g_io_stream_close() itself
623 * on @conn, this will send a close notification regardless of the
624 * setting of this property. If you explicitly want to do an unclean
625 * close, you can close @conn's #GTlsConnection:base-io-stream rather
626 * than closing @conn itself.
631 g_tls_connection_set_require_close_notify (GTlsConnection *conn,
632 gboolean require_close_notify)
634 g_return_if_fail (G_IS_TLS_CONNECTION (conn));
636 g_object_set (G_OBJECT (conn),
637 "require-close-notify", require_close_notify,
642 * g_tls_connection_get_require_close_notify:
643 * @conn: a #GTlsConnection
645 * Tests whether or not @conn expects a proper TLS close notification
646 * when the connection is closed. See
647 * g_tls_connection_set_require_close_notify() for details.
649 * Return value: %TRUE if @conn requires a proper TLS close
655 g_tls_connection_get_require_close_notify (GTlsConnection *conn)
657 gboolean require_close_notify;
659 g_return_val_if_fail (G_IS_TLS_CONNECTION (conn), TRUE);
661 g_object_get (G_OBJECT (conn),
662 "require-close-notify", &require_close_notify,
664 return require_close_notify;
668 * g_tls_connection_set_rehandshake_mode:
669 * @conn: a #GTlsConnection
670 * @mode: the rehandshaking mode
672 * Sets how @conn behaves with respect to rehandshaking requests.
674 * %G_TLS_REHANDSHAKE_NEVER means that it will never agree to
675 * rehandshake after the initial handshake is complete. (For a client,
676 * this means it will refuse rehandshake requests from the server, and
677 * for a server, this means it will close the connection with an error
678 * if the client attempts to rehandshake.)
680 * %G_TLS_REHANDSHAKE_SAFELY means that the connection will allow a
681 * rehandshake only if the other end of the connection supports the
682 * TLS <literal>renegotiation_info</literal> extension. This is the
683 * default behavior, but means that rehandshaking will not work
684 * against older implementations that do not support that extension.
686 * %G_TLS_REHANDSHAKE_UNSAFELY means that the connection will allow
687 * rehandshaking even without the
688 * <literal>renegotiation_info</literal> extension. On the server side
689 * in particular, this is not recommended, since it leaves the server
690 * open to certain attacks. However, this mode is necessary if you
691 * need to allow renegotiation with older client software.
696 g_tls_connection_set_rehandshake_mode (GTlsConnection *conn,
697 GTlsRehandshakeMode mode)
699 g_return_if_fail (G_IS_TLS_CONNECTION (conn));
701 g_object_set (G_OBJECT (conn),
702 "rehandshake-mode", mode,
707 * g_tls_connection_get_rehandshake_mode:
708 * @conn: a #GTlsConnection
710 * Gets @conn rehandshaking mode. See
711 * g_tls_connection_set_rehandshake_mode() for details.
713 * Return value: @conn's rehandshaking mode
718 g_tls_connection_get_rehandshake_mode (GTlsConnection *conn)
720 GTlsRehandshakeMode mode;
722 g_return_val_if_fail (G_IS_TLS_CONNECTION (conn), G_TLS_REHANDSHAKE_NEVER);
724 g_object_get (G_OBJECT (conn),
725 "rehandshake-mode", &mode,
731 * g_tls_connection_handshake:
732 * @conn: a #GTlsConnection
733 * @cancellable: (allow-none): a #GCancellable, or %NULL
734 * @error: a #GError, or %NULL
736 * Attempts a TLS handshake on @conn.
738 * On the client side, it is never necessary to call this method;
739 * although the connection needs to perform a handshake after
740 * connecting (or after sending a "STARTTLS"-type command) and may
741 * need to rehandshake later if the server requests it,
742 * #GTlsConnection will handle this for you automatically when you try
743 * to send or receive data on the connection. However, you can call
744 * g_tls_connection_handshake() manually if you want to know for sure
745 * whether the initial handshake succeeded or failed (as opposed to
746 * just immediately trying to write to @conn's output stream, in which
747 * case if it fails, it may not be possible to tell if it failed
748 * before or after completing the handshake).
750 * Likewise, on the server side, although a handshake is necessary at
751 * the beginning of the communication, you do not need to call this
752 * function explicitly unless you want clearer error reporting.
753 * However, you may call g_tls_connection_handshake() later on to
754 * renegotiate parameters (encryption methods, etc) with the client.
756 * #GTlsConnection::accept_certificate may be emitted during the
759 * Return value: success or failure
764 g_tls_connection_handshake (GTlsConnection *conn,
765 GCancellable *cancellable,
768 g_return_val_if_fail (G_IS_TLS_CONNECTION (conn), FALSE);
770 return G_TLS_CONNECTION_GET_CLASS (conn)->handshake (conn, cancellable, error);
774 * g_tls_connection_handshake_async:
775 * @conn: a #GTlsConnection
776 * @io_priority: the <link linkend="io-priority">I/O priority</link>
778 * @cancellable: (allow-none): a #GCancellable, or %NULL
779 * @callback: callback to call when the handshake is complete
780 * @user_data: the data to pass to the callback function
782 * Asynchronously performs a TLS handshake on @conn. See
783 * g_tls_connection_handshake() for more information.
788 g_tls_connection_handshake_async (GTlsConnection *conn,
790 GCancellable *cancellable,
791 GAsyncReadyCallback callback,
794 g_return_if_fail (G_IS_TLS_CONNECTION (conn));
796 G_TLS_CONNECTION_GET_CLASS (conn)->handshake_async (conn, io_priority,
798 callback, user_data);
802 * g_tls_connection_handshake_finish:
803 * @conn: a #GTlsConnection
804 * @result: a #GAsyncResult.
805 * @error: a #GError pointer, or %NULL
807 * Finish an asynchronous TLS handshake operation. See
808 * g_tls_connection_handshake() for more information.
810 * Return value: %TRUE on success, %FALSE on failure, in which
811 * case @error will be set.
816 g_tls_connection_handshake_finish (GTlsConnection *conn,
817 GAsyncResult *result,
820 g_return_val_if_fail (G_IS_TLS_CONNECTION (conn), FALSE);
822 return G_TLS_CONNECTION_GET_CLASS (conn)->handshake_finish (conn, result, error);
828 * Gets the TLS error quark.
830 * Return value: a #GQuark.
834 G_DEFINE_QUARK (g-tls-error-quark, g_tls_error)
837 * g_tls_connection_emit_accept_certificate:
838 * @conn: a #GTlsConnection
839 * @peer_cert: the peer's #GTlsCertificate
840 * @errors: the problems with @peer_cert
842 * Used by #GTlsConnection implementations to emit the
843 * #GTlsConnection::accept-certificate signal.
845 * Return value: %TRUE if one of the signal handlers has returned
846 * %TRUE to accept @peer_cert
851 g_tls_connection_emit_accept_certificate (GTlsConnection *conn,
852 GTlsCertificate *peer_cert,
853 GTlsCertificateFlags errors)
855 gboolean accept = FALSE;
857 g_signal_emit (conn, signals[ACCEPT_CERTIFICATE], 0,
858 peer_cert, errors, &accept);