pub struct Jwe {
pub protected: Option<JwmHeader>,
pub unprotected: Option<JwmHeader>,
pub recipient: Option<Recipient>,
pub recipients: Option<Vec<Recipient>>,
pub tag: Option<String>,
/* private fields */
}Expand description
JWE representation of Message with public header.
Can be serialized to JSON or Compact representations and from same.
Fields§
§protected: Option<JwmHeader>integrity protected header elements
unprotected: Option<JwmHeader>header elements that are not integrity protected
recipient: Option<Recipient>Top-level recipient data for flat JWE JSON messages.
Will be ignored if recipients is not None
recipients: Option<Vec<Recipient>>Pre-recipient data for flat JWE JSON messages.
If not None, will be preferred over recipient.
tag: Option<String>base64 encoded JWE authentication tag
Implementations§
Source§impl Jwe
impl Jwe
Sourcepub fn new(
unprotected: Option<JwmHeader>,
recipients: Option<Vec<Recipient>>,
ciphertext: impl AsRef<[u8]>,
protected: Option<JwmHeader>,
tag: Option<impl AsRef<[u8]>>,
iv_input: Option<String>,
) -> Self
pub fn new( unprotected: Option<JwmHeader>, recipients: Option<Vec<Recipient>>, ciphertext: impl AsRef<[u8]>, protected: Option<JwmHeader>, tag: Option<impl AsRef<[u8]>>, iv_input: Option<String>, ) -> Self
Constructor, which should be used after message is encrypted.
Sourcepub fn new_flat(
unprotected: Option<JwmHeader>,
recipient: Recipient,
ciphertext: impl AsRef<[u8]>,
protected: Option<JwmHeader>,
tag: Option<impl AsRef<[u8]>>,
iv_input: Option<String>,
) -> Self
pub fn new_flat( unprotected: Option<JwmHeader>, recipient: Recipient, ciphertext: impl AsRef<[u8]>, protected: Option<JwmHeader>, tag: Option<impl AsRef<[u8]>>, iv_input: Option<String>, ) -> Self
Constructor for creating a flat JWE JSON
Sourcepub fn generate_iv() -> String
pub fn generate_iv() -> String
Generate new random IV as String
Sourcepub fn get_payload(&self) -> Vec<u8> ⓘ
pub fn get_payload(&self) -> Vec<u8> ⓘ
Getter for ciphered payload of JWE.
Sourcepub fn get_alg(&self) -> Option<String>
pub fn get_alg(&self) -> Option<String>
Gets alg header value from either protected or from unprotected.
Will default to None if not set in any of them.
Sourcepub fn get_cty(&self) -> Option<String>
pub fn get_cty(&self) -> Option<String>
Gets cty header value from either protected or from unprotected.
Will default to None if not set in any of them.
Sourcepub fn get_enc(&self) -> Option<String>
pub fn get_enc(&self) -> Option<String>
Gets enc header value from either protected or from unprotected.
Will default to None if not set in any of them.
Sourcepub fn get_epk(&self) -> Option<Jwk>
pub fn get_epk(&self) -> Option<Jwk>
Gets epk header value from either protected or from unprotected.
Will default to None if not set in any of them.
Sourcepub fn get_jku(&self) -> Option<String>
pub fn get_jku(&self) -> Option<String>
Gets jku header value from either protected or from unprotected.
Will default to None if not set in any of them.
Sourcepub fn get_jwk(&self) -> Option<Jwk>
pub fn get_jwk(&self) -> Option<Jwk>
Gets jwk header value from either protected or from unprotected.
Will default to None if not set in any of them.