Module Mirage_crypto_ec

Elliptic curve cryptography

Mirage-crypto-ec implements public key cryptography with named elliptic curves. Ephemeral key exchanges with Diffie-Hellman and digital signatures (ECDSA) are implemented.

The arithmetic operations uses code generated by fiat-crypto which is proven to consume a constant amount of time, independent of the input values.

type error = [
  1. | `Invalid_range
  2. | `Invalid_format
  3. | `Invalid_length
  4. | `Not_on_curve
  5. | `At_infinity
  6. | `Low_order
]

The type for errors.

val pp_error : Stdlib.Format.formatter -> error -> unit

Pretty printer for errors

exception Message_too_long

Raised if the provided message is too long for the curve.

module type Dh = sig ... end

Diffie-Hellman key exchange.

module type Dsa = sig ... end

Digital signature algorithm.

module type Dh_dsa = sig ... end

Elliptic curve with Diffie-Hellman and DSA.

module P224 : Dh_dsa

The NIST P-224 curve, also known as SECP224R1. Please note that decompression is not supported for P-224 public keys.

module P256 : Dh_dsa

The NIST P-256 curve, also known as SECP256R1.

module P384 : Dh_dsa

The NIST P-384 curve, also known as SECP384R1.

module P521 : Dh_dsa

The NIST P-521 curve, also known as SECP521R1.

module X25519 : Dh

Curve 25519 Diffie-Hellman, also known as X25519.

module Ed25519 : sig ... end

Curve 25519 DSA, also known as Ed25519.