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 GTlsServerConnection).

Constructors

this
this(GTlsCertificate* gTlsCertificate, bool ownedRef = false)

Sets our main struct and passes it to the parent class.

this
this(string file)

Creates a GTlsCertificate 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 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.

this
this(string certFile, string keyFile)

Creates a GTlsCertificate 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 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.

this
this(string data, ptrdiff_t length)

Creates a GTlsCertificate 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 private-key-pem property for information about supported formats.)

Members

Functions

getIssuer
TlsCertificate getIssuer()

Gets the GTlsCertificate representing cert's issuer, if known

getStruct
void* getStruct()

the main Gtk struct as a void*

getTlsCertificateStruct
GTlsCertificate* getTlsCertificateStruct(bool transferOwnership = false)

Get the main Gtk struct

isSame
bool isSame(TlsCertificate certTwo)

Check if two GTlsCertificate 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 issuer, private-key, or private-key-pem properties differ.

verify
GTlsCertificateFlags verify(SocketConnectableIF identity, TlsCertificate trustedCa)

This verifies cert and returns a set of GTlsCertificateFlags 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.

Static functions

getType
GType getType()
listNewFromFile
ListG listNewFromFile(string file)

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

Variables

gTlsCertificate
GTlsCertificate* gTlsCertificate;

the main Gtk struct

Meta

Since

2.28