Skip to main content

WrapDescription

Struct WrapDescription 

Source
#[non_exhaustive]
pub struct WrapDescription { pub recipient_info: Option<RecipientInfoKind>, pub key_encryption_oid: Oid, pub kdf_oid: Option<Oid>, pub kek_wrap_oid: Option<Oid>, pub content_encryption_oid: Option<Oid>, }
Expand description

What a wrap actually did.

The scheme a step requests names a family. The algorithms inside it move independently: the recipient’s key type selects the encapsulation, the content cipher selects the KEK size, and the KDF digest is a library default rather than a property of any key.

Where the scheme is self-describing this is an observation, re-derivable from the blob alone, which is what makes it evidence. Where it is not, it is what the backend invoked. WrapScheme::is_self_describing is the difference, and rite verify reports the two differently.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§recipient_info: Option<RecipientInfoKind>

How the CEK reaches the recipient, for a scheme built on CMS.

Absent for a raw mechanism, whose output carries no RecipientInfo and no other ASN.1 structure.

§key_encryption_oid: Oid

The key-encryption algorithm: key transport for ktri, the key-agreement scheme for kari.

§kdf_oid: Option<Oid>

The KDF, where the encapsulation derives a KEK.

§kek_wrap_oid: Option<Oid>

The algorithm wrapping the CEK under the derived KEK.

§content_encryption_oid: Option<Oid>

The content cipher, for schemes that encrypt the key as CMS content.

Implementations§

Source§

impl WrapDescription

Source

pub fn new(recipient_info: RecipientInfoKind, key_encryption_oid: Oid) -> Self

Describe a CMS wrap by its recipient info and key-encryption algorithm.

Source

pub fn raw(key_encryption_oid: Oid) -> Self

Describe a raw mechanism, which has no CMS structure around it.

Source

pub fn with_kdf(self, oid: Oid) -> Self

Record the KDF the encapsulation ran.

Source

pub fn with_kek_wrap(self, oid: Oid) -> Self

Record the algorithm that wrapped the CEK under the derived KEK.

Source

pub fn with_content_encryption(self, oid: Oid) -> Self

Record the content cipher.

Source

pub fn content_is_authenticated(&self) -> bool

Whether the CMS content was encrypted under an authenticated cipher.

True only for AES-256-GCM, the one authenticated cipher Rite writes, so a foreign blob under another AEAD reads as unauthenticated here. It asks about a CMS content cipher and nothing else, so it is false for every raw mechanism, including ones that authenticate by other means.

Trait Implementations§

Source§

impl Clone for WrapDescription

Source§

fn clone(&self) -> WrapDescription

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 WrapDescription

Source§

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

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

impl<'de> Deserialize<'de> for WrapDescription

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for WrapDescription

Source§

impl PartialEq for WrapDescription

Source§

fn eq(&self, other: &WrapDescription) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for WrapDescription

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for WrapDescription

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.