package fiatp256
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=e294aa1f920205da2c9f0ab909e2755b070702cb4fdb47a94b9c18e55cdf774d
sha512=36f55cd9a9a7d11fe1c29a19a0e14b0354da7e8e0c2ae460f754c8f4646bcd57fa26270078d9c66e211c6ad352ff75b560923594a5ad5f2e4ff7f5298c96668e
Description
This is an implementation of the ECDH over P256 key exchange algorithm, using code from Fiat (https://github.com/mitplv/fiatcrypto).
Cryptographic primitives should not be used in end applications, they are better used as part of a cryptographic library.
README
Fiatp256
fiatp256
contains primitives for ECDH key exchange algorithm over NIST curve P256.
It internally uses bindings to C code generated using the correctbyconstruction implementations from fiatcrypto.
Please be aware that cryptographic primitives should not be used in end applications, they are better used as part of a higher level cryptographic library.
Installation
fiatp256
is available on opam and can be install as follows:
opam install fiatp256
Usage
The entry point to this library is the Fiat_p256
module and the main function is dh
which let you perform a key exchange given your private key scalar
and the other party's public key point
:
let secret = Fiat_p256.dh ~scalar ~point
Note that the point
values built or parsed using Fiat_p256
's interface are checked according to NIST's Recommendation for PairWise Key Establishment Schemes Using Discrete Logarithm Cryptography section 5.6.2.3.2 so that you shouldn't be able to provide an invalid point or the point at infinity to the functions exposed in this module.
You can also compute the public P256 key corresponding to your private key scalar
using the public
function:
let public_key = Fiat_p256.public ~scalar
Note that the scalar
values parsed using Fiat_p256
's interface must be within P256's generator subgroup order range so that your public key can't be the point at infinity. Any scalar not in the range [1  (n1)]
, n
being the group order, will be rejected.
Dependencies (7)
 ppx_expect
 hex
 duneconfigurator

dune
>= "1.6.0"

cstruct
>= "3.5.0" & < "6.1.0"
 bigarraycompat

ocaml
< "5.0"
Dev Dependencies (4)

yojson
withtest & >= "1.6.0"

ppx_deriving_yojson
withtest

asn1combinators
withtest & < "0.3.0"

alcotest
withtest & < "1.4.0"
Used by (1)

tls
>= "0.12.0" & < "0.13.0"
Conflicts
None