Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
Private key pem encoding and decoding
Private keys as defined in PKCS 8: decoding and encoding in PEM format
type t = [
| `RSA of Mirage_crypto_pk.Rsa.priv
| `ED25519 of Mirage_crypto_ec.Ed25519.priv
| `P224 of Mirage_crypto_ec.P224.Dsa.priv
| `P256 of Mirage_crypto_ec.P256.Dsa.priv
| `P384 of Mirage_crypto_ec.P384.Dsa.priv
| `P521 of Mirage_crypto_ec.P521.Dsa.priv
]
The polymorphic variant of private keys.
val public : t -> Public_key.t
public priv
is the corresponding public key of priv
.
val decode_der : Cstruct.t -> (t, [> Rresult.R.msg ]) Rresult.result
decode_der der
is t
, where the private key of der
is extracted. It must be in PKCS8 (RFC 5208, Section 5) PrivateKeyInfo structure.
val encode_der : t -> Cstruct.t
encode_der key
is der
, the encoded private key as PKCS8 (RFC 5208, Section 5) PrivateKeyInfo structure.
val decode_pem : Cstruct.t -> (t, [> Rresult.R.msg ]) Rresult.result
decode_pem pem
is t
, where the private key of pem
is extracted. Both RSA PRIVATE KEY and PRIVATE KEY stanzas are supported.
val encode_pem : t -> Cstruct.t
encode_pem key
is pem
, the encoded private key (using PRIVATE KEY
).