X448
Agree on a shared secret with X448 from RFC 7748.
Warning
Experimental: x448 0.14.0-pre.12 and ed448-goldilocks 0.14.0-pre.15 are
pre-releases, pinned to exact versions. Their API and behavior can change
between pre-releases, and their READMEs state that the code has not been
audited or reviewed.
from oxcrypto.exchange.x448 import X448
alice = X448.X448.generate()
bob = X448.X448.generate()
assert alice.exchange(bob.public_key()) == bob.exchange(alice.public_key())Private keys, public keys and shared secrets are 56 bytes. A u-coordinate
uses all 448 bits, so there is no top bit to mask; values of p or more are
reduced modulo p, as RFC 7748 specifies. Loading a low-order public key, or
a private key whose clamped scalar maps to the identity, raises ValueError.
An exchange whose result is all zeros, which non-canonical encodings of
low-order points can produce, also raises ValueError.
Keys
Keys use the same methods and formats as X25519, with the RFC 8410 OID 1.3.101.111.
Upstream
| Crate | Standard | Audit |
|---|---|---|
x448 0.14.0-pre.12 on ed448-goldilocks 0.14.0-pre.15 (pre-releases) | RFC 7748 | No published audit |
Both crates build with Rust 1.88, the oxcrypto MSRV. Tests use RFC 7748
sections 5.2 and 6.2 and the C2SP Wycheproof x448_test.json,
x448_asn_test.json and x448_pem_test.json vectors.
Zeroization
Note
A private key keeps its 56 bytes in a zeroize::Zeroizing buffer, which is
wiped when the key is freed. The shared secret and DER built from a private
key are wiped after the returned bytes are created. Not covered: keys,
passwords and shared secrets passed in or returned as Python bytes, the
clamped scalar x448 copies on the stack during a call, and the PBES2 key
pkcs5 derives from a password.