package ocgtk

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Wrappers.Tls_certificate

type t = [ `tls_certificate | `object_ ] Gobject.obj
val new_from_file : string -> (t, GError.t) result

Create a new TlsCertificate

val new_from_file_with_password : string -> string -> (t, GError.t) result

Create a new TlsCertificate

val new_from_files : string -> string -> (t, GError.t) result

Create a new TlsCertificate

val new_from_pem : string -> int -> (t, GError.t) result

Create a new TlsCertificate

val new_from_pkcs11_uris : string -> string option -> (t, GError.t) result

Create a new TlsCertificate

val verify : t -> [ `socket_connectable ] Gobject.obj option -> t option -> Gio_enums.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.

If @cert is valid, %G_TLS_CERTIFICATE_NO_FLAGS is returned.

If @identity is not %NULL, @cert's name(s) will be compared against it, and %G_TLS_CERTIFICATE_BAD_IDENTITY will be set in the return value if it does not match. If @identity is %NULL, that bit will never be set in the return value.

If @trusted_ca is not %NULL, then @cert (or one of the certificates in its chain) must be signed by it, or else %G_TLS_CERTIFICATE_UNKNOWN_CA will be set in the return value. If @trusted_ca is %NULL, that bit will never be set in the return value.

GLib guarantees that if certificate verification fails, at least one error will be set in the return value, but it does not guarantee that all possible errors will be set. Accordingly, you may not safely decide to ignore any particular type of error. For example, it would be incorrect to mask %G_TLS_CERTIFICATE_EXPIRED if you want to allow expired certificates, because this could potentially be the only error flag set even if other problems exist with the certificate.

Because TLS session context is not used, #GTlsCertificate may not perform as many checks on the certificates as #GTlsConnection would. For example, certificate constraints may not be honored, and revocation checks may not be performed. The best way to verify TLS certificates used by a TLS connection is to let #GTlsConnection handle the verification.

val is_same : t -> t -> bool

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.

val get_subject_name : t -> string option

Returns the subject name from the certificate.

val get_issuer_name : t -> string option

Returns the issuer name from the certificate.

val get_issuer : t -> t option

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

val get_certificate_pem : t -> string

Get property: certificate-pem

val get_pkcs11_uri : t -> string

Get property: pkcs11-uri

val get_private_key_pem : t -> string

Get property: private-key-pem

val get_private_key_pkcs11_uri : t -> string

Get property: private-key-pkcs11-uri