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:

§Panics:

A panic will occur if:

§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 for no_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.
DecapsulationKey
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.
EncapsulationKey
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.
SharedSecret
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.