botan-low-0.0.1.0: Low-level Botan bindings
Copyright(c) Leo D 2023
LicenseBSD-3-Clause
Maintainerleo@apotheca.io
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe-Inferred
LanguageHaskell2010

Botan.Low.X509

Description

A certificate is a binding between some identifying information (called a subject) and a public key. This binding is asserted by a signature on the certificate, which is placed there by some authority (the issuer) that at least claims that it knows the subject named in the certificate really “owns” the private key corresponding to the public key in the certificate.

The major certificate format in use today is X.509v3, used for instance in the Transport Layer Security (TLS) protocol.

Synopsis

X509 Certificates

newtype X509Cert Source #

Constructors

MkX509Cert 

Fields

withX509Cert :: X509Cert -> (BotanX509Cert -> IO a) -> IO a Source #

x509CertLoad Source #

Arguments

:: ByteString

cert[]

-> IO X509Cert

cert_obj

x509CertLoadFile Source #

Arguments

:: FilePath

filename

-> IO X509Cert

cert_obj

x509CertDestroy :: X509Cert -> IO () Source #

Destroy an x509 cert object immediately

x509CertDup Source #

Arguments

:: X509Cert

new_cert

-> IO X509Cert

cert

x509CertNotBefore Source #

Arguments

:: X509Cert

cert

-> IO Word64

time_since_epoch

x509CertNotAfter Source #

Arguments

:: X509Cert

cert

-> IO Word64

time_since_epoch

x509CertGetIssuerDN Source #

Arguments

:: X509Cert

cert

-> ByteString

key

-> Int

index

-> IO ByteString

out[]

x509CertGetSubjectDN Source #

Arguments

:: X509Cert

cert

-> ByteString

key

-> Int

index

-> IO ByteString

out[]

x509CertAllowedUsage Source #

Arguments

:: X509Cert

cert

-> X509KeyConstraints

key_usage

-> IO Bool 

Warning: Unexplained function, best-guess implementation

x509CertHostnameMatch Source #

Arguments

:: X509Cert

cert

-> ByteString

hostname

-> IO Bool 

Warning: Unexplained function, best-guess implementation

Check if the certificate matches the specified hostname via alternative name or CN match. RFC 5280 wildcards also supported.

x509CertVerify Source #

Arguments

:: X509Cert

cert

-> [X509Cert]

intermediates

-> [X509Cert]

trusted

-> Maybe FilePath

trusted_path

-> Int

required_strength

-> ByteString

hostname

-> Word64

reference_time

-> IO (Bool, Int)

(valid,validation_result)

Returns 0 if the validation was successful, 1 if validation failed, and negative on error. A status code with details is written to *validation_result

Intermediates or trusted lists can be null Trusted path can be null

X509 Key constraints

X509 Certificate revocation list

newtype X509CRL Source #

Constructors

MkX509CRL 

Fields

withX509CRL :: X509CRL -> (BotanX509CRL -> IO a) -> IO a Source #

x509CRLLoad Source #

Arguments

:: ByteString

crl_bits[]

-> IO X509CRL

crl_obj

x509CRLLoadFile Source #

Arguments

:: FilePath

crl_path

-> IO X509CRL

crl_obj

x509IsRevoked Source #

Arguments

:: X509CRL

crl

-> X509Cert

cert

-> IO Bool 

Given a CRL and a certificate, check if the certificate is revoked on that particular CRL

x509CertVerifyWithCLR Source #

Arguments

:: X509Cert

cert

-> [X509Cert]

intermediates

-> [X509Cert]

trusted

-> [X509CRL]

crls

-> Maybe FilePath

trusted_path

-> Int

required_strength

-> ByteString

hostname

-> Word64

reference_time

-> IO (Bool, Int)

(valid,validation_result)

Different flavor of botan_x509_cert_verify, supports revocation lists. CRLs are passed as an array, same as intermediates and trusted CAs

Convenience