Streamlined NTRU Prime
NTRU Prime KEM, including sntrup761 as used by OpenSSH.
from oxcrypto.kem.sntrup_kem import SNTRUP
private_key = SNTRUP.SNTRUP761.generate()
ciphertext, shared_secret = private_key.public_key().encapsulate()
assert private_key.decapsulate(ciphertext) == shared_secret| Variant | Private key | Public key | Ciphertext | Shared secret |
|---|---|---|---|---|
SNTRUP653 | 1518 bytes | 994 bytes | 897 bytes | 32 bytes |
SNTRUP761 | 1763 bytes | 1158 bytes | 1039 bytes | 32 bytes |
SNTRUP857 | 1999 bytes | 1322 bytes | 1184 bytes | 32 bytes |
SNTRUP953 | 2254 bytes | 1505 bytes | 1349 bytes | 32 bytes |
SNTRUP1013 | 2417 bytes | 1623 bytes | 1455 bytes | 32 bytes |
SNTRUP1277 | 3059 bytes | 2067 bytes | 1847 bytes | 32 bytes |
Private keys serialize in the full NTRU Prime secret-key encoding.
Warning
Experimental. Streamlined NTRU Prime is specified by
draft-josefsson-ntruprime-streamlined, an Internet-Draft. sntrup761 is used in
OpenSSH's sntrup761x25519-sha512 key exchange.
- Crate: RustCrypto
sntrup-kem0.1.0-rc.0, pre-release, no published audit. Builds with Rust 1.88. - Vectors: draft-josefsson-ntruprime-streamlined-00 sntrup761 KATs, from the
crate's
tests/data. The other parameter sets have no bundled vectors and are covered by round-trip tests.
Zeroization
Retained state: the secret-key bytes. The upstream DecapsulationKey wipes
them on drop.
Short-lived copies not wiped by the upstream crate: decapsulation
intermediates and the shared-secret array the kem trait adapter returns
before oxcrypto copies it into a wiped buffer.