gi-gio-2.0.12: Gio bindings

CopyrightWill Thompson, Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.Gio.Objects.TlsCertificate

Contents

Description

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

Synopsis

Exported types

Methods

getIssuer

tlsCertificateGetIssuer Source #

Arguments

:: (HasCallStack, MonadIO m, IsTlsCertificate a) 
=> a

cert: a TlsCertificate

-> m TlsCertificate

Returns: The certificate of cert's issuer, or Nothing if cert is self-signed or signed with an unknown certificate.

Gets the TlsCertificate representing cert's issuer, if known

Since: 2.28

isSame

tlsCertificateIsSame Source #

Arguments

:: (HasCallStack, MonadIO m, IsTlsCertificate a, IsTlsCertificate b) 
=> a

certOne: first certificate to compare

-> b

certTwo: second certificate to compare

-> m Bool

Returns: whether the same or not

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

Since: 2.34

listNewFromFile

tlsCertificateListNewFromFile Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> [Char]

file: file containing PEM-encoded certificates to import

-> m [TlsCertificate]

Returns: a List containing TlsCertificate objects. You must free the list and its contents when you are done with it. (Can throw GError)

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

Since: 2.28

newFromFile

tlsCertificateNewFromFile Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> [Char]

file: file containing a PEM-encoded certificate to import

-> m TlsCertificate

Returns: the new certificate, or Nothing on error (Can throw GError)

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 Nothing and set error. Otherwise, this behaves like tlsCertificateNewFromPem.

Since: 2.28

newFromFiles

tlsCertificateNewFromFiles Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> [Char]

certFile: file containing one or more PEM-encoded certificates to import

-> [Char]

keyFile: file containing a PEM-encoded private key to import

-> m TlsCertificate

Returns: the new certificate, or Nothing on error (Can throw GError)

Creates a TlsCertificate from the PEM-encoded data in certFile and keyFile. The returned certificate will be the first certificate found in certFile. As of GLib 2.44, if certFile 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 Nothing and set error. Otherwise, this behaves like tlsCertificateNewFromPem.

Since: 2.28

newFromPem

tlsCertificateNewFromPem Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

data: PEM-encoded certificate data

-> Int64

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

-> m TlsCertificate

Returns: the new certificate, or Nothing if data is invalid (Can throw GError)

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.

Since: 2.28

verify

tlsCertificateVerify Source #

Arguments

:: (HasCallStack, MonadIO m, IsTlsCertificate a, IsSocketConnectable b, IsTlsCertificate c) 
=> a

cert: a TlsCertificate

-> Maybe b

identity: the expected peer identity

-> Maybe c

trustedCa: the certificate of a trusted authority

-> m [TlsCertificateFlags]

Returns: the appropriate TlsCertificateFlags

This verifies cert and returns a set of TlsCertificateFlags 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 identity is not Nothing, cert's name(s) will be compared against it, and TlsCertificateFlagsBadIdentity will be set in the return value if it does not match. If identity is Nothing, that bit will never be set in the return value.

If trustedCa is not Nothing, then cert (or one of the certificates in its chain) must be signed by it, or else TlsCertificateFlagsUnknownCa will be set in the return value. If trustedCa is Nothing, that bit will never be set in the return value.

(All other TlsCertificateFlags values will always be set or unset as appropriate.)

Since: 2.28

Properties

certificate

data TlsCertificateCertificatePropertyInfo Source #

Instances

AttrInfo TlsCertificateCertificatePropertyInfo Source # 
type AttrOrigin TlsCertificateCertificatePropertyInfo Source # 
type AttrLabel TlsCertificateCertificatePropertyInfo Source # 
type AttrGetType TlsCertificateCertificatePropertyInfo Source # 
type AttrBaseTypeConstraint TlsCertificateCertificatePropertyInfo Source # 
type AttrSetTypeConstraint TlsCertificateCertificatePropertyInfo Source # 
type AttrAllowedOps TlsCertificateCertificatePropertyInfo Source # 

certificatePem

data TlsCertificateCertificatePemPropertyInfo Source #

Instances

AttrInfo TlsCertificateCertificatePemPropertyInfo Source # 
type AttrOrigin TlsCertificateCertificatePemPropertyInfo Source # 
type AttrLabel TlsCertificateCertificatePemPropertyInfo Source # 
type AttrGetType TlsCertificateCertificatePemPropertyInfo Source # 
type AttrBaseTypeConstraint TlsCertificateCertificatePemPropertyInfo Source # 
type AttrSetTypeConstraint TlsCertificateCertificatePemPropertyInfo Source # 
type AttrAllowedOps TlsCertificateCertificatePemPropertyInfo Source # 

issuer

data TlsCertificateIssuerPropertyInfo Source #

Instances

AttrInfo TlsCertificateIssuerPropertyInfo Source # 
type AttrOrigin TlsCertificateIssuerPropertyInfo Source # 
type AttrLabel TlsCertificateIssuerPropertyInfo Source # 
type AttrGetType TlsCertificateIssuerPropertyInfo Source # 
type AttrBaseTypeConstraint TlsCertificateIssuerPropertyInfo Source # 
type AttrSetTypeConstraint TlsCertificateIssuerPropertyInfo Source # 
type AttrAllowedOps TlsCertificateIssuerPropertyInfo Source # 

privateKey

data TlsCertificatePrivateKeyPropertyInfo Source #

Instances

AttrInfo TlsCertificatePrivateKeyPropertyInfo Source # 
type AttrOrigin TlsCertificatePrivateKeyPropertyInfo Source # 
type AttrLabel TlsCertificatePrivateKeyPropertyInfo Source # 
type AttrGetType TlsCertificatePrivateKeyPropertyInfo Source # 
type AttrBaseTypeConstraint TlsCertificatePrivateKeyPropertyInfo Source # 
type AttrSetTypeConstraint TlsCertificatePrivateKeyPropertyInfo Source # 
type AttrAllowedOps TlsCertificatePrivateKeyPropertyInfo Source # 

privateKeyPem

data TlsCertificatePrivateKeyPemPropertyInfo Source #

Instances

AttrInfo TlsCertificatePrivateKeyPemPropertyInfo Source # 
type AttrOrigin TlsCertificatePrivateKeyPemPropertyInfo Source # 
type AttrLabel TlsCertificatePrivateKeyPemPropertyInfo Source # 
type AttrGetType TlsCertificatePrivateKeyPemPropertyInfo Source # 
type AttrBaseTypeConstraint TlsCertificatePrivateKeyPemPropertyInfo Source # 
type AttrSetTypeConstraint TlsCertificatePrivateKeyPemPropertyInfo Source # 
type AttrAllowedOps TlsCertificatePrivateKeyPemPropertyInfo Source #