Struct didcomm_rs::Jwe
source · [−]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
sourceimpl 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>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn get_payload(&self) -> Vec<u8>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
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.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Jwe
impl<'de> Deserialize<'de> for Jwe
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Jwe
impl Send for Jwe
impl Sync for Jwe
impl Unpin for Jwe
impl UnwindSafe for Jwe
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more