TlsCertificate
Object Hierarchy:
Description:
[ CCode ( type_id = "g_tls_certificate_get_type ()" ) ]
[ Version ( since = "2.28" ) ]
public class TlsCertificate : Object
[ Version ( since = "2.28" ) ]
public class TlsCertificate : Object
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 [iface@Gio.TlsServerConnection]).
Namespace: GLib
Package: gio-2.0
Content:
Properties:
- public ByteArray certificate { owned get; construct; }
The DER (binary) encoded representation of the certificate.
- public string certificate_pem { owned get; construct; }
The PEM (ASCII) encoded representation of the certificate.
- public GenericArray<void*> dns_names { owned get; }
The DNS names from the certificate's Subject Alternative Names (SANs), null if unavailable.
- public GenericArray<void*> ip_addresses { owned get; }
The IP addresses from the certificate's Subject Alternative Names (SANs), null if unavailable.
- public TlsCertificate issuer { get; construct; }
A TlsCertificate representing the entity that issued this certificate.
- public string issuer_name { owned get; }
The issuer from the certificate, null if unavailable.
- public DateTime not_valid_after { owned get; }
The time at which this cert is no longer valid, null if unavailable.
- public DateTime not_valid_before { owned get; }
The time at which this cert is considered to be valid, null if unavailable.
- public string password { construct; }
An optional password used when constructed with GTlsCertificate:pkcs12-data.
- public string pkcs11_uri { owned get; construct; }
A URI referencing the PKCS #11 objects containing an X.509 certificate and optionally a private key.
- public ByteArray pkcs12_data { construct; }
The PKCS #12 formatted data used to construct the object.
- public ByteArray private_key { owned get; construct; }
The DER (binary) encoded representation of the certificate's private key, in either PKCS #1 format or unencrypted PKCS #8 format. PKCS #8 format is supported since 2.32; earlier releases only support PKCS #1.
- public string private_key_pem { owned get; construct; }
The PEM (ASCII) encoded representation of the certificate's private key in either PKCS #1 format ("`BEGIN RSA PRIVATE KEY`") or unencrypted PKCS #8 format ("`BEGIN PRIVATE KEY`").
- public string private_key_pkcs11_uri { owned get; construct; }
A URI referencing a PKCS #11 object containing a private key.
- public string subject_name { owned get; }
The subject from the cert, null if unavailable.
Static methods:
- public static List<TlsCertificate> list_new_from_file (string file) throws Error
Creates one or more TlsCertificates from the PEM-encoded data in
file
.
Creation methods:
- protected TlsCertificate ()
- public TlsCertificate.from_file (string file) throws Error
Creates a TlsCertificate from the data in
file
. - public TlsCertificate.from_file_with_password (string file, string password) throws Error
Creates a TlsCertificate from the data in
file
. - public TlsCertificate.from_files (string cert_file, string key_file) throws Error
Creates a TlsCertificate from the PEM-encoded data in
cert_file
andkey_file
. - public TlsCertificate.from_pem (string data, ssize_t length) throws Error
Creates a TlsCertificate from the PEM-encoded data in
data
. - public TlsCertificate.from_pkcs11_uris (string pkcs11_uri, string? private_key_pkcs11_uri) throws Error
Creates a TlsCertificate from a PKCS #11 URI.
- public TlsCertificate.from_pkcs12 (uint8[] data, string? password) throws Error
Creates a TlsCertificate from the data in
data
.
Methods:
- public GenericArray<unowned Bytes>? get_dns_names ()
Gets the value of dns_names.
- public GenericArray<unowned InetAddress>? get_ip_addresses ()
Gets the value of ip_addresses.
- public unowned TlsCertificate? get_issuer ()
Gets the TlsCertificate representing this's issuer, if known
- public string? get_issuer_name ()
Returns the issuer name from the certificate.
- public DateTime? get_not_valid_after ()
Returns the time at which the certificate became or will become invalid.
- public DateTime? get_not_valid_before ()
Returns the time at which the certificate became or will become valid.
- public string? get_subject_name ()
Returns the subject name from the certificate.
- public bool is_same (TlsCertificate cert_two)
Check if two TlsCertificate objects represent the same certificate.
- public virtual TlsCertificateFlags verify (SocketConnectable? identity, TlsCertificate? trusted_ca)
This verifies this and returns a set of TlsCertificateFlags indicating any problems found with it.
Inherited Members:
All known members inherited from class GLib.Object