Module xwing
Available on crate feature
dep_orion
only.Expand description
X-Wing hybrid KEM as specified in draft-connolly-cfrg-xwing-kem-06.
§Parameters:
ek
: The public encapsulation key, for which a shared secret and ciphertext is generated.dk
: The secret decapsulation key, for which a ciphertext is used to derive a shared secret.c
: The public ciphertext, sent to the decapsulating party.eseed
: Explicit randomness used for encapsulation.
§Errors:
An error will be returned if:
eseed
is not 64 bytes.getrandom::fill()
fails during encapsulation.
§Panics:
A panic will occur if:
getrandom::fill()
fails duringKeyPair::generate()
.
§Security:
- It is critical that both the seed and explicit randomness
eseed
, used for key generation and encapsulation are generated using a strong CSPRNG. - Users should always prefer encapsulation without specifying explicit randomness, if possible.
encap_deterministic()
exists mainly forno_std
usage.
§Example:
use orion::hazardous::kem::xwing::*;
let keypair = KeyPair::generate()?;
let (sender_shared_secret, sender_ciphertext) = XWing::encap(keypair.public())?;
let recipient_shared_secret = XWing::decap(keypair.private(), &sender_ciphertext)?;
assert_eq!(sender_shared_secret, recipient_shared_secret);
Structs§
- Ciphertext
- A type to represent the KEM
Ciphertext
that X-Wing returns. - Decapsulation
Key - A type to represent the
DecapsulationKey
that X-Wing produces. This type’s foremost responsibility is to cache key-expansions, to be re-used across multiple decapsulations with a single secret. - Encapsulation
Key - A type to represent the public
EncapsulationKey
that X-Wing uses. - KeyPair
- A keypair of X-Wing keys.
- Seed
- A type to represent the private
Seed
that X-Wing uses. - Shared
Secret - A type to represent the private
SharedSecret
that X-Wing returns. - XWing
- X-Wing hybrid KEM.
Constants§
- CIPHERTEXT_
SIZE - Size of public Ciphertext.
- PRIVATE_
KEY_ SIZE - Size of private DecapsulationKey.
- PUBLIC_
KEY_ SIZE - Size of public EncapsulationKey.
- SHARED_
SECRET_ SIZE - Size of private SharedSecret.