Skip to main content

DecapsulationKeyRejectNonContrib

Struct DecapsulationKeyRejectNonContrib 

Source
pub struct DecapsulationKeyRejectNonContrib(pub(crate) DecapsulationKey);
Expand description

X-Wing decapsulation key or private key.

This decapsulation key rejects “non-contributory behaviour” in the X25519 component of X-Wing. To accept instead, use DecapsulationKey.

§Backstory

RFC 7748 defines the X25519 function, and specifies that when used for ECDH (as it is inside X-Wing), the implementation MAY abort if the all-zero value is produced as a shared secret. X-Wing, as initially specified, used the X25519 function without making any mention of this MAY, meaning that implementations inherited whatever behaviour their underlying X25519 ECDH implementation provided.

This crate initially did not check for non-contributory behaviour, which meant it was incompatible with other implementations that did (in that it would accept ciphertexts that other implementations reject).

CFRG have decided that they will pick a single behaviour for the IETF X-Wing standard. Until the corresponding RFC is published, this crate supports both behaviours: constructing a DecapsulationKey accepts non-contributory behaviour for backwards-compatibility with existing usages, and this struct can be used to instead reject non-contributory behaviour. Once the RFC is published, DecapsulationKey will be altered to match it.

Tuple Fields§

§0: DecapsulationKey

Trait Implementations§

Source§

impl Clone for DecapsulationKeyRejectNonContrib

Source§

fn clone(&self) -> DecapsulationKeyRejectNonContrib

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DecapsulationKeyRejectNonContrib

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Decapsulator for DecapsulationKeyRejectNonContrib

Source§

type Kem = XWingKem

KEM algorithm this decapsulator is for.
Source§

fn encapsulation_key(&self) -> &EncapsulationKey

Encapsulation key which can encrypt ciphertexts this decapsulator can decrypt.
Source§

impl From<[u8; 32]> for DecapsulationKeyRejectNonContrib

Source§

fn from(sk: [u8; 32]) -> Self

Converts to this type from the input type.
Source§

impl Generate for DecapsulationKeyRejectNonContrib

Source§

fn try_generate_from_rng<R>(rng: &mut R) -> Result<Self, R::Error>
where R: TryCryptoRng + ?Sized,

Generate random key using the provided TryCryptoRng. Read more
Source§

fn generate_from_rng<R>(rng: &mut R) -> Self
where R: CryptoRng + ?Sized,

Generate random key using the provided CryptoRng.
Source§

fn try_generate() -> Result<Self, Error>

Randomly generate a value of this type using the system’s ambient cryptographically secure random number generator. Read more
Source§

fn generate() -> Self

Randomly generate a value of this type using the system’s ambient cryptographically secure random number generator. Read more
Source§

impl KeyExport for DecapsulationKeyRejectNonContrib

Source§

fn to_bytes(&self) -> Key<Self>

Serialize this key as a byte array.
Source§

impl KeyInit for DecapsulationKeyRejectNonContrib

Source§

fn new(key: &Key<Self>) -> Self

Create new value from fixed size key.
Source§

fn new_from_slice(key: &[u8]) -> Result<Self, InvalidLength>

Create new value from variable size key. Read more
Source§

fn generate_key<R>(rng: &mut R) -> Array<u8, Self::KeySize>
where R: CryptoRng,

👎Deprecated since 0.2.0:

use the Generate trait impl on Key instead

DEPRECATED: generate random key using the provided CryptoRng. Read more
Source§

impl KeySizeUser for DecapsulationKeyRejectNonContrib

Source§

type KeySize = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>

Key size in bytes.
Source§

fn key_size() -> usize

Return key size in bytes.
Source§

impl TryDecapsulate for DecapsulationKeyRejectNonContrib

Source§

type Error = DecapsulationError

Decapsulation error
Source§

fn try_decapsulate(&self, ct: &Ciphertext) -> Result<SharedKey, Self::Error>

Decapsulates the given Ciphertext a.k.a. “encapsulated key”.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.