JWEHeader

Struct JWEHeader 

Source
pub struct JWEHeader {
Show 19 fields pub algorithm: String, pub encryption: String, pub key_id: Option<String>, pub token_type: Option<String>, pub content_type: Option<String>, pub ephemeral_public_key: Option<Value>, pub apu: Option<String>, pub apv: Option<String>, pub iv: Option<String>, pub tag: Option<String>, pub p2s: Option<String>, pub p2c: Option<u32>, pub critical: Option<Vec<String>>, pub certificate_chain: Option<Vec<String>>, pub certificate_url: Option<String>, pub certificate_sha1_thumbprint: Option<String>, pub certificate_sha256_thumbprint: Option<String>, pub key_set_url: Option<String>, pub public_key: Option<Value>,
}
Expand description

JWE (JSON Web Encryption) header structure.

This header identifies the cryptographic algorithms used to encrypt the content encryption key (CEK) and the plaintext.

Fields§

§algorithm: String

Key management algorithm (e.g., “RSA-OAEP”, “A256KW”, “ECDH-ES+A256KW”)

§encryption: String

Content encryption algorithm (e.g., “A256GCM”, “A128GCM”)

§key_id: Option<String>

Key ID - identifies which key was used for encryption

§token_type: Option<String>

Token type (typically “JWE” or omitted)

§content_type: Option<String>

Content type - describes the media type of the encrypted content

§ephemeral_public_key: Option<Value>

Ephemeral public key (for ECDH key agreement)

§apu: Option<String>

Agreement PartyUInfo (for ECDH)

§apv: Option<String>

Agreement PartyVInfo (for ECDH)

§iv: Option<String>

Initialization vector (for AES-GCM key wrap)

§tag: Option<String>

Authentication tag (for AES-GCM key wrap)

§p2s: Option<String>

PBES2 salt (not used - PBES2 not supported)

§p2c: Option<u32>

PBES2 iteration count (not used - PBES2 not supported)

§critical: Option<Vec<String>>

Critical headers that must be understood

§certificate_chain: Option<Vec<String>>

X.509 certificate chain

§certificate_url: Option<String>

X.509 certificate URL

§certificate_sha1_thumbprint: Option<String>

X.509 certificate SHA-1 thumbprint

§certificate_sha256_thumbprint: Option<String>

X.509 certificate SHA-256 thumbprint

§key_set_url: Option<String>

JWK Set URL

§public_key: Option<Value>

Embedded JWK public key

Implementations§

Source§

impl JWEHeader

Source

pub fn new(algorithm: impl Into<String>, encryption: impl Into<String>) -> Self

Create a new JWE header with the specified algorithms.

Source

pub fn with_key_id(self, key_id: impl Into<String>) -> Self

Set the key ID.

Source

pub fn with_content_type(self, content_type: impl Into<String>) -> Self

Set the content type.

Source

pub fn with_ephemeral_public_key(self, epk: Value) -> Self

Set the ephemeral public key (for ECDH).

Trait Implementations§

Source§

impl Clone for JWEHeader

Source§

fn clone(&self) -> JWEHeader

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for JWEHeader

Source§

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

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

impl Default for JWEHeader

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for JWEHeader

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 Serialize for JWEHeader

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

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,