Module X509_certchain.Private_key

Certificate private keys.

type t

The type for certificate private keys.

Note. The private key data is kept in a C datastructure so the GC does not see it.

val read_pem_file : string -> (t, string) Stdlib.result

of_pem_file file loads a private key from file file.

Note. This function ensures that the GC does not see the private key data.

val write_pem_file : string -> t -> (unit, string) Stdlib.result

write_pem_file file k writes the private key k to file.

Note. This function ensures that the GC does not see the private key data.

val generate : unit -> (t, string) Stdlib.result

generate () generates a suitable private key whose details are subject to change. Currently this is an ECDSA secp256r1 (P-256) private key.

val copy_psa_key : Bytesrw_crypto.Psa.Key_id.t -> (t, string) Stdlib.result

copy_psa_key k is a certificate private key from the given PSA key. This key must be exportable and be an RSA or elliptic curve key. The psa key can be destroyed afterwards.