[][src]Trait gio::TlsDatabaseExt

pub trait TlsDatabaseExt: 'static {
    fn create_certificate_handle<P: IsA<TlsCertificate>>(
        &self,
        certificate: &P
    ) -> Option<GString>;
fn lookup_certificate_for_handle<P: IsA<TlsInteraction>, Q: IsA<Cancellable>>(
        &self,
        handle: &str,
        interaction: Option<&P>,
        flags: TlsDatabaseLookupFlags,
        cancellable: Option<&Q>
    ) -> Result<Option<TlsCertificate>, Error>;
fn lookup_certificate_for_handle_async<P: IsA<TlsInteraction>, Q: IsA<Cancellable>, R: FnOnce(Result<TlsCertificate, Error>) + Send + 'static>(
        &self,
        handle: &str,
        interaction: Option<&P>,
        flags: TlsDatabaseLookupFlags,
        cancellable: Option<&Q>,
        callback: R
    );
fn lookup_certificate_for_handle_async_future<P: IsA<TlsInteraction> + Clone + 'static>(
        &self,
        handle: &str,
        interaction: Option<&P>,
        flags: TlsDatabaseLookupFlags
    ) -> Pin<Box_<dyn Future<Output = Result<TlsCertificate, Error>> + 'static>>;
fn lookup_certificate_issuer<P: IsA<TlsCertificate>, Q: IsA<TlsInteraction>, R: IsA<Cancellable>>(
        &self,
        certificate: &P,
        interaction: Option<&Q>,
        flags: TlsDatabaseLookupFlags,
        cancellable: Option<&R>
    ) -> Result<TlsCertificate, Error>;
fn lookup_certificate_issuer_async<P: IsA<TlsCertificate>, Q: IsA<TlsInteraction>, R: IsA<Cancellable>, S: FnOnce(Result<TlsCertificate, Error>) + Send + 'static>(
        &self,
        certificate: &P,
        interaction: Option<&Q>,
        flags: TlsDatabaseLookupFlags,
        cancellable: Option<&R>,
        callback: S
    );
fn lookup_certificate_issuer_async_future<P: IsA<TlsCertificate> + Clone + 'static, Q: IsA<TlsInteraction> + Clone + 'static>(
        &self,
        certificate: &P,
        interaction: Option<&Q>,
        flags: TlsDatabaseLookupFlags
    ) -> Pin<Box_<dyn Future<Output = Result<TlsCertificate, Error>> + 'static>>;
fn verify_chain<P: IsA<TlsCertificate>, Q: IsA<SocketConnectable>, R: IsA<TlsInteraction>, S: IsA<Cancellable>>(
        &self,
        chain: &P,
        purpose: &str,
        identity: Option<&Q>,
        interaction: Option<&R>,
        flags: TlsDatabaseVerifyFlags,
        cancellable: Option<&S>
    ) -> Result<TlsCertificateFlags, Error>;
fn verify_chain_async<P: IsA<TlsCertificate>, Q: IsA<SocketConnectable>, R: IsA<TlsInteraction>, S: IsA<Cancellable>, T: FnOnce(Result<TlsCertificateFlags, Error>) + Send + 'static>(
        &self,
        chain: &P,
        purpose: &str,
        identity: Option<&Q>,
        interaction: Option<&R>,
        flags: TlsDatabaseVerifyFlags,
        cancellable: Option<&S>,
        callback: T
    );
fn verify_chain_async_future<P: IsA<TlsCertificate> + Clone + 'static, Q: IsA<SocketConnectable> + Clone + 'static, R: IsA<TlsInteraction> + Clone + 'static>(
        &self,
        chain: &P,
        purpose: &str,
        identity: Option<&Q>,
        interaction: Option<&R>,
        flags: TlsDatabaseVerifyFlags
    ) -> Pin<Box_<dyn Future<Output = Result<TlsCertificateFlags, Error>> + 'static>>; }

Trait containing all TlsDatabase methods.

Implementors

TlsDatabase, TlsFileDatabase

Required methods

fn create_certificate_handle<P: IsA<TlsCertificate>>(
    &self,
    certificate: &P
) -> Option<GString>

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

certificate

certificate for which to create a handle.

Returns

a newly allocated string containing the handle.

fn lookup_certificate_for_handle<P: IsA<TlsInteraction>, Q: IsA<Cancellable>>(
    &self,
    handle: &str,
    interaction: Option<&P>,
    flags: TlsDatabaseLookupFlags,
    cancellable: Option<&Q>
) -> Result<Option<TlsCertificate>, Error>

Look up a certificate by its handle.

The handle should have been created by calling TlsDatabaseExt::create_certificate_handle on a 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 None will be returned.

This function can block, use TlsDatabaseExt::lookup_certificate_for_handle_async to perform the lookup operation asynchronously.

handle

a certificate handle

interaction

used to interact with the user if necessary

flags

Flags which affect the lookup.

cancellable

a Cancellable, or None

Returns

a newly allocated TlsCertificate, or None. Use gobject::ObjectExt::unref to release the certificate.

fn lookup_certificate_for_handle_async<P: IsA<TlsInteraction>, Q: IsA<Cancellable>, R: FnOnce(Result<TlsCertificate, Error>) + Send + 'static>(
    &self,
    handle: &str,
    interaction: Option<&P>,
    flags: TlsDatabaseLookupFlags,
    cancellable: Option<&Q>,
    callback: R
)

Asynchronously look up a certificate by its handle in the database. See TlsDatabaseExt::lookup_certificate_for_handle for more information.

handle

a certificate handle

interaction

used to interact with the user if necessary

flags

Flags which affect the lookup.

cancellable

a Cancellable, or None

callback

callback to call when the operation completes

user_data

the data to pass to the callback function

fn lookup_certificate_for_handle_async_future<P: IsA<TlsInteraction> + Clone + 'static>(
    &self,
    handle: &str,
    interaction: Option<&P>,
    flags: TlsDatabaseLookupFlags
) -> Pin<Box_<dyn Future<Output = Result<TlsCertificate, Error>> + 'static>>

fn lookup_certificate_issuer<P: IsA<TlsCertificate>, Q: IsA<TlsInteraction>, R: IsA<Cancellable>>(
    &self,
    certificate: &P,
    interaction: Option<&Q>,
    flags: TlsDatabaseLookupFlags,
    cancellable: Option<&R>
) -> Result<TlsCertificate, Error>

Look up the issuer of certificate in the database.

The TlsCertificate:issuer property of certificate is not modified, and the two certificates are not hooked into a chain.

This function can block, use TlsDatabaseExt::lookup_certificate_issuer_async to perform the lookup operation asynchronously.

certificate

a TlsCertificate

interaction

used to interact with the user if necessary

flags

flags which affect the lookup operation

cancellable

a Cancellable, or None

Returns

a newly allocated issuer TlsCertificate, or None. Use gobject::ObjectExt::unref to release the certificate.

fn lookup_certificate_issuer_async<P: IsA<TlsCertificate>, Q: IsA<TlsInteraction>, R: IsA<Cancellable>, S: FnOnce(Result<TlsCertificate, Error>) + Send + 'static>(
    &self,
    certificate: &P,
    interaction: Option<&Q>,
    flags: TlsDatabaseLookupFlags,
    cancellable: Option<&R>,
    callback: S
)

Asynchronously look up the issuer of certificate in the database. See TlsDatabaseExt::lookup_certificate_issuer for more information.

certificate

a TlsCertificate

interaction

used to interact with the user if necessary

flags

flags which affect the lookup operation

cancellable

a Cancellable, or None

callback

callback to call when the operation completes

user_data

the data to pass to the callback function

fn lookup_certificate_issuer_async_future<P: IsA<TlsCertificate> + Clone + 'static, Q: IsA<TlsInteraction> + Clone + 'static>(
    &self,
    certificate: &P,
    interaction: Option<&Q>,
    flags: TlsDatabaseLookupFlags
) -> Pin<Box_<dyn Future<Output = Result<TlsCertificate, Error>> + 'static>>

fn verify_chain<P: IsA<TlsCertificate>, Q: IsA<SocketConnectable>, R: IsA<TlsInteraction>, S: IsA<Cancellable>>(
    &self,
    chain: &P,
    purpose: &str,
    identity: Option<&Q>,
    interaction: Option<&R>,
    flags: TlsDatabaseVerifyFlags,
    cancellable: Option<&S>
) -> Result<TlsCertificateFlags, Error>

Determines the validity of a certificate chain after looking up and adding any missing certificates to the chain.

chain is a chain of TlsCertificate objects each pointing to the next certificate in the chain by its TlsCertificate:issuer property. 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 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 check for pinned certificates (trust exceptions) in the database. These will override the normal verification process on a host by host basis.

Currently there are no flags, and 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 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 TlsCertificateFlags::GenericError and error will be set accordingly. error is not set when chain is successfully analyzed but found to be invalid.

This function can block, use TlsDatabaseExt::verify_chain_async to perform the verification operation asynchronously.

chain

a TlsCertificate chain

purpose

the purpose that this certificate chain will be used for.

identity

the expected peer identity

interaction

used to interact with the user if necessary

flags

additional verify flags

cancellable

a Cancellable, or None

Returns

the appropriate TlsCertificateFlags which represents the result of verification.

fn verify_chain_async<P: IsA<TlsCertificate>, Q: IsA<SocketConnectable>, R: IsA<TlsInteraction>, S: IsA<Cancellable>, T: FnOnce(Result<TlsCertificateFlags, Error>) + Send + 'static>(
    &self,
    chain: &P,
    purpose: &str,
    identity: Option<&Q>,
    interaction: Option<&R>,
    flags: TlsDatabaseVerifyFlags,
    cancellable: Option<&S>,
    callback: T
)

Asynchronously determines the validity of a certificate chain after looking up and adding any missing certificates to the chain. See TlsDatabaseExt::verify_chain for more information.

chain

a TlsCertificate chain

purpose

the purpose that this certificate chain will be used for.

identity

the expected peer identity

interaction

used to interact with the user if necessary

flags

additional verify flags

cancellable

a Cancellable, or None

callback

callback to call when the operation completes

user_data

the data to pass to the callback function

fn verify_chain_async_future<P: IsA<TlsCertificate> + Clone + 'static, Q: IsA<SocketConnectable> + Clone + 'static, R: IsA<TlsInteraction> + Clone + 'static>(
    &self,
    chain: &P,
    purpose: &str,
    identity: Option<&Q>,
    interaction: Option<&R>,
    flags: TlsDatabaseVerifyFlags
) -> Pin<Box_<dyn Future<Output = Result<TlsCertificateFlags, Error>> + 'static>>

Loading content...

Implementors

impl<O: IsA<TlsDatabase>> TlsDatabaseExt for O[src]

Loading content...