package x509

  1. Overview
  2. Docs
Public Key Infrastructure (RFC 5280, PKCS) purely in OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

x509-0.16.5.tbz
sha256=149e25a5fea37f619fb2690bee5c00f01c9dcf31d335f8ffcaab39a7538ccd99
sha512=6dd494dba799eab7edde2af1b63bac6035bf4ae06f3a36dd4fa9abcd13d0c3fe3e93dc5848b65405dc5401b1755fd30c71482cb91f7495bc9cfb7c5bf15ef6d7

doc/x509/X509/index.html

Module X509Source

X509 encoding, generation, and validation.

X509 is a module for handling X.509 certificates and supplementary material (such as public and private RSA or EC keys), as described in RFC 5280. X.509 describes a hierarchical public key infrastructure, where all trust is delegated to certificate authorities (CA). The task of a CA is to sign certificate signing requests (CSR), which turns them into certificates, after verification that the requestor is eligible.

An X.509 certificate is an authentication token: a public key, a subject (e.g. server name), a validity period, optionally a purpose (usage), and various other optional Extensions. The overall approach of this package is to support decoding what is present in the real world, including weak ciphers (various validation functions support an allow list to avoid using weak hashes in chains if needed).

The public keys of trusted CAs are distributed with the software, or configured manually. When an endpoint connects, it presents its certificate chain, which are pairwise signed certificates. This chain is verified: the signatures have to be valid, the last certificate must be signed by a trusted CA, the name has to match the expected name, all certificates must be valid at the current time, and the purpose of each certificate must match its usage. An alternative validator checks that the hash of the server certificate matches the given hash.

This module uses the result type for errors. No provided binging raises an exception. Provided submodules include decoders and encoders (ASN.1 DER and PEM encoding) of X.509v3 certificates, distinguished names, public keys and private keys (PKCS 8, RFC 5208), and certificate signing requests (PKCS 10, RFC 2986, both use parts of PKCS 9, RFC 2985), certificate validation by construction of authenticators. Name validation, as defined in RFC 6125, is also implemented.

The archive format for certificates and private keys, PKCS 12, RFC 7292, is implemented in the PKCS12 submodule. While PKCS 12 decryption supports the weak algorithm used by default by widely used software (RC2!), the encryption path only supports AES.

Missing is the handling of online certificate status protocol. Some X.509v3 extensions are not handled, but only parsed, such as name constraints. If any extension is marked as critical in a certificate, but not handled, the validation will fail.

v0.16.5 - homepage

Sourcemodule Host : sig ... end

Hostnames (strict, wildcard), used for validation.

Sourcemodule Key_type : sig ... end

Types of keys

Sourcemodule Public_key : sig ... end

Public keys

Sourcemodule Private_key : sig ... end

Private keys

Sourcemodule Distinguished_name : sig ... end

X.500 distinguished name

Sourcemodule General_name : sig ... end

A list of general_names is the value of both subjectAltName and IssuerAltName extension.

Sourcemodule Extension : sig ... end

X.509v3 extensions

Sourcemodule Certificate : sig ... end

X509v3 certificate

Sourcemodule Validation : sig ... end

Chain Validation.

Certificate Signing request

Sourcemodule Signing_request : sig ... end

A certificate authority (CA) deals with PKCS 10 certificate signing requests, their construction and encoding, and provisioning using a private key to generate a certificate with a signature thereof.

Sourcemodule CRL : sig ... end

X.509 Certificate Revocation Lists.

Sourcemodule Authenticator : sig ... end

Certificate chain authenticators

Sourcemodule PKCS12 : sig ... end

PKCS12 archive files

Sourcemodule OCSP : sig ... end

OCSP (Online Certificate Status Protocol) as described in RFC 6960.

OCaml

Innovation. Community. Security.