Gio.TlsDatabase¶
| Subclasses: | None |
|---|
Methods¶
| Inherited: | GObject.Object (37) |
|---|---|
| Structs: | GObject.ObjectClass (5) |
create_certificate_handle (certificate) |
|
lookup_certificate_for_handle (handle, interaction, flags, cancellable) |
|
lookup_certificate_for_handle_async (handle, interaction, flags, cancellable, callback, *user_data) |
|
lookup_certificate_for_handle_finish (result) |
|
lookup_certificate_issuer (certificate, interaction, flags, cancellable) |
|
lookup_certificate_issuer_async (certificate, interaction, flags, cancellable, callback, *user_data) |
|
lookup_certificate_issuer_finish (result) |
|
lookup_certificates_issued_by (issuer_raw_dn, interaction, flags, cancellable) |
|
lookup_certificates_issued_by_async (issuer_raw_dn, interaction, flags, cancellable, callback, *user_data) |
|
lookup_certificates_issued_by_finish (result) |
|
verify_chain (chain, purpose, identity, interaction, flags, cancellable) |
|
verify_chain_async (chain, purpose, identity, interaction, flags, cancellable, callback, *user_data) |
|
verify_chain_finish (result) |
Virtual Methods¶
| Inherited: | GObject.Object (7) |
|---|
do_create_certificate_handle (certificate) |
|
do_lookup_certificate_for_handle (handle, interaction, flags, cancellable) |
|
do_lookup_certificate_for_handle_async (handle, interaction, flags, cancellable, callback, *user_data) |
|
do_lookup_certificate_for_handle_finish (result) |
|
do_lookup_certificate_issuer (certificate, interaction, flags, cancellable) |
|
do_lookup_certificate_issuer_async (certificate, interaction, flags, cancellable, callback, *user_data) |
|
do_lookup_certificate_issuer_finish (result) |
|
do_lookup_certificates_issued_by (issuer_raw_dn, interaction, flags, cancellable) |
|
do_lookup_certificates_issued_by_async (issuer_raw_dn, interaction, flags, cancellable, callback, *user_data) |
|
do_lookup_certificates_issued_by_finish (result) |
|
do_verify_chain (chain, purpose, identity, interaction, flags, cancellable) |
|
do_verify_chain_async (chain, purpose, identity, interaction, flags, cancellable, callback, *user_data) |
|
do_verify_chain_finish (result) |
Properties¶
None
Signals¶
| Inherited: | GObject.Object (1) |
|---|
Class Details¶
-
class
Gio.TlsDatabase(**kwargs)¶ Bases: GObject.ObjectAbstract: Yes Structure: Gio.TlsDatabaseClassGio.TlsDatabaseis 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
Gio.TlsDatabasemay 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
Gio.TlsDatabase. It is used internally byGio.TlsConnection.New in version 2.30.
-
create_certificate_handle(certificate)[source]¶ Parameters: certificate ( Gio.TlsCertificate) – certificate for which to create a handle.Returns: a newly allocated string containing the handle. Return type: strorNoneCreate 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,
Nonewill 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.
New in version 2.30.
-
lookup_certificate_for_handle(handle, interaction, flags, cancellable)[source]¶ Parameters: - handle (
str) – a certificate handle - interaction (
Gio.TlsInteractionorNone) – used to interact with the user if necessary - flags (
Gio.TlsDatabaseLookupFlags) – Flags which affect the lookup. - cancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone
Raises: Returns: a newly allocated
Gio.TlsCertificate, orNone. UseGObject.Object.unref() to release the certificate.Return type: Look up a certificate by its handle.
The handle should have been created by calling
Gio.TlsDatabase.create_certificate_handle() on aGio.TlsDatabaseobject 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
Nonewill be returned.This function can block, use
Gio.TlsDatabase.lookup_certificate_for_handle_async() to perform the lookup operation asynchronously.New in version 2.30.
- handle (
-
lookup_certificate_for_handle_async(handle, interaction, flags, cancellable, callback, *user_data)[source]¶ Parameters: - handle (
str) – a certificate handle - interaction (
Gio.TlsInteractionorNone) – used to interact with the user if necessary - flags (
Gio.TlsDatabaseLookupFlags) – Flags which affect the lookup. - cancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone - callback (
Gio.AsyncReadyCallbackorNone) – callback to call when the operation completes - user_data (
objectorNone) – the data to pass to the callback function
Asynchronously look up a certificate by its handle in the database. See
Gio.TlsDatabase.lookup_certificate_for_handle() for more information.New in version 2.30.
- handle (
-
lookup_certificate_for_handle_finish(result)[source]¶ Parameters: result ( Gio.AsyncResult) – aGio.AsyncResult.Raises: GLib.ErrorReturns: a newly allocated Gio.TlsCertificateobject. UseGObject.Object.unref() to release the certificate.Return type: Gio.TlsCertificateFinish an asynchronous lookup of a certificate by its handle. See
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
Nonewill be returned.New in version 2.30.
-
lookup_certificate_issuer(certificate, interaction, flags, cancellable)[source]¶ Parameters: - certificate (
Gio.TlsCertificate) – aGio.TlsCertificate - interaction (
Gio.TlsInteractionorNone) – used to interact with the user if necessary - flags (
Gio.TlsDatabaseLookupFlags) – flags which affect the lookup operation - cancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone
Raises: Returns: a newly allocated issuer
Gio.TlsCertificate, orNone. UseGObject.Object.unref() to release the certificate.Return type: Look up the issuer of certificate in the database.
The
Gio.TlsCertificate:issuerproperty of certificate is not modified, and the two certificates are not hooked into a chain.This function can block, use
Gio.TlsDatabase.lookup_certificate_issuer_async() to perform the lookup operation asynchronously.New in version 2.30.
- certificate (
-
lookup_certificate_issuer_async(certificate, interaction, flags, cancellable, callback, *user_data)[source]¶ Parameters: - certificate (
Gio.TlsCertificate) – aGio.TlsCertificate - interaction (
Gio.TlsInteractionorNone) – used to interact with the user if necessary - flags (
Gio.TlsDatabaseLookupFlags) – flags which affect the lookup operation - cancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone - callback (
Gio.AsyncReadyCallbackorNone) – callback to call when the operation completes - user_data (
objectorNone) – the data to pass to the callback function
Asynchronously look up the issuer of certificate in the database. See
Gio.TlsDatabase.lookup_certificate_issuer() for more information.New in version 2.30.
- certificate (
-
lookup_certificate_issuer_finish(result)[source]¶ Parameters: result ( Gio.AsyncResult) – aGio.AsyncResult.Raises: GLib.ErrorReturns: a newly allocated issuer Gio.TlsCertificate, orNone. UseGObject.Object.unref() to release the certificate.Return type: Gio.TlsCertificateFinish an asynchronous lookup issuer operation. See
Gio.TlsDatabase.lookup_certificate_issuer() for more information.New in version 2.30.
-
lookup_certificates_issued_by(issuer_raw_dn, interaction, flags, cancellable)[source]¶ Parameters: - issuer_raw_dn (
bytes) – aGLib.ByteArraywhich holds the DER encoded issuer DN. - interaction (
Gio.TlsInteractionorNone) – used to interact with the user if necessary - flags (
Gio.TlsDatabaseLookupFlags) – Flags which affect the lookup operation. - cancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone
Raises: Returns: a newly allocated list of
Gio.TlsCertificateobjects. UseGObject.Object.unref() on each certificate, and g_list_free() on the release the list.Return type: Look up certificates issued by this issuer in the database.
This function can block, use
Gio.TlsDatabase.lookup_certificates_issued_by_async() to perform the lookup operation asynchronously.New in version 2.30.
- issuer_raw_dn (
-
lookup_certificates_issued_by_async(issuer_raw_dn, interaction, flags, cancellable, callback, *user_data)[source]¶ Parameters: - issuer_raw_dn (
bytes) – aGLib.ByteArraywhich holds the DER encoded issuer DN. - interaction (
Gio.TlsInteractionorNone) – used to interact with the user if necessary - flags (
Gio.TlsDatabaseLookupFlags) – Flags which affect the lookup operation. - cancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone - callback (
Gio.AsyncReadyCallbackorNone) – callback to call when the operation completes - user_data (
objectorNone) – the data to pass to the callback function
Asynchronously look up certificates issued by this issuer in the database. See
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 of this asynchronous operation. The byte array should not be modified during this time.
New in version 2.30.
- issuer_raw_dn (
-
lookup_certificates_issued_by_finish(result)[source]¶ Parameters: result ( Gio.AsyncResult) – aGio.AsyncResult.Raises: GLib.ErrorReturns: a newly allocated list of Gio.TlsCertificateobjects. UseGObject.Object.unref() on each certificate, and g_list_free() on the release the list.Return type: [ Gio.TlsCertificate]Finish an asynchronous lookup of certificates. See
Gio.TlsDatabase.lookup_certificates_issued_by() for more information.New in version 2.30.
-
verify_chain(chain, purpose, identity, interaction, flags, cancellable)[source]¶ Parameters: - chain (
Gio.TlsCertificate) – aGio.TlsCertificatechain - purpose (
str) – the purpose that this certificate chain will be used for. - identity (
Gio.SocketConnectableorNone) – the expected peer identity - interaction (
Gio.TlsInteractionorNone) – used to interact with the user if necessary - flags (
Gio.TlsDatabaseVerifyFlags) – additional verify flags - cancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone
Raises: Returns: the appropriate
Gio.TlsCertificateFlagswhich represents the result of verification.Return type: Determines the validity of a certificate chain after looking up and adding any missing certificates to the chain.
chain is a chain of
Gio.TlsCertificateobjects each pointing to the next certificate in the chain by itsGio.TlsCertificate:issuerproperty. The chain may initially consist of one or more certificates. After the verification process is complete, chain may be modified by adding missing certificates, or removing extra certificates. If a certificate anchor was found, then it is added to the chain.purpose describes the purpose (or usage) for which the certificate is being used. Typically purpose will be set to
Gio.TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVERwhich 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,
Gio.TlsCertificateFlags.BAD_IDENTITYwill be set in the return value. If identity isNone, 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
Gio.TlsDatabaseVerifyFlags.NONEshould 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 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
Gio.TlsCertificateFlags.GENERIC_ERRORand error will be set accordingly. error is not set when chain is successfully analyzed but found to be invalid.This function can block, use
Gio.TlsDatabase.verify_chain_async() to perform the verification operation asynchronously.New in version 2.30.
- chain (
-
verify_chain_async(chain, purpose, identity, interaction, flags, cancellable, callback, *user_data)[source]¶ Parameters: - chain (
Gio.TlsCertificate) – aGio.TlsCertificatechain - purpose (
str) – the purpose that this certificate chain will be used for. - identity (
Gio.SocketConnectableorNone) – the expected peer identity - interaction (
Gio.TlsInteractionorNone) – used to interact with the user if necessary - flags (
Gio.TlsDatabaseVerifyFlags) – additional verify flags - cancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone - callback (
Gio.AsyncReadyCallbackorNone) – callback to call when the operation completes - user_data (
objectorNone) – the data to pass to the callback function
Asynchronously determines the validity of a certificate chain after looking up and adding any missing certificates to the chain. See
Gio.TlsDatabase.verify_chain() for more information.New in version 2.30.
- chain (
-
verify_chain_finish(result)[source]¶ Parameters: result ( Gio.AsyncResult) – aGio.AsyncResult.Raises: GLib.ErrorReturns: the appropriate Gio.TlsCertificateFlagswhich represents the result of verification.Return type: Gio.TlsCertificateFlagsFinish an asynchronous verify chain operation. See
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
Gio.TlsCertificateFlags.GENERIC_ERRORand error will be set accordingly. error is not set when chain is successfully analyzed but found to be invalid.New in version 2.30.
-
do_create_certificate_handle(certificate) virtual¶ Parameters: certificate ( Gio.TlsCertificate) – certificate for which to create a handle.Returns: a newly allocated string containing the handle. Return type: strorNoneCreate 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,
Nonewill 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.
New in version 2.30.
-
do_lookup_certificate_for_handle(handle, interaction, flags, cancellable) virtual¶ Parameters: - handle (
str) – a certificate handle - interaction (
Gio.TlsInteractionorNone) – used to interact with the user if necessary - flags (
Gio.TlsDatabaseLookupFlags) – Flags which affect the lookup. - cancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone
Returns: a newly allocated
Gio.TlsCertificate, orNone. UseGObject.Object.unref() to release the certificate.Return type: Look up a certificate by its handle.
The handle should have been created by calling
Gio.TlsDatabase.create_certificate_handle() on aGio.TlsDatabaseobject 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
Nonewill be returned.This function can block, use
Gio.TlsDatabase.lookup_certificate_for_handle_async() to perform the lookup operation asynchronously.New in version 2.30.
- handle (
-
do_lookup_certificate_for_handle_async(handle, interaction, flags, cancellable, callback, *user_data) virtual¶ Parameters: - handle (
str) – a certificate handle - interaction (
Gio.TlsInteractionorNone) – used to interact with the user if necessary - flags (
Gio.TlsDatabaseLookupFlags) – Flags which affect the lookup. - cancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone - callback (
Gio.AsyncReadyCallbackorNone) – callback to call when the operation completes - user_data (
objectorNone) – the data to pass to the callback function
Asynchronously look up a certificate by its handle in the database. See
Gio.TlsDatabase.lookup_certificate_for_handle() for more information.New in version 2.30.
- handle (
-
do_lookup_certificate_for_handle_finish(result) virtual¶ Parameters: result ( Gio.AsyncResult) – aGio.AsyncResult.Returns: a newly allocated Gio.TlsCertificateobject. UseGObject.Object.unref() to release the certificate.Return type: Gio.TlsCertificateFinish an asynchronous lookup of a certificate by its handle. See
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
Nonewill be returned.New in version 2.30.
-
do_lookup_certificate_issuer(certificate, interaction, flags, cancellable) virtual¶ Parameters: - certificate (
Gio.TlsCertificate) – aGio.TlsCertificate - interaction (
Gio.TlsInteractionorNone) – used to interact with the user if necessary - flags (
Gio.TlsDatabaseLookupFlags) – flags which affect the lookup operation - cancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone
Returns: a newly allocated issuer
Gio.TlsCertificate, orNone. UseGObject.Object.unref() to release the certificate.Return type: Look up the issuer of certificate in the database.
The
Gio.TlsCertificate:issuerproperty of certificate is not modified, and the two certificates are not hooked into a chain.This function can block, use
Gio.TlsDatabase.lookup_certificate_issuer_async() to perform the lookup operation asynchronously.New in version 2.30.
- certificate (
-
do_lookup_certificate_issuer_async(certificate, interaction, flags, cancellable, callback, *user_data) virtual¶ Parameters: - certificate (
Gio.TlsCertificate) – aGio.TlsCertificate - interaction (
Gio.TlsInteractionorNone) – used to interact with the user if necessary - flags (
Gio.TlsDatabaseLookupFlags) – flags which affect the lookup operation - cancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone - callback (
Gio.AsyncReadyCallbackorNone) – callback to call when the operation completes - user_data (
objectorNone) – the data to pass to the callback function
Asynchronously look up the issuer of certificate in the database. See
Gio.TlsDatabase.lookup_certificate_issuer() for more information.New in version 2.30.
- certificate (
-
do_lookup_certificate_issuer_finish(result) virtual¶ Parameters: result ( Gio.AsyncResult) – aGio.AsyncResult.Returns: a newly allocated issuer Gio.TlsCertificate, orNone. UseGObject.Object.unref() to release the certificate.Return type: Gio.TlsCertificateFinish an asynchronous lookup issuer operation. See
Gio.TlsDatabase.lookup_certificate_issuer() for more information.New in version 2.30.
-
do_lookup_certificates_issued_by(issuer_raw_dn, interaction, flags, cancellable) virtual¶ Parameters: - issuer_raw_dn (
bytes) – aGLib.ByteArraywhich holds the DER encoded issuer DN. - interaction (
Gio.TlsInteractionorNone) – used to interact with the user if necessary - flags (
Gio.TlsDatabaseLookupFlags) – Flags which affect the lookup operation. - cancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone
Returns: a newly allocated list of
Gio.TlsCertificateobjects. UseGObject.Object.unref() on each certificate, and g_list_free() on the release the list.Return type: Look up certificates issued by this issuer in the database.
This function can block, use
Gio.TlsDatabase.lookup_certificates_issued_by_async() to perform the lookup operation asynchronously.New in version 2.30.
- issuer_raw_dn (
-
do_lookup_certificates_issued_by_async(issuer_raw_dn, interaction, flags, cancellable, callback, *user_data) virtual¶ Parameters: - issuer_raw_dn (
bytes) – aGLib.ByteArraywhich holds the DER encoded issuer DN. - interaction (
Gio.TlsInteractionorNone) – used to interact with the user if necessary - flags (
Gio.TlsDatabaseLookupFlags) – Flags which affect the lookup operation. - cancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone - callback (
Gio.AsyncReadyCallbackorNone) – callback to call when the operation completes - user_data (
objectorNone) – the data to pass to the callback function
Asynchronously look up certificates issued by this issuer in the database. See
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 of this asynchronous operation. The byte array should not be modified during this time.
New in version 2.30.
- issuer_raw_dn (
-
do_lookup_certificates_issued_by_finish(result) virtual¶ Parameters: result ( Gio.AsyncResult) – aGio.AsyncResult.Returns: a newly allocated list of Gio.TlsCertificateobjects. UseGObject.Object.unref() on each certificate, and g_list_free() on the release the list.Return type: [ Gio.TlsCertificate]Finish an asynchronous lookup of certificates. See
Gio.TlsDatabase.lookup_certificates_issued_by() for more information.New in version 2.30.
-
do_verify_chain(chain, purpose, identity, interaction, flags, cancellable) virtual¶ Parameters: - chain (
Gio.TlsCertificate) – aGio.TlsCertificatechain - purpose (
str) – the purpose that this certificate chain will be used for. - identity (
Gio.SocketConnectableorNone) – the expected peer identity - interaction (
Gio.TlsInteractionorNone) – used to interact with the user if necessary - flags (
Gio.TlsDatabaseVerifyFlags) – additional verify flags - cancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone
Returns: the appropriate
Gio.TlsCertificateFlagswhich represents the result of verification.Return type: Determines the validity of a certificate chain after looking up and adding any missing certificates to the chain.
chain is a chain of
Gio.TlsCertificateobjects each pointing to the next certificate in the chain by itsGio.TlsCertificate:issuerproperty. The chain may initially consist of one or more certificates. After the verification process is complete, chain may be modified by adding missing certificates, or removing extra certificates. If a certificate anchor was found, then it is added to the chain.purpose describes the purpose (or usage) for which the certificate is being used. Typically purpose will be set to
Gio.TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVERwhich 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,
Gio.TlsCertificateFlags.BAD_IDENTITYwill be set in the return value. If identity isNone, 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
Gio.TlsDatabaseVerifyFlags.NONEshould 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 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
Gio.TlsCertificateFlags.GENERIC_ERRORand error will be set accordingly. error is not set when chain is successfully analyzed but found to be invalid.This function can block, use
Gio.TlsDatabase.verify_chain_async() to perform the verification operation asynchronously.New in version 2.30.
- chain (
-
do_verify_chain_async(chain, purpose, identity, interaction, flags, cancellable, callback, *user_data) virtual¶ Parameters: - chain (
Gio.TlsCertificate) – aGio.TlsCertificatechain - purpose (
str) – the purpose that this certificate chain will be used for. - identity (
Gio.SocketConnectableorNone) – the expected peer identity - interaction (
Gio.TlsInteractionorNone) – used to interact with the user if necessary - flags (
Gio.TlsDatabaseVerifyFlags) – additional verify flags - cancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone - callback (
Gio.AsyncReadyCallbackorNone) – callback to call when the operation completes - user_data (
objectorNone) – the data to pass to the callback function
Asynchronously determines the validity of a certificate chain after looking up and adding any missing certificates to the chain. See
Gio.TlsDatabase.verify_chain() for more information.New in version 2.30.
- chain (
-
do_verify_chain_finish(result) virtual¶ Parameters: result ( Gio.AsyncResult) – aGio.AsyncResult.Returns: the appropriate Gio.TlsCertificateFlagswhich represents the result of verification.Return type: Gio.TlsCertificateFlagsFinish an asynchronous verify chain operation. See
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
Gio.TlsCertificateFlags.GENERIC_ERRORand error will be set accordingly. error is not set when chain is successfully analyzed but found to be invalid.New in version 2.30.
-