Module Signature.Key

Cryptographic key material for signing and verification.

type t

A key (may contain private key, public key, or both).

Symmetric Keys

val symmetric : string -> t

symmetric secret creates a symmetric key for HMAC algorithms.

Ed25519 Keys

val ed25519 : priv:string -> pub:string -> t

ed25519 ~priv ~pub creates an Ed25519 key pair. Both priv and pub should be raw 32-byte keys.

val ed25519_priv : string -> t

ed25519_priv priv creates an Ed25519 private key (for signing only).

val ed25519_pub : string -> t

ed25519_pub pub creates an Ed25519 public key (for verification only).

ECDSA P-256 Keys

p256 ~priv creates a P-256 key from the private key (public key derived automatically).

p256_pub pub creates a P-256 public key (for verification only).

ECDSA P-384 Keys

p384 ~priv creates a P-384 key from the private key.

p384_pub pub creates a P-384 public key (for verification only).

RSA Keys

val rsa : priv:Mirage_crypto_pk.Rsa.priv -> t

rsa ~priv creates an RSA key from the private key.

val rsa_pub : Mirage_crypto_pk.Rsa.pub -> t

rsa_pub pub creates an RSA public key (for verification only).

Key Properties

val can_sign : t -> bool

can_sign key returns true if the key can be used for signing.

val can_verify : t -> bool

can_verify key returns true if the key can be used for verification.

val algorithm : t -> Algorithm.t option

algorithm key returns the algorithm associated with the key, if known.