Skip to main content

Module x25519

Module x25519 

Source
Expand description

x25519 key creation (RFC 7748 §5, the X25519 function).

Keys minted here drive AgreementSecretKey::agree, whose result chains into the KDFs (see hkdf_sha2::prepare_from). Peer imports are deliberately permissive — a degenerate (small-order) peer surfaces at agree, the operation that computes the secret, as Error::InvalidKey.

Functions§

generate_key
Generate a fresh random keypair, returning both halves.
import_public_key_jwk
Import a peer’s public key from an RFC 8037 OKP JWK (as JSON text).
import_public_key_raw
Import a peer’s raw 32-byte public key (RFC 7748’s little-endian u-coordinate).
import_public_key_spki
Import a peer’s public key from an X.509 SubjectPublicKeyInfo (DER).
import_secret_key_jwk
Import a secret key from an RFC 8037 OKP private JWK (as JSON text).
import_secret_key_pkcs8
Import a secret key from a PKCS#8 PrivateKeyInfo (DER).