[]Struct gio::TlsCertificate

pub struct TlsCertificate(_, _);

A certificate used for TLS authentication and encryption. This can represent either a certificate only (eg, the certificate received by a client from a server), or the combination of a certificate and a private key (which is needed when acting as a TlsServerConnection).

Implements

TlsCertificateExt, glib::object::ObjectExt

Methods

impl TlsCertificate[src]

pub fn new_from_file<P: AsRef<Path>>(file: P) -> Result<TlsCertificate, Error>[src]

Creates a TlsCertificate from the PEM-encoded data in file. The returned certificate will be the first certificate found in file. As of GLib 2.44, if file contains more certificates it will try to load a certificate chain. All certificates will be verified in the order found (top-level certificate should be the last one in the file) and the TlsCertificate:issuer property of each certificate will be set accordingly if the verification succeeds. If any certificate in the chain cannot be verified, the first certificate in the file will still be returned.

If file cannot be read or parsed, the function will return None and set error. Otherwise, this behaves like TlsCertificate::new_from_pem.

file

file containing a PEM-encoded certificate to import

Returns

the new certificate, or None on error

pub fn new_from_files<P: AsRef<Path>, Q: AsRef<Path>>(
    cert_file: P,
    key_file: Q
) -> Result<TlsCertificate, Error>
[src]

Creates a TlsCertificate from the PEM-encoded data in cert_file and key_file. The returned certificate will be the first certificate found in cert_file. As of GLib 2.44, if cert_file contains more certificates it will try to load a certificate chain. All certificates will be verified in the order found (top-level certificate should be the last one in the file) and the TlsCertificate:issuer property of each certificate will be set accordingly if the verification succeeds. If any certificate in the chain cannot be verified, the first certificate in the file will still be returned.

If either file cannot be read or parsed, the function will return None and set error. Otherwise, this behaves like TlsCertificate::new_from_pem.

cert_file

file containing one or more PEM-encoded certificates to import

key_file

file containing a PEM-encoded private key to import

Returns

the new certificate, or None on error

pub fn new_from_pem(data: &str) -> Result<TlsCertificate, Error>[src]

Creates a TlsCertificate from the PEM-encoded data in data. If data includes both a certificate and a private key, then the returned certificate will include the private key data as well. (See the TlsCertificate:private-key-pem property for information about supported formats.)

The returned certificate will be the first certificate found in data. As of GLib 2.44, if data contains more certificates it will try to load a certificate chain. All certificates will be verified in the order found (top-level certificate should be the last one in the file) and the TlsCertificate:issuer property of each certificate will be set accordingly if the verification succeeds. If any certificate in the chain cannot be verified, the first certificate in the file will still be returned.

data

PEM-encoded certificate data

length

the length of data, or -1 if it's 0-terminated.

Returns

the new certificate, or None if data is invalid

pub fn list_new_from_file<P: AsRef<Path>>(
    file: P
) -> Result<Vec<TlsCertificate>, Error>
[src]

Creates one or more GTlsCertificates from the PEM-encoded data in file. If file cannot be read or parsed, the function will return None and set error. If file does not contain any PEM-encoded certificates, this will return an empty list and not set error.

file

file containing PEM-encoded certificates to import

Returns

a glib::List containing TlsCertificate objects. You must free the list and its contents when you are done with it.

Trait Implementations

impl Clone for TlsCertificate

impl Debug for TlsCertificate

impl Display for TlsCertificate[src]

impl Eq for TlsCertificate

impl Hash for TlsCertificate

impl Ord for TlsCertificate

impl<T: ObjectType> PartialEq<T> for TlsCertificate

impl<T: ObjectType> PartialOrd<T> for TlsCertificate

impl StaticType for TlsCertificate

Auto Trait Implementations

impl RefUnwindSafe for TlsCertificate

impl !Send for TlsCertificate

impl !Sync for TlsCertificate

impl Unpin for TlsCertificate

impl UnwindSafe for TlsCertificate

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 
[src]

impl<T> Cast for T where
    T: ObjectType
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ObjectExt for T where
    T: ObjectType
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.