1.96 <GTlsDatabase>

Class: <GTlsDatabase>

It derives from <GObject>.

<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 <GTlsConnection>.

Fields

parent-instance
priv

Procedures

Method: tls-database:create-certificate-handle self certificate ⇒ %return
Method: create-certificate-handle self certificate ⇒ %return

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, #f 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.

self

Passed: a <GTlsDatabase>.

a <GTlsDatabase>

certificate

Passed: a <GTlsCertificate>.

certificate for which to create a handle.

%return

Returned: a string, or #f.

a newly allocated string containing the handle.

Method: tls-database:lookup-certificate-for-handle self handle interaction flags [cancellable] ⇒ %return
Method: lookup-certificate-for-handle self handle interaction flags [cancellable] ⇒ %return

Look up a certificate by its handle.

The handle should have been created by calling tls-database:create-certificate-handle on a <GTlsDatabase> 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 #f will be returned.

This function can block, use tls-database:lookup-certificate-for-handle-async to perform the lookup operation asynchronously.

self

Passed: a <GTlsDatabase>.

a <GTlsDatabase>

handle

Passed: a string.

a certificate handle

interaction

Passed: a <GTlsInteraction>, or #f.

used to interact with the user if necessary

flags

Passed: a <GTlsDatabaseLookupFlags>, or a list of its symbols, or one of them.

Flags which affect the lookup.

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>, or #f

%return

Returned: a <GTlsCertificate>, or #f.

a newly allocated <GTlsCertificate>, or #f. Use object:unref to release the certificate.

Method: tls-database:lookup-certificate-for-handle-async self handle interaction flags [cancellable] [callback]
Method: lookup-certificate-for-handle-async self handle interaction flags [cancellable] [callback]

Asynchronously look up a certificate by its handle in the database. See tls-database:lookup-certificate-for-handle for more information.

self

Passed: a <GTlsDatabase>.

a <GTlsDatabase>

handle

Passed: a string.

a certificate handle

interaction

Passed: a <GTlsInteraction>, or #f.

used to interact with the user if necessary

flags

Passed: a <GTlsDatabaseLookupFlags>, or a list of its symbols, or one of them.

Flags which affect the lookup.

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>, or #f

callback

Passed, or left out: a procedure, or #f.

callback to call when the operation completes

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to the callback function

Method: tls-database:lookup-certificate-for-handle-finish self result ⇒ %return
Method: lookup-certificate-for-handle-finish self result ⇒ %return

Finish an asynchronous lookup of a certificate by its handle. See tls-database: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 #f will be returned.

self

Passed: a <GTlsDatabase>.

a <GTlsDatabase>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>.

%return

Returned: a <GTlsCertificate>.

a newly allocated <GTlsCertificate> object. Use object:unref to release the certificate.

Method: tls-database:lookup-certificate-issuer self certificate interaction flags [cancellable] ⇒ %return
Method: lookup-certificate-issuer self certificate interaction flags [cancellable] ⇒ %return

Look up the issuer of certificate in the database. The tls-certificate:issuer property of certificate is not modified, and the two certificates are not hooked into a chain.

This function can block. Use tls-database: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.

self

Passed: a <GTlsDatabase>.

a <GTlsDatabase>

certificate

Passed: a <GTlsCertificate>.

a <GTlsCertificate>

interaction

Passed: a <GTlsInteraction>, or #f.

used to interact with the user if necessary

flags

Passed: a <GTlsDatabaseLookupFlags>, or a list of its symbols, or one of them.

flags which affect the lookup operation

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>, or #f

%return

Returned: a <GTlsCertificate>.

a newly allocated issuer <GTlsCertificate>, or #f. Use object:unref to release the certificate.

Method: tls-database:lookup-certificate-issuer-async self certificate interaction flags [cancellable] [callback]
Method: lookup-certificate-issuer-async self certificate interaction flags [cancellable] [callback]

Asynchronously look up the issuer of certificate in the database. See tls-database:lookup-certificate-issuer for more information.

self

Passed: a <GTlsDatabase>.

a <GTlsDatabase>

certificate

Passed: a <GTlsCertificate>.

a <GTlsCertificate>

interaction

Passed: a <GTlsInteraction>, or #f.

used to interact with the user if necessary

flags

Passed: a <GTlsDatabaseLookupFlags>, or a list of its symbols, or one of them.

flags which affect the lookup operation

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>, or #f

callback

Passed, or left out: a procedure, or #f.

callback to call when the operation completes

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to the callback function

Method: tls-database:lookup-certificate-issuer-finish self result ⇒ %return
Method: lookup-certificate-issuer-finish self result ⇒ %return

Finish an asynchronous lookup issuer operation. See tls-database:lookup-certificate-issuer for more information.

self

Passed: a <GTlsDatabase>.

a <GTlsDatabase>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>.

%return

Returned: a <GTlsCertificate>.

a newly allocated issuer <GTlsCertificate>, or #f. Use object:unref to release the certificate.

Method: tls-database:lookup-certificates-issued-by self issuer-raw-dn interaction flags [cancellable] ⇒ %return
Method: lookup-certificates-issued-by self issuer-raw-dn interaction flags [cancellable] ⇒ %return

Look up certificates issued by this issuer in the database.

This function can block, use tls-database:lookup-certificates-issued-by-async to perform the lookup operation asynchronously.

self

Passed: a <GTlsDatabase>.

a <GTlsDatabase>

issuer-raw-dn

Passed: a bytevector.

a <GByteArray> which holds the DER encoded issuer DN.

interaction

Passed: a <GTlsInteraction>, or #f.

used to interact with the user if necessary

flags

Passed: a <GTlsDatabaseLookupFlags>, or a list of its symbols, or one of them.

Flags which affect the lookup operation.

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>, or #f

%return

Returned: a list, each a <GTlsCertificate>.

a newly allocated list of <GTlsCertificate> objects. Use object:unref on each certificate, and g_list_free() on the release the list.

Method: tls-database:lookup-certificates-issued-by-async self issuer-raw-dn interaction flags [cancellable] [callback]
Method: lookup-certificates-issued-by-async self issuer-raw-dn interaction flags [cancellable] [callback]

Asynchronously look up certificates issued by this issuer in the database. See tls-database: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.

self

Passed: a <GTlsDatabase>.

a <GTlsDatabase>

issuer-raw-dn

Passed: a bytevector.

a <GByteArray> which holds the DER encoded issuer DN.

interaction

Passed: a <GTlsInteraction>, or #f.

used to interact with the user if necessary

flags

Passed: a <GTlsDatabaseLookupFlags>, or a list of its symbols, or one of them.

Flags which affect the lookup operation.

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>, or #f

callback

Passed, or left out: a procedure, or #f.

callback to call when the operation completes

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to the callback function

Method: tls-database:lookup-certificates-issued-by-finish self result ⇒ %return
Method: lookup-certificates-issued-by-finish self result ⇒ %return

Finish an asynchronous lookup of certificates. See tls-database:lookup-certificates-issued-by for more information.

self

Passed: a <GTlsDatabase>.

a <GTlsDatabase>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>.

%return

Returned: a list, each a <GTlsCertificate>.

a newly allocated list of <GTlsCertificate> objects. Use object:unref on each certificate, and g_list_free() on the release the list.

Method: tls-database:verify-chain self chain purpose identity interaction flags [cancellable] ⇒ %return
Method: verify-chain self chain purpose identity interaction flags [cancellable] ⇒ %return

Determines the validity of a certificate chain, outside the context of a TLS session.

chain is a chain of <GTlsCertificate> objects each pointing to the next certificate in the chain by its tls-certificate:issuer property.

purpose describes the purpose (or usage) for which the certificate is being used. Typically purpose will be set to G_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, bad-identity will be set in the return value. If identity is #f, 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 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 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 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 <GTlsDatabase> during certificate verification by adjusting the tls-certificate:issuer property of each certificate in chain. Since GLib 2.48, this no longer occurs, so you cannot rely on tls-certificate:issuer to represent the actual certification path used during certificate verification.

Because TLS session context is not used, <GTlsDatabase> may not perform as many checks on the certificates as <GTlsConnection> 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 <GTlsConnection> 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 tls-database:verify-chain-async to perform the verification operation asynchronously.

self

Passed: a <GTlsDatabase>.

a <GTlsDatabase>

chain

Passed: a <GTlsCertificate>.

a <GTlsCertificate> chain

purpose

Passed: a string.

the purpose that this certificate chain will be used for.

identity

Passed: a <GSocketConnectable>, or #f.

the expected peer identity

interaction

Passed: a <GTlsInteraction>, or #f.

used to interact with the user if necessary

flags

Passed: a <GTlsDatabaseVerifyFlags>, or a list of its symbols, or one of them.

additional verify flags

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>, or #f

%return

Returned: a <GTlsCertificateFlags>.

the appropriate <GTlsCertificateFlags> which represents the result of verification.

Method: tls-database:verify-chain-async self chain purpose identity interaction flags [cancellable] [callback]
Method: verify-chain-async self chain purpose identity interaction flags [cancellable] [callback]

Asynchronously determines the validity of a certificate chain after looking up and adding any missing certificates to the chain. See tls-database:verify-chain for more information.

self

Passed: a <GTlsDatabase>.

a <GTlsDatabase>

chain

Passed: a <GTlsCertificate>.

a <GTlsCertificate> chain

purpose

Passed: a string.

the purpose that this certificate chain will be used for.

identity

Passed: a <GSocketConnectable>, or #f.

the expected peer identity

interaction

Passed: a <GTlsInteraction>, or #f.

used to interact with the user if necessary

flags

Passed: a <GTlsDatabaseVerifyFlags>, or a list of its symbols, or one of them.

additional verify flags

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>, or #f

callback

Passed, or left out: a procedure, or #f.

callback to call when the operation completes

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to the callback function

Method: tls-database:verify-chain-finish self result ⇒ %return
Method: verify-chain-finish self result ⇒ %return

Finish an asynchronous verify chain operation. See tls-database: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 generic-error and error will be set accordingly. error is not set when chain is successfully analyzed but found to be invalid.

self

Passed: a <GTlsDatabase>.

a <GTlsDatabase>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>.

%return

Returned: a <GTlsCertificateFlags>.

the appropriate <GTlsCertificateFlags> which represents the result of verification.

Virtual methods

Virtual method: tls-database:do-create-certificate-handle implementor self certificate ⇒ %return

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, #f 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.

To override it in a new class, give register-type #:vfuncs `((create-certificate-handle . ,procedure)). The procedure is called as (procedure self certificate) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GTlsDatabase>, or a class that derives from it, or its GType number.

self

Passed: a <GTlsDatabase>.

a <GTlsDatabase>

certificate

Passed: a <GTlsCertificate>.

certificate for which to create a handle.

%return

Returned: a string, or #f.

a newly allocated string containing the handle.

Virtual method: tls-database:do-lookup-certificate-for-handle implementor self handle interaction flags [cancellable] ⇒ %return

Look up a certificate by its handle.

The handle should have been created by calling tls-database:create-certificate-handle on a <GTlsDatabase> 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 #f will be returned.

This function can block, use tls-database:lookup-certificate-for-handle-async to perform the lookup operation asynchronously.

To override it in a new class, give register-type #:vfuncs `((lookup-certificate-for-handle . ,procedure)). The procedure is called as (procedure self handle interaction flags cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GTlsDatabase>, or a class that derives from it, or its GType number.

self

Passed: a <GTlsDatabase>.

a <GTlsDatabase>

handle

Passed: a string.

a certificate handle

interaction

Passed: a <GTlsInteraction>, or #f.

used to interact with the user if necessary

flags

Passed: a <GTlsDatabaseLookupFlags>, or a list of its symbols, or one of them.

Flags which affect the lookup.

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>, or #f

%return

Returned: a <GTlsCertificate>, or #f.

a newly allocated <GTlsCertificate>, or #f. Use object:unref to release the certificate.

Virtual method: tls-database:do-lookup-certificate-for-handle-async implementor self handle interaction flags [cancellable] [callback]

Asynchronously look up a certificate by its handle in the database. See tls-database:lookup-certificate-for-handle for more information.

To override it in a new class, give register-type #:vfuncs `((lookup-certificate-for-handle-async . ,procedure)). The procedure is called as (procedure self handle interaction flags cancellable callback user-data).

implementor

Passed: the class whose implementation to call: <GTlsDatabase>, or a class that derives from it, or its GType number.

self

Passed: a <GTlsDatabase>.

a <GTlsDatabase>

handle

Passed: a string.

a certificate handle

interaction

Passed: a <GTlsInteraction>, or #f.

used to interact with the user if necessary

flags

Passed: a <GTlsDatabaseLookupFlags>, or a list of its symbols, or one of them.

Flags which affect the lookup.

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>, or #f

callback

Passed, or left out: a procedure, or #f.

callback to call when the operation completes

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to the callback function

Virtual method: tls-database:do-lookup-certificate-for-handle-finish implementor self result ⇒ %return

Finish an asynchronous lookup of a certificate by its handle. See tls-database: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 #f will be returned.

To override it in a new class, give register-type #:vfuncs `((lookup-certificate-for-handle-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GTlsDatabase>, or a class that derives from it, or its GType number.

self

Passed: a <GTlsDatabase>.

a <GTlsDatabase>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>.

%return

Returned: a <GTlsCertificate>.

a newly allocated <GTlsCertificate> object. Use object:unref to release the certificate.

Virtual method: tls-database:do-lookup-certificate-issuer implementor self certificate interaction flags [cancellable] ⇒ %return

Look up the issuer of certificate in the database. The tls-certificate:issuer property of certificate is not modified, and the two certificates are not hooked into a chain.

This function can block. Use tls-database: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.

To override it in a new class, give register-type #:vfuncs `((lookup-certificate-issuer . ,procedure)). The procedure is called as (procedure self certificate interaction flags cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GTlsDatabase>, or a class that derives from it, or its GType number.

self

Passed: a <GTlsDatabase>.

a <GTlsDatabase>

certificate

Passed: a <GTlsCertificate>.

a <GTlsCertificate>

interaction

Passed: a <GTlsInteraction>, or #f.

used to interact with the user if necessary

flags

Passed: a <GTlsDatabaseLookupFlags>, or a list of its symbols, or one of them.

flags which affect the lookup operation

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>, or #f

%return

Returned: a <GTlsCertificate>.

a newly allocated issuer <GTlsCertificate>, or #f. Use object:unref to release the certificate.

Virtual method: tls-database:do-lookup-certificate-issuer-async implementor self certificate interaction flags [cancellable] [callback]

Asynchronously look up the issuer of certificate in the database. See tls-database:lookup-certificate-issuer for more information.

To override it in a new class, give register-type #:vfuncs `((lookup-certificate-issuer-async . ,procedure)). The procedure is called as (procedure self certificate interaction flags cancellable callback user-data).

implementor

Passed: the class whose implementation to call: <GTlsDatabase>, or a class that derives from it, or its GType number.

self

Passed: a <GTlsDatabase>.

a <GTlsDatabase>

certificate

Passed: a <GTlsCertificate>.

a <GTlsCertificate>

interaction

Passed: a <GTlsInteraction>, or #f.

used to interact with the user if necessary

flags

Passed: a <GTlsDatabaseLookupFlags>, or a list of its symbols, or one of them.

flags which affect the lookup operation

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>, or #f

callback

Passed, or left out: a procedure, or #f.

callback to call when the operation completes

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to the callback function

Virtual method: tls-database:do-lookup-certificate-issuer-finish implementor self result ⇒ %return

Finish an asynchronous lookup issuer operation. See tls-database:lookup-certificate-issuer for more information.

To override it in a new class, give register-type #:vfuncs `((lookup-certificate-issuer-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GTlsDatabase>, or a class that derives from it, or its GType number.

self

Passed: a <GTlsDatabase>.

a <GTlsDatabase>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>.

%return

Returned: a <GTlsCertificate>.

a newly allocated issuer <GTlsCertificate>, or #f. Use object:unref to release the certificate.

Virtual method: tls-database:do-lookup-certificates-issued-by implementor self issuer-raw-dn interaction flags [cancellable] ⇒ %return

Look up certificates issued by this issuer in the database.

This function can block, use tls-database:lookup-certificates-issued-by-async to perform the lookup operation asynchronously.

To override it in a new class, give register-type #:vfuncs `((lookup-certificates-issued-by . ,procedure)). The procedure is called as (procedure self issuer-raw-dn interaction flags cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GTlsDatabase>, or a class that derives from it, or its GType number.

self

Passed: a <GTlsDatabase>.

a <GTlsDatabase>

issuer-raw-dn

Passed: a bytevector.

a <GByteArray> which holds the DER encoded issuer DN.

interaction

Passed: a <GTlsInteraction>, or #f.

used to interact with the user if necessary

flags

Passed: a <GTlsDatabaseLookupFlags>, or a list of its symbols, or one of them.

Flags which affect the lookup operation.

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>, or #f

%return

Returned: a list, each a <GTlsCertificate>.

a newly allocated list of <GTlsCertificate> objects. Use object:unref on each certificate, and g_list_free() on the release the list.

Virtual method: tls-database:do-lookup-certificates-issued-by-async implementor self issuer-raw-dn interaction flags [cancellable] [callback]

Asynchronously look up certificates issued by this issuer in the database. See tls-database: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.

To override it in a new class, give register-type #:vfuncs `((lookup-certificates-issued-by-async . ,procedure)). The procedure is called as (procedure self issuer-raw-dn interaction flags cancellable callback user-data).

implementor

Passed: the class whose implementation to call: <GTlsDatabase>, or a class that derives from it, or its GType number.

self

Passed: a <GTlsDatabase>.

a <GTlsDatabase>

issuer-raw-dn

Passed: a bytevector.

a <GByteArray> which holds the DER encoded issuer DN.

interaction

Passed: a <GTlsInteraction>, or #f.

used to interact with the user if necessary

flags

Passed: a <GTlsDatabaseLookupFlags>, or a list of its symbols, or one of them.

Flags which affect the lookup operation.

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>, or #f

callback

Passed, or left out: a procedure, or #f.

callback to call when the operation completes

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to the callback function

Virtual method: tls-database:do-lookup-certificates-issued-by-finish implementor self result ⇒ %return

Finish an asynchronous lookup of certificates. See tls-database:lookup-certificates-issued-by for more information.

To override it in a new class, give register-type #:vfuncs `((lookup-certificates-issued-by-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GTlsDatabase>, or a class that derives from it, or its GType number.

self

Passed: a <GTlsDatabase>.

a <GTlsDatabase>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>.

%return

Returned: a list, each a <GTlsCertificate>.

a newly allocated list of <GTlsCertificate> objects. Use object:unref on each certificate, and g_list_free() on the release the list.

Virtual method: tls-database:do-verify-chain implementor self chain purpose identity interaction flags [cancellable] ⇒ %return

Determines the validity of a certificate chain, outside the context of a TLS session.

chain is a chain of <GTlsCertificate> objects each pointing to the next certificate in the chain by its tls-certificate:issuer property.

purpose describes the purpose (or usage) for which the certificate is being used. Typically purpose will be set to G_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, bad-identity will be set in the return value. If identity is #f, 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 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 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 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 <GTlsDatabase> during certificate verification by adjusting the tls-certificate:issuer property of each certificate in chain. Since GLib 2.48, this no longer occurs, so you cannot rely on tls-certificate:issuer to represent the actual certification path used during certificate verification.

Because TLS session context is not used, <GTlsDatabase> may not perform as many checks on the certificates as <GTlsConnection> 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 <GTlsConnection> 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 tls-database:verify-chain-async to perform the verification operation asynchronously.

To override it in a new class, give register-type #:vfuncs `((verify-chain . ,procedure)). The procedure is called as (procedure self chain purpose identity interaction flags cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GTlsDatabase>, or a class that derives from it, or its GType number.

self

Passed: a <GTlsDatabase>.

a <GTlsDatabase>

chain

Passed: a <GTlsCertificate>.

a <GTlsCertificate> chain

purpose

Passed: a string.

the purpose that this certificate chain will be used for.

identity

Passed: a <GSocketConnectable>, or #f.

the expected peer identity

interaction

Passed: a <GTlsInteraction>, or #f.

used to interact with the user if necessary

flags

Passed: a <GTlsDatabaseVerifyFlags>, or a list of its symbols, or one of them.

additional verify flags

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>, or #f

%return

Returned: a <GTlsCertificateFlags>.

the appropriate <GTlsCertificateFlags> which represents the result of verification.

Virtual method: tls-database:do-verify-chain-async implementor self chain purpose identity interaction flags [cancellable] [callback]

Asynchronously determines the validity of a certificate chain after looking up and adding any missing certificates to the chain. See tls-database:verify-chain for more information.

To override it in a new class, give register-type #:vfuncs `((verify-chain-async . ,procedure)). The procedure is called as (procedure self chain purpose identity interaction flags cancellable callback user-data).

implementor

Passed: the class whose implementation to call: <GTlsDatabase>, or a class that derives from it, or its GType number.

self

Passed: a <GTlsDatabase>.

a <GTlsDatabase>

chain

Passed: a <GTlsCertificate>.

a <GTlsCertificate> chain

purpose

Passed: a string.

the purpose that this certificate chain will be used for.

identity

Passed: a <GSocketConnectable>, or #f.

the expected peer identity

interaction

Passed: a <GTlsInteraction>, or #f.

used to interact with the user if necessary

flags

Passed: a <GTlsDatabaseVerifyFlags>, or a list of its symbols, or one of them.

additional verify flags

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>, or #f

callback

Passed, or left out: a procedure, or #f.

callback to call when the operation completes

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to the callback function

Virtual method: tls-database:do-verify-chain-finish implementor self result ⇒ %return

Finish an asynchronous verify chain operation. See tls-database: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 generic-error and error will be set accordingly. error is not set when chain is successfully analyzed but found to be invalid.

To override it in a new class, give register-type #:vfuncs `((verify-chain-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GTlsDatabase>, or a class that derives from it, or its GType number.

self

Passed: a <GTlsDatabase>.

a <GTlsDatabase>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>.

%return

Returned: a <GTlsCertificateFlags>.

the appropriate <GTlsCertificateFlags> which represents the result of verification.