Skip to main content

Crate oxicrypto_kex

Crate oxicrypto_kex 

Source
Expand description

Pure Rust key-exchange implementations for the OxiCrypto stack.

Provides a KeyAgreement-trait wrapper for X25519 Diffie-Hellman, X448 Diffie-Hellman, ECDH over NIST P-256, P-384, and P-521, plus key generation helpers.

§Key generation

All generate_keypair functions accept any RNG implementing rand_core::TryCryptoRng (rand_core 0.10+).

§Shared-secret rejection

Every agree() implementation rejects all-zero shared secrets via constant-time comparison. An all-zero output indicates a low-order (small subgroup) public key attack; callers will receive CryptoError::Kex in that case.

Modules§

hpke
Hybrid Public Key Encryption (HPKE) — RFC 9180.

Structs§

EcdhP256
ECDH key agreement over NIST P-256 (secp256r1).
EcdhP384
ECDH key agreement over NIST P-384 (secp384r1).
EcdhP521
ECDH key agreement over NIST P-521 (secp521r1).
X448
X448 Diffie-Hellman key agreement (RFC 7748 §5).
X448PublicKey
A type-safe 56-byte X448 public key.
X25519
X25519 Diffie-Hellman key agreement.
X25519PublicKey
A type-safe 32-byte X25519 public key.

Functions§

ecdh_p256_generate_keypair
Generate an ECDH P-256 key pair.
ecdh_p384_generate_keypair
Generate an ECDH P-384 key pair.
ecdh_p521_generate_keypair
Generate an ECDH P-521 key pair.
x448_generate_keypair
Generate an X448 key pair from raw random bytes.
x25519_generate_keypair
Generate an X25519 key pair.