TlsCertificate

open class TlsCertificate(pointer: <Error class: unknown class><<Error class: unknown class>>)

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

Skipped during bindings generation

  • method get_dns_names: Array parameter of type GLib.Bytes is not supported

  • method get_ip_addresses: Array parameter of type InetAddress is not supported

  • method certificate: Property has no getter nor setter

  • method certificate-pem: Property has no getter nor setter

  • method dns-names: Property has no getter nor setter

  • method ip-addresses: Property has no getter nor setter

  • method password: Property has no getter nor setter

  • method pkcs11-uri: Property has no getter nor setter

  • method pkcs12-data: Property has no getter nor setter

  • method private-key: Property has no getter nor setter

  • method private-key-pem: Property has no getter nor setter

  • method private-key-pkcs11-uri: Property has no getter nor setter

  • parameter data: guint8

Since

2.28

Constructors

Link copied to clipboard
constructor(file: String)

Creates a #GTlsCertificate from the data in @file.

constructor(certFile: String, keyFile: String)

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 #GTlsCertificate: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.

constructor(data: String, length: Long)

Creates a #GTlsCertificate from the PEM-encoded data in @data. If

constructor(pkcs11Uri: String, privateKeyPkcs11Uri: String? = null)

Creates a #GTlsCertificate from a PKCS \#11 URI.

constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val gioTlsCertificatePointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard

A #GTlsCertificate representing the entity that issued this certificate. If null, this means that the certificate is either self-signed, or else the certificate of the issuer is not available.

Link copied to clipboard
open val issuerName: String

The issuer from the certificate, null if unavailable.

Link copied to clipboard
open val notValidAfter: <Error class: unknown class>?

The time at which this cert is no longer valid, null if unavailable.

Link copied to clipboard
open val notValidBefore: <Error class: unknown class>?

The time at which this cert is considered to be valid, null if unavailable.

Link copied to clipboard

The subject from the cert, null if unavailable.

Functions

Link copied to clipboard

Gets the #GTlsCertificate representing @cert's issuer, if known

Link copied to clipboard
open fun getIssuerName(): String

Returns the issuer name from the certificate.

Link copied to clipboard
open fun getNotValidAfter(): <Error class: unknown class>?

Returns the time at which the certificate became or will become invalid.

Link copied to clipboard
open fun getNotValidBefore(): <Error class: unknown class>?

Returns the time at which the certificate became or will become valid.

Link copied to clipboard

Returns the subject name from the certificate.

Link copied to clipboard
open fun isSame(certTwo: TlsCertificate): Boolean

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 #GTlsCertificate:issuer, #GTlsCertificate:private-key, or #GTlsCertificate:private-key-pem properties differ.

Link copied to clipboard
open fun verify(identity: SocketConnectable? = null, trustedCa: TlsCertificate? = null): TlsCertificateFlags

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.