Trait gio::prelude::TlsCertificateExt [−][src]
pub trait TlsCertificateExt: 'static { fn issuer(&self) -> Option<TlsCertificate>; fn is_same<P: IsA<TlsCertificate>>(&self, cert_two: &P) -> bool; fn verify<P: IsA<SocketConnectable>, Q: IsA<TlsCertificate>>(
&self,
identity: Option<&P>,
trusted_ca: Option<&Q>
) -> TlsCertificateFlags; fn certificate(&self) -> Option<ByteArray>; fn certificate_pem(&self) -> Option<GString>; }
Expand description
Required methods
fn issuer(&self) -> Option<TlsCertificate>
fn issuer(&self) -> Option<TlsCertificate>
Gets the TlsCertificate
representing self
’s issuer, if known
Returns
The certificate of self
’s issuer,
or None
if self
is self-signed or signed with an unknown
certificate.
Check if two TlsCertificate
objects represent the same certificate.
The raw DER byte data of the two certificates are checked for equality.
This has the effect that two certificates may compare equal even if
their property::TlsCertificate::issuer
, property::TlsCertificate::private-key
, or
property::TlsCertificate::private-key-pem
properties differ.
cert_two
second certificate to compare
Returns
whether the same or not
fn verify<P: IsA<SocketConnectable>, Q: IsA<TlsCertificate>>(
&self,
identity: Option<&P>,
trusted_ca: Option<&Q>
) -> TlsCertificateFlags
fn verify<P: IsA<SocketConnectable>, Q: IsA<TlsCertificate>>(
&self,
identity: Option<&P>,
trusted_ca: Option<&Q>
) -> TlsCertificateFlags
This verifies self
and returns a set of TlsCertificateFlags
indicating any problems found with it. This can be used to verify a
certificate outside the context of making a connection, or to
check a certificate against a CA that is not part of the system
CA database.
If identity
is not None
, self
’s name(s) will be compared against
it, and TlsCertificateFlags::BAD_IDENTITY
will be set in the return
value if it does not match. If identity
is None
, that bit will
never be set in the return value.
If trusted_ca
is not None
, then self
(or one of the certificates
in its chain) must be signed by it, or else
TlsCertificateFlags::UNKNOWN_CA
will be set in the return value. If
trusted_ca
is None
, that bit will never be set in the return
value.
(All other TlsCertificateFlags
values will always be set or unset
as appropriate.)
identity
the expected peer identity
trusted_ca
the certificate of a trusted authority
Returns
the appropriate TlsCertificateFlags
fn certificate(&self) -> Option<ByteArray>
fn certificate(&self) -> Option<ByteArray>
The DER (binary) encoded representation of the certificate.
This property and the property::TlsCertificate::certificate-pem
property
represent the same data, just in different forms.
fn certificate_pem(&self) -> Option<GString>
fn certificate_pem(&self) -> Option<GString>
The PEM (ASCII) encoded representation of the certificate.
This property and the property::TlsCertificate::certificate
property represent the same data, just in different forms.