module

Beryl::Crypto::V1::EllipticCurveP256

NIST P-256 (secp256r1, FIPS 186-5, SP 800-186): ECDSA signatures with SHA-256 and RFC 6979 deterministic nonces, and ECDH.

key = Beryl::Crypto::V1::P256::PrivateKey.generate
signature = key.sign("a message")                  # DER, as TLS writes it
key.public_key.verify("a message", signature)      # => true
key.shared_secret(P256::PublicKey.new(peer_point)) # 32 bytes, the x coordinate

Key generation, signing and ECDH multiply by a secret scalar in constant time, on field arithmetic in assembly that equals fiat-crypto's output for every input (FieldArithmetic::P256FieldWithAssembly). Verification is variable time; its inputs are public.

Nested types