Simple public-key cryptography for the modern age

Public-key cryptography

Public and private key types are private, the constructors validate their well-formedness as much as possible, esp. so that powm_sec will not raise an exception (exponent > 1, or odd modulus). All modular exponentiations (unless otherwise noted) use the Z.powm_sec function, which uses a static access pattern and operates in constant time (of the bit size of the input), independent of which bits are set and not set. The performance is up to 20% worse than powm. Additionally, blinding is applied to RSA and DSA by default.

type bits = int
module Rsa : sig ... end

RSA public-key cryptography algorithm.

module Dsa : sig ... end

DSA digital signature algorithm.

module Dh : sig ... end

Diffie-Hellman, MODP version.

module Z_extra : sig ... end

Z Convert Z to big endian Cstruct.t and generate random Z values.