:right-sidebar: True TlsDatabase =================================================================== .. currentmodule:: gi.repository.Gio .. versionadded:: 2.30 .. class:: TlsDatabase(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` ``GTlsDatabase`` is used to look up certificates and other information from a certificate or key store. It is an abstract base class which TLS library specific subtypes override. A ``GTlsDatabase`` may be accessed from multiple threads by the TLS backend. All implementations are required to be fully thread-safe. Most common client applications will not directly interact with ``GTlsDatabase``\. It is used internally by :obj:`~gi.repository.Gio.TlsConnection`\. Methods ------- .. rst-class:: interim-class .. class:: TlsDatabase :no-index: .. method:: create_certificate_handle(certificate: ~gi.repository.Gio.TlsCertificate) -> str | None Create a handle string for the certificate. The database will only be able to create a handle for certificates that originate from the database. In cases where the database cannot create a handle for a certificate, :const:`None` will be returned. This handle should be stable across various instances of the application, and between applications. If a certificate is modified in the database, then it is not guaranteed that this handle will continue to point to it. .. versionadded:: 2.30 :param certificate: certificate for which to create a handle. .. method:: do_create_certificate_handle(self, certificate: ~gi.repository.Gio.TlsCertificate) -> str | None :param certificate: .. method:: do_lookup_certificate_for_handle(self, handle: str, interaction: ~gi.repository.Gio.TlsInteraction | None, flags: ~gi.repository.Gio.TlsDatabaseLookupFlags, cancellable: ~gi.repository.Gio.Cancellable | None = None) -> ~gi.repository.Gio.TlsCertificate | None :param handle: :param interaction: :param flags: :param cancellable: .. method:: do_lookup_certificate_for_handle_async(self, handle: str, interaction: ~gi.repository.Gio.TlsInteraction | None, flags: ~gi.repository.Gio.TlsDatabaseLookupFlags, cancellable: ~gi.repository.Gio.Cancellable | None = None, callback: ~typing.Callable[[~gi.repository.GObject.Object | None, ~gi.repository.Gio.AsyncResult, ~typing.Any], None] | None = None, user_data: ~typing.Any = None) -> None :param handle: :param interaction: :param flags: :param cancellable: :param callback: :param user_data: .. method:: do_lookup_certificate_for_handle_finish(self, result: ~gi.repository.Gio.AsyncResult) -> ~gi.repository.Gio.TlsCertificate :param result: .. method:: do_lookup_certificate_issuer(self, certificate: ~gi.repository.Gio.TlsCertificate, interaction: ~gi.repository.Gio.TlsInteraction | None, flags: ~gi.repository.Gio.TlsDatabaseLookupFlags, cancellable: ~gi.repository.Gio.Cancellable | None = None) -> ~gi.repository.Gio.TlsCertificate :param certificate: :param interaction: :param flags: :param cancellable: .. method:: do_lookup_certificate_issuer_async(self, certificate: ~gi.repository.Gio.TlsCertificate, interaction: ~gi.repository.Gio.TlsInteraction | None, flags: ~gi.repository.Gio.TlsDatabaseLookupFlags, cancellable: ~gi.repository.Gio.Cancellable | None = None, callback: ~typing.Callable[[~gi.repository.GObject.Object | None, ~gi.repository.Gio.AsyncResult, ~typing.Any], None] | None = None, user_data: ~typing.Any = None) -> None :param certificate: :param interaction: :param flags: :param cancellable: :param callback: :param user_data: .. method:: do_lookup_certificate_issuer_finish(self, result: ~gi.repository.Gio.AsyncResult) -> ~gi.repository.Gio.TlsCertificate :param result: .. method:: do_lookup_certificates_issued_by(self, issuer_raw_dn: list[int], interaction: ~gi.repository.Gio.TlsInteraction | None, flags: ~gi.repository.Gio.TlsDatabaseLookupFlags, cancellable: ~gi.repository.Gio.Cancellable | None = None) -> list[~gi.repository.Gio.TlsCertificate] :param issuer_raw_dn: :param interaction: :param flags: :param cancellable: .. method:: do_lookup_certificates_issued_by_async(self, issuer_raw_dn: list[int], interaction: ~gi.repository.Gio.TlsInteraction | None, flags: ~gi.repository.Gio.TlsDatabaseLookupFlags, cancellable: ~gi.repository.Gio.Cancellable | None = None, callback: ~typing.Callable[[~gi.repository.GObject.Object | None, ~gi.repository.Gio.AsyncResult, ~typing.Any], None] | None = None, user_data: ~typing.Any = None) -> None :param issuer_raw_dn: :param interaction: :param flags: :param cancellable: :param callback: :param user_data: .. method:: do_lookup_certificates_issued_by_finish(self, result: ~gi.repository.Gio.AsyncResult) -> list[~gi.repository.Gio.TlsCertificate] :param result: .. method:: do_verify_chain(self, chain: ~gi.repository.Gio.TlsCertificate, purpose: str, identity: ~gi.repository.Gio.SocketConnectable | None, interaction: ~gi.repository.Gio.TlsInteraction | None, flags: ~gi.repository.Gio.TlsDatabaseVerifyFlags, cancellable: ~gi.repository.Gio.Cancellable | None = None) -> ~gi.repository.Gio.TlsCertificateFlags :param chain: :param purpose: :param identity: :param interaction: :param flags: :param cancellable: .. method:: do_verify_chain_async(self, chain: ~gi.repository.Gio.TlsCertificate, purpose: str, identity: ~gi.repository.Gio.SocketConnectable | None, interaction: ~gi.repository.Gio.TlsInteraction | None, flags: ~gi.repository.Gio.TlsDatabaseVerifyFlags, cancellable: ~gi.repository.Gio.Cancellable | None = None, callback: ~typing.Callable[[~gi.repository.GObject.Object | None, ~gi.repository.Gio.AsyncResult, ~typing.Any], None] | None = None, user_data: ~typing.Any = None) -> None :param chain: :param purpose: :param identity: :param interaction: :param flags: :param cancellable: :param callback: :param user_data: .. method:: do_verify_chain_finish(self, result: ~gi.repository.Gio.AsyncResult) -> ~gi.repository.Gio.TlsCertificateFlags :param result: .. method:: lookup_certificate_for_handle(handle: str, interaction: ~gi.repository.Gio.TlsInteraction | None, flags: ~gi.repository.Gio.TlsDatabaseLookupFlags, cancellable: ~gi.repository.Gio.Cancellable | None = None) -> ~gi.repository.Gio.TlsCertificate | None Look up a certificate by its handle. The handle should have been created by calling :func:`~gi.repository.Gio.TlsDatabase.create_certificate_handle` on a :obj:`~gi.repository.Gio.TlsDatabase` object of the same TLS backend. The handle is designed to remain valid across instantiations of the database. If the handle is no longer valid, or does not point to a certificate in this database, then :const:`None` will be returned. This function can block, use :func:`~gi.repository.Gio.TlsDatabase.lookup_certificate_for_handle_async` to perform the lookup operation asynchronously. .. versionadded:: 2.30 :param handle: a certificate handle :param interaction: used to interact with the user if necessary :param flags: Flags which affect the lookup. :param cancellable: a :obj:`~gi.repository.Gio.Cancellable`\, or :const:`None` .. method:: lookup_certificate_for_handle_async(handle: str, interaction: ~gi.repository.Gio.TlsInteraction | None, flags: ~gi.repository.Gio.TlsDatabaseLookupFlags, cancellable: ~gi.repository.Gio.Cancellable | None = None, callback: ~typing.Callable[[~gi.repository.GObject.Object | None, ~gi.repository.Gio.AsyncResult, ~typing.Any], None] | None = None, user_data: ~typing.Any = None) -> None Asynchronously look up a certificate by its handle in the database. See :func:`~gi.repository.Gio.TlsDatabase.lookup_certificate_for_handle` for more information. .. versionadded:: 2.30 :param handle: a certificate handle :param interaction: used to interact with the user if necessary :param flags: Flags which affect the lookup. :param cancellable: a :obj:`~gi.repository.Gio.Cancellable`\, or :const:`None` :param callback: callback to call when the operation completes :param user_data: the data to pass to the callback function .. method:: lookup_certificate_for_handle_finish(result: ~gi.repository.Gio.AsyncResult) -> ~gi.repository.Gio.TlsCertificate Finish an asynchronous lookup of a certificate by its handle. See :func:`~gi.repository.Gio.TlsDatabase.lookup_certificate_for_handle` for more information. If the handle is no longer valid, or does not point to a certificate in this database, then :const:`None` will be returned. .. versionadded:: 2.30 :param result: a :obj:`~gi.repository.Gio.AsyncResult`\. .. method:: lookup_certificate_issuer(certificate: ~gi.repository.Gio.TlsCertificate, interaction: ~gi.repository.Gio.TlsInteraction | None, flags: ~gi.repository.Gio.TlsDatabaseLookupFlags, cancellable: ~gi.repository.Gio.Cancellable | None = None) -> ~gi.repository.Gio.TlsCertificate Look up the issuer of ``certificate`` in the database. The :obj:`~gi.repository.Gio.TlsCertificate`\:issuer property of ``certificate`` is not modified, and the two certificates are not hooked into a chain. This function can block. Use :func:`~gi.repository.Gio.TlsDatabase.lookup_certificate_issuer_async` to perform the lookup operation asynchronously. Beware this function cannot be used to build certification paths. The issuer certificate returned by this function may not be the same as the certificate that would actually be used to construct a valid certification path during certificate verification. `RFC 4158 `__ explains why an issuer certificate cannot be naively assumed to be part of the the certification path (though GLib's TLS backends may not follow the path building strategies outlined in this RFC). Due to the complexity of certification path building, GLib does not provide any way to know which certification path will actually be used when verifying a TLS certificate. Accordingly, this function cannot be used to make security-related decisions. Only GLib itself should make security decisions about TLS certificates. .. versionadded:: 2.30 :param certificate: a :obj:`~gi.repository.Gio.TlsCertificate` :param interaction: used to interact with the user if necessary :param flags: flags which affect the lookup operation :param cancellable: a :obj:`~gi.repository.Gio.Cancellable`\, or :const:`None` .. method:: lookup_certificate_issuer_async(certificate: ~gi.repository.Gio.TlsCertificate, interaction: ~gi.repository.Gio.TlsInteraction | None, flags: ~gi.repository.Gio.TlsDatabaseLookupFlags, cancellable: ~gi.repository.Gio.Cancellable | None = None, callback: ~typing.Callable[[~gi.repository.GObject.Object | None, ~gi.repository.Gio.AsyncResult, ~typing.Any], None] | None = None, user_data: ~typing.Any = None) -> None Asynchronously look up the issuer of ``certificate`` in the database. See :func:`~gi.repository.Gio.TlsDatabase.lookup_certificate_issuer` for more information. .. versionadded:: 2.30 :param certificate: a :obj:`~gi.repository.Gio.TlsCertificate` :param interaction: used to interact with the user if necessary :param flags: flags which affect the lookup operation :param cancellable: a :obj:`~gi.repository.Gio.Cancellable`\, or :const:`None` :param callback: callback to call when the operation completes :param user_data: the data to pass to the callback function .. method:: lookup_certificate_issuer_finish(result: ~gi.repository.Gio.AsyncResult) -> ~gi.repository.Gio.TlsCertificate Finish an asynchronous lookup issuer operation. See :func:`~gi.repository.Gio.TlsDatabase.lookup_certificate_issuer` for more information. .. versionadded:: 2.30 :param result: a :obj:`~gi.repository.Gio.AsyncResult`\. .. method:: lookup_certificates_issued_by(issuer_raw_dn: list[int], interaction: ~gi.repository.Gio.TlsInteraction | None, flags: ~gi.repository.Gio.TlsDatabaseLookupFlags, cancellable: ~gi.repository.Gio.Cancellable | None = None) -> list[~gi.repository.Gio.TlsCertificate] Look up certificates issued by this issuer in the database. This function can block, use :func:`~gi.repository.Gio.TlsDatabase.lookup_certificates_issued_by_async` to perform the lookup operation asynchronously. .. versionadded:: 2.30 :param issuer_raw_dn: a ``GByteArray`` which holds the DER encoded issuer DN. :param interaction: used to interact with the user if necessary :param flags: Flags which affect the lookup operation. :param cancellable: a :obj:`~gi.repository.Gio.Cancellable`\, or :const:`None` .. method:: lookup_certificates_issued_by_async(issuer_raw_dn: list[int], interaction: ~gi.repository.Gio.TlsInteraction | None, flags: ~gi.repository.Gio.TlsDatabaseLookupFlags, cancellable: ~gi.repository.Gio.Cancellable | None = None, callback: ~typing.Callable[[~gi.repository.GObject.Object | None, ~gi.repository.Gio.AsyncResult, ~typing.Any], None] | None = None, user_data: ~typing.Any = None) -> None Asynchronously look up certificates issued by this issuer in the database. See :func:`~gi.repository.Gio.TlsDatabase.lookup_certificates_issued_by` for more information. The database may choose to hold a reference to the issuer byte array for the duration of this asynchronous operation. The byte array should not be modified during this time. .. versionadded:: 2.30 :param issuer_raw_dn: a ``GByteArray`` which holds the DER encoded issuer DN. :param interaction: used to interact with the user if necessary :param flags: Flags which affect the lookup operation. :param cancellable: a :obj:`~gi.repository.Gio.Cancellable`\, or :const:`None` :param callback: callback to call when the operation completes :param user_data: the data to pass to the callback function .. method:: lookup_certificates_issued_by_finish(result: ~gi.repository.Gio.AsyncResult) -> list[~gi.repository.Gio.TlsCertificate] Finish an asynchronous lookup of certificates. See :func:`~gi.repository.Gio.TlsDatabase.lookup_certificates_issued_by` for more information. .. versionadded:: 2.30 :param result: a :obj:`~gi.repository.Gio.AsyncResult`\. .. method:: verify_chain(chain: ~gi.repository.Gio.TlsCertificate, purpose: str, identity: ~gi.repository.Gio.SocketConnectable | None, interaction: ~gi.repository.Gio.TlsInteraction | None, flags: ~gi.repository.Gio.TlsDatabaseVerifyFlags, cancellable: ~gi.repository.Gio.Cancellable | None = None) -> ~gi.repository.Gio.TlsCertificateFlags Determines the validity of a certificate chain, outside the context of a TLS session. ``chain`` is a chain of :obj:`~gi.repository.Gio.TlsCertificate` objects each pointing to the next certificate in the chain by its :obj:`~gi.repository.Gio.TlsCertificate`\:issuer property. ``purpose`` describes the purpose (or usage) for which the certificate is being used. Typically ``purpose`` will be set to :const:`~gi.repository.Gio.TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVER` which means that the certificate is being used to authenticate a server (and we are acting as the client). The ``identity`` is used to ensure the server certificate is valid for the expected peer identity. If the identity does not match the certificate, :const:`~gi.repository.Gio.TlsCertificateFlags.BAD_IDENTITY` will be set in the return value. If ``identity`` is :const:`None`, that bit will never be set in the return value. The peer identity may also be used to check for pinned certificates (trust exceptions) in the database. These may override the normal verification process on a host-by-host basis. Currently there are no ``flags``\, and :const:`~gi.repository.Gio.TlsDatabaseVerifyFlags.NONE` should be used. If ``chain`` is found to be valid, then the return value will be 0. If ``chain`` is found to be invalid, then the return value will indicate at least one problem found. If the function is unable to determine whether ``chain`` is valid (for example, because ``cancellable`` is triggered before it completes) then the return value will be :const:`~gi.repository.Gio.TlsCertificateFlags.GENERIC_ERROR` and ``error`` will be set accordingly. ``error`` is not set when ``chain`` is successfully analyzed but found to be invalid. GLib guarantees that if certificate verification fails, at least one error will be set in the return value, but it does not guarantee that all possible errors will be set. Accordingly, you may not safely decide to ignore any particular type of error. For example, it would be incorrect to mask :const:`~gi.repository.Gio.TlsCertificateFlags.EXPIRED` if you want to allow expired certificates, because this could potentially be the only error flag set even if other problems exist with the certificate. Prior to GLib 2.48, GLib's default TLS backend modified ``chain`` to represent the certification path built by :obj:`~gi.repository.Gio.TlsDatabase` during certificate verification by adjusting the :obj:`~gi.repository.Gio.TlsCertificate`\:issuer property of each certificate in ``chain``\. Since GLib 2.48, this no longer occurs, so you cannot rely on :obj:`~gi.repository.Gio.TlsCertificate`\:issuer to represent the actual certification path used during certificate verification. Because TLS session context is not used, :obj:`~gi.repository.Gio.TlsDatabase` may not perform as many checks on the certificates as :obj:`~gi.repository.Gio.TlsConnection` would. For example, certificate constraints may not be honored, and revocation checks may not be performed. The best way to verify TLS certificates used by a TLS connection is to let :obj:`~gi.repository.Gio.TlsConnection` handle the verification. The TLS backend may attempt to look up and add missing certificates to the chain. This may involve HTTP requests to download missing certificates. This function can block. Use :func:`~gi.repository.Gio.TlsDatabase.verify_chain_async` to perform the verification operation asynchronously. .. versionadded:: 2.30 :param chain: a :obj:`~gi.repository.Gio.TlsCertificate` chain :param purpose: the purpose that this certificate chain will be used for. :param identity: the expected peer identity :param interaction: used to interact with the user if necessary :param flags: additional verify flags :param cancellable: a :obj:`~gi.repository.Gio.Cancellable`\, or :const:`None` .. method:: verify_chain_async(chain: ~gi.repository.Gio.TlsCertificate, purpose: str, identity: ~gi.repository.Gio.SocketConnectable | None, interaction: ~gi.repository.Gio.TlsInteraction | None, flags: ~gi.repository.Gio.TlsDatabaseVerifyFlags, cancellable: ~gi.repository.Gio.Cancellable | None = None, callback: ~typing.Callable[[~gi.repository.GObject.Object | None, ~gi.repository.Gio.AsyncResult, ~typing.Any], None] | None = None, user_data: ~typing.Any = None) -> None Asynchronously determines the validity of a certificate chain after looking up and adding any missing certificates to the chain. See :func:`~gi.repository.Gio.TlsDatabase.verify_chain` for more information. .. versionadded:: 2.30 :param chain: a :obj:`~gi.repository.Gio.TlsCertificate` chain :param purpose: the purpose that this certificate chain will be used for. :param identity: the expected peer identity :param interaction: used to interact with the user if necessary :param flags: additional verify flags :param cancellable: a :obj:`~gi.repository.Gio.Cancellable`\, or :const:`None` :param callback: callback to call when the operation completes :param user_data: the data to pass to the callback function .. method:: verify_chain_finish(result: ~gi.repository.Gio.AsyncResult) -> ~gi.repository.Gio.TlsCertificateFlags Finish an asynchronous verify chain operation. See :func:`~gi.repository.Gio.TlsDatabase.verify_chain` for more information. If ``chain`` is found to be valid, then the return value will be 0. If ``chain`` is found to be invalid, then the return value will indicate the problems found. If the function is unable to determine whether ``chain`` is valid or not (eg, because ``cancellable`` is triggered before it completes) then the return value will be :const:`~gi.repository.Gio.TlsCertificateFlags.GENERIC_ERROR` and ``error`` will be set accordingly. ``error`` is not set when ``chain`` is successfully analyzed but found to be invalid. .. versionadded:: 2.30 :param result: a :obj:`~gi.repository.Gio.AsyncResult`\. Virtual Methods --------------- .. rst-class:: interim-class .. class:: TlsDatabase :no-index: .. method:: do_create_certificate_handle(certificate: ~gi.repository.Gio.TlsCertificate) -> str | None Create a handle string for the certificate. The database will only be able to create a handle for certificates that originate from the database. In cases where the database cannot create a handle for a certificate, :const:`None` will be returned. This handle should be stable across various instances of the application, and between applications. If a certificate is modified in the database, then it is not guaranteed that this handle will continue to point to it. .. versionadded:: 2.30 :param certificate: certificate for which to create a handle. .. method:: do_lookup_certificate_for_handle(handle: str, interaction: ~gi.repository.Gio.TlsInteraction | None, flags: ~gi.repository.Gio.TlsDatabaseLookupFlags, cancellable: ~gi.repository.Gio.Cancellable | None = None) -> ~gi.repository.Gio.TlsCertificate | None Look up a certificate by its handle. The handle should have been created by calling :func:`~gi.repository.Gio.TlsDatabase.create_certificate_handle` on a :obj:`~gi.repository.Gio.TlsDatabase` object of the same TLS backend. The handle is designed to remain valid across instantiations of the database. If the handle is no longer valid, or does not point to a certificate in this database, then :const:`None` will be returned. This function can block, use :func:`~gi.repository.Gio.TlsDatabase.lookup_certificate_for_handle_async` to perform the lookup operation asynchronously. .. versionadded:: 2.30 :param handle: a certificate handle :param interaction: used to interact with the user if necessary :param flags: Flags which affect the lookup. :param cancellable: a :obj:`~gi.repository.Gio.Cancellable`\, or :const:`None` .. method:: do_lookup_certificate_for_handle_async(handle: str, interaction: ~gi.repository.Gio.TlsInteraction | None, flags: ~gi.repository.Gio.TlsDatabaseLookupFlags, cancellable: ~gi.repository.Gio.Cancellable | None = None, callback: ~typing.Callable[[~gi.repository.GObject.Object | None, ~gi.repository.Gio.AsyncResult, ~typing.Any], None] | None = None, user_data: ~typing.Any = None) -> None Asynchronously look up a certificate by its handle in the database. See :func:`~gi.repository.Gio.TlsDatabase.lookup_certificate_for_handle` for more information. .. versionadded:: 2.30 :param handle: a certificate handle :param interaction: used to interact with the user if necessary :param flags: Flags which affect the lookup. :param cancellable: a :obj:`~gi.repository.Gio.Cancellable`\, or :const:`None` :param callback: callback to call when the operation completes :param user_data: the data to pass to the callback function .. method:: do_lookup_certificate_for_handle_finish(result: ~gi.repository.Gio.AsyncResult) -> ~gi.repository.Gio.TlsCertificate Finish an asynchronous lookup of a certificate by its handle. See :func:`~gi.repository.Gio.TlsDatabase.lookup_certificate_for_handle` for more information. If the handle is no longer valid, or does not point to a certificate in this database, then :const:`None` will be returned. .. versionadded:: 2.30 :param result: a :obj:`~gi.repository.Gio.AsyncResult`\. .. method:: do_lookup_certificate_issuer(certificate: ~gi.repository.Gio.TlsCertificate, interaction: ~gi.repository.Gio.TlsInteraction | None, flags: ~gi.repository.Gio.TlsDatabaseLookupFlags, cancellable: ~gi.repository.Gio.Cancellable | None = None) -> ~gi.repository.Gio.TlsCertificate Look up the issuer of ``certificate`` in the database. The :obj:`~gi.repository.Gio.TlsCertificate`\:issuer property of ``certificate`` is not modified, and the two certificates are not hooked into a chain. This function can block. Use :func:`~gi.repository.Gio.TlsDatabase.lookup_certificate_issuer_async` to perform the lookup operation asynchronously. Beware this function cannot be used to build certification paths. The issuer certificate returned by this function may not be the same as the certificate that would actually be used to construct a valid certification path during certificate verification. `RFC 4158 `__ explains why an issuer certificate cannot be naively assumed to be part of the the certification path (though GLib's TLS backends may not follow the path building strategies outlined in this RFC). Due to the complexity of certification path building, GLib does not provide any way to know which certification path will actually be used when verifying a TLS certificate. Accordingly, this function cannot be used to make security-related decisions. Only GLib itself should make security decisions about TLS certificates. .. versionadded:: 2.30 :param certificate: a :obj:`~gi.repository.Gio.TlsCertificate` :param interaction: used to interact with the user if necessary :param flags: flags which affect the lookup operation :param cancellable: a :obj:`~gi.repository.Gio.Cancellable`\, or :const:`None` .. method:: do_lookup_certificate_issuer_async(certificate: ~gi.repository.Gio.TlsCertificate, interaction: ~gi.repository.Gio.TlsInteraction | None, flags: ~gi.repository.Gio.TlsDatabaseLookupFlags, cancellable: ~gi.repository.Gio.Cancellable | None = None, callback: ~typing.Callable[[~gi.repository.GObject.Object | None, ~gi.repository.Gio.AsyncResult, ~typing.Any], None] | None = None, user_data: ~typing.Any = None) -> None Asynchronously look up the issuer of ``certificate`` in the database. See :func:`~gi.repository.Gio.TlsDatabase.lookup_certificate_issuer` for more information. .. versionadded:: 2.30 :param certificate: a :obj:`~gi.repository.Gio.TlsCertificate` :param interaction: used to interact with the user if necessary :param flags: flags which affect the lookup operation :param cancellable: a :obj:`~gi.repository.Gio.Cancellable`\, or :const:`None` :param callback: callback to call when the operation completes :param user_data: the data to pass to the callback function .. method:: do_lookup_certificate_issuer_finish(result: ~gi.repository.Gio.AsyncResult) -> ~gi.repository.Gio.TlsCertificate Finish an asynchronous lookup issuer operation. See :func:`~gi.repository.Gio.TlsDatabase.lookup_certificate_issuer` for more information. .. versionadded:: 2.30 :param result: a :obj:`~gi.repository.Gio.AsyncResult`\. .. method:: do_lookup_certificates_issued_by(issuer_raw_dn: list[int], interaction: ~gi.repository.Gio.TlsInteraction | None, flags: ~gi.repository.Gio.TlsDatabaseLookupFlags, cancellable: ~gi.repository.Gio.Cancellable | None = None) -> list[~gi.repository.Gio.TlsCertificate] Look up certificates issued by this issuer in the database. This function can block, use :func:`~gi.repository.Gio.TlsDatabase.lookup_certificates_issued_by_async` to perform the lookup operation asynchronously. .. versionadded:: 2.30 :param issuer_raw_dn: a ``GByteArray`` which holds the DER encoded issuer DN. :param interaction: used to interact with the user if necessary :param flags: Flags which affect the lookup operation. :param cancellable: a :obj:`~gi.repository.Gio.Cancellable`\, or :const:`None` .. method:: do_lookup_certificates_issued_by_async(issuer_raw_dn: list[int], interaction: ~gi.repository.Gio.TlsInteraction | None, flags: ~gi.repository.Gio.TlsDatabaseLookupFlags, cancellable: ~gi.repository.Gio.Cancellable | None = None, callback: ~typing.Callable[[~gi.repository.GObject.Object | None, ~gi.repository.Gio.AsyncResult, ~typing.Any], None] | None = None, user_data: ~typing.Any = None) -> None Asynchronously look up certificates issued by this issuer in the database. See :func:`~gi.repository.Gio.TlsDatabase.lookup_certificates_issued_by` for more information. The database may choose to hold a reference to the issuer byte array for the duration of this asynchronous operation. The byte array should not be modified during this time. .. versionadded:: 2.30 :param issuer_raw_dn: a ``GByteArray`` which holds the DER encoded issuer DN. :param interaction: used to interact with the user if necessary :param flags: Flags which affect the lookup operation. :param cancellable: a :obj:`~gi.repository.Gio.Cancellable`\, or :const:`None` :param callback: callback to call when the operation completes :param user_data: the data to pass to the callback function .. method:: do_lookup_certificates_issued_by_finish(result: ~gi.repository.Gio.AsyncResult) -> list[~gi.repository.Gio.TlsCertificate] Finish an asynchronous lookup of certificates. See :func:`~gi.repository.Gio.TlsDatabase.lookup_certificates_issued_by` for more information. .. versionadded:: 2.30 :param result: a :obj:`~gi.repository.Gio.AsyncResult`\. .. method:: do_verify_chain(chain: ~gi.repository.Gio.TlsCertificate, purpose: str, identity: ~gi.repository.Gio.SocketConnectable | None, interaction: ~gi.repository.Gio.TlsInteraction | None, flags: ~gi.repository.Gio.TlsDatabaseVerifyFlags, cancellable: ~gi.repository.Gio.Cancellable | None = None) -> ~gi.repository.Gio.TlsCertificateFlags Determines the validity of a certificate chain, outside the context of a TLS session. ``chain`` is a chain of :obj:`~gi.repository.Gio.TlsCertificate` objects each pointing to the next certificate in the chain by its :obj:`~gi.repository.Gio.TlsCertificate`\:issuer property. ``purpose`` describes the purpose (or usage) for which the certificate is being used. Typically ``purpose`` will be set to :const:`~gi.repository.Gio.TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVER` which means that the certificate is being used to authenticate a server (and we are acting as the client). The ``identity`` is used to ensure the server certificate is valid for the expected peer identity. If the identity does not match the certificate, :const:`~gi.repository.Gio.TlsCertificateFlags.BAD_IDENTITY` will be set in the return value. If ``identity`` is :const:`None`, that bit will never be set in the return value. The peer identity may also be used to check for pinned certificates (trust exceptions) in the database. These may override the normal verification process on a host-by-host basis. Currently there are no ``flags``\, and :const:`~gi.repository.Gio.TlsDatabaseVerifyFlags.NONE` should be used. If ``chain`` is found to be valid, then the return value will be 0. If ``chain`` is found to be invalid, then the return value will indicate at least one problem found. If the function is unable to determine whether ``chain`` is valid (for example, because ``cancellable`` is triggered before it completes) then the return value will be :const:`~gi.repository.Gio.TlsCertificateFlags.GENERIC_ERROR` and ``error`` will be set accordingly. ``error`` is not set when ``chain`` is successfully analyzed but found to be invalid. GLib guarantees that if certificate verification fails, at least one error will be set in the return value, but it does not guarantee that all possible errors will be set. Accordingly, you may not safely decide to ignore any particular type of error. For example, it would be incorrect to mask :const:`~gi.repository.Gio.TlsCertificateFlags.EXPIRED` if you want to allow expired certificates, because this could potentially be the only error flag set even if other problems exist with the certificate. Prior to GLib 2.48, GLib's default TLS backend modified ``chain`` to represent the certification path built by :obj:`~gi.repository.Gio.TlsDatabase` during certificate verification by adjusting the :obj:`~gi.repository.Gio.TlsCertificate`\:issuer property of each certificate in ``chain``\. Since GLib 2.48, this no longer occurs, so you cannot rely on :obj:`~gi.repository.Gio.TlsCertificate`\:issuer to represent the actual certification path used during certificate verification. Because TLS session context is not used, :obj:`~gi.repository.Gio.TlsDatabase` may not perform as many checks on the certificates as :obj:`~gi.repository.Gio.TlsConnection` would. For example, certificate constraints may not be honored, and revocation checks may not be performed. The best way to verify TLS certificates used by a TLS connection is to let :obj:`~gi.repository.Gio.TlsConnection` handle the verification. The TLS backend may attempt to look up and add missing certificates to the chain. This may involve HTTP requests to download missing certificates. This function can block. Use :func:`~gi.repository.Gio.TlsDatabase.verify_chain_async` to perform the verification operation asynchronously. .. versionadded:: 2.30 :param chain: a :obj:`~gi.repository.Gio.TlsCertificate` chain :param purpose: the purpose that this certificate chain will be used for. :param identity: the expected peer identity :param interaction: used to interact with the user if necessary :param flags: additional verify flags :param cancellable: a :obj:`~gi.repository.Gio.Cancellable`\, or :const:`None` .. method:: do_verify_chain_async(chain: ~gi.repository.Gio.TlsCertificate, purpose: str, identity: ~gi.repository.Gio.SocketConnectable | None, interaction: ~gi.repository.Gio.TlsInteraction | None, flags: ~gi.repository.Gio.TlsDatabaseVerifyFlags, cancellable: ~gi.repository.Gio.Cancellable | None = None, callback: ~typing.Callable[[~gi.repository.GObject.Object | None, ~gi.repository.Gio.AsyncResult, ~typing.Any], None] | None = None, user_data: ~typing.Any = None) -> None Asynchronously determines the validity of a certificate chain after looking up and adding any missing certificates to the chain. See :func:`~gi.repository.Gio.TlsDatabase.verify_chain` for more information. .. versionadded:: 2.30 :param chain: a :obj:`~gi.repository.Gio.TlsCertificate` chain :param purpose: the purpose that this certificate chain will be used for. :param identity: the expected peer identity :param interaction: used to interact with the user if necessary :param flags: additional verify flags :param cancellable: a :obj:`~gi.repository.Gio.Cancellable`\, or :const:`None` :param callback: callback to call when the operation completes :param user_data: the data to pass to the callback function .. method:: do_verify_chain_finish(result: ~gi.repository.Gio.AsyncResult) -> ~gi.repository.Gio.TlsCertificateFlags Finish an asynchronous verify chain operation. See :func:`~gi.repository.Gio.TlsDatabase.verify_chain` for more information. If ``chain`` is found to be valid, then the return value will be 0. If ``chain`` is found to be invalid, then the return value will indicate the problems found. If the function is unable to determine whether ``chain`` is valid or not (eg, because ``cancellable`` is triggered before it completes) then the return value will be :const:`~gi.repository.Gio.TlsCertificateFlags.GENERIC_ERROR` and ``error`` will be set accordingly. ``error`` is not set when ``chain`` is successfully analyzed but found to be invalid. .. versionadded:: 2.30 :param result: a :obj:`~gi.repository.Gio.AsyncResult`\. Fields ------ .. rst-class:: interim-class .. class:: TlsDatabase :no-index: .. attribute:: parent_instance .. attribute:: priv