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: StringKey management algorithm (e.g., “RSA-OAEP”, “A256KW”, “ECDH-ES+A256KW”)
encryption: StringContent 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
impl JWEHeader
Sourcepub fn new(algorithm: impl Into<String>, encryption: impl Into<String>) -> Self
pub fn new(algorithm: impl Into<String>, encryption: impl Into<String>) -> Self
Create a new JWE header with the specified algorithms.
Sourcepub fn with_key_id(self, key_id: impl Into<String>) -> Self
pub fn with_key_id(self, key_id: impl Into<String>) -> Self
Set the key ID.
Sourcepub fn with_content_type(self, content_type: impl Into<String>) -> Self
pub fn with_content_type(self, content_type: impl Into<String>) -> Self
Set the content type.
Sourcepub fn with_ephemeral_public_key(self, epk: Value) -> Self
pub fn with_ephemeral_public_key(self, epk: Value) -> Self
Set the ephemeral public key (for ECDH).