Struct coset::CoseEncrypt
source · pub struct CoseEncrypt {
pub protected: ProtectedHeader,
pub unprotected: Header,
pub ciphertext: Option<Vec<u8>>,
pub recipients: Vec<CoseRecipient>,
}
Expand description
Structure representing an encrypted object.
COSE_Encrypt = [
Headers,
ciphertext : bstr / nil,
recipients : [+COSE_recipient]
]
Fields§
§protected: ProtectedHeader
§unprotected: Header
§ciphertext: Option<Vec<u8>>
§recipients: Vec<CoseRecipient>
Implementations§
source§impl CoseEncrypt
impl CoseEncrypt
sourcepub fn decrypt<F, E>(
&self,
external_aad: &[u8],
cipher: F
) -> Result<Vec<u8>, E>where
F: FnOnce(&[u8], &[u8]) -> Result<Vec<u8>, E>,
pub fn decrypt<F, E>( &self, external_aad: &[u8], cipher: F ) -> Result<Vec<u8>, E>where F: FnOnce(&[u8], &[u8]) -> Result<Vec<u8>, E>,
Decrypt the ciphertext
value with an AEAD, using cipher
to decrypt the cipher text and
combined AAD.
Panics
This function will panic if no ciphertext
is available.
Trait Implementations§
source§impl AsCborValue for CoseEncrypt
impl AsCborValue for CoseEncrypt
source§fn from_cbor_value(value: Value) -> Result<Self>
fn from_cbor_value(value: Value) -> Result<Self>
Convert a [
Value
] into an instance of the type.source§fn to_cbor_value(self) -> Result<Value>
fn to_cbor_value(self) -> Result<Value>
Convert the object into a [
Value
], consuming it along the way.source§impl CborSerializable for CoseEncrypt
impl CborSerializable for CoseEncrypt
source§fn from_slice(slice: &[u8]) -> Result<Self>
fn from_slice(slice: &[u8]) -> Result<Self>
Create an object instance from serialized CBOR data in a slice. This method will fail (with
CoseError::ExtraneousData
) if there is additional CBOR data after the object.source§impl Clone for CoseEncrypt
impl Clone for CoseEncrypt
source§fn clone(&self) -> CoseEncrypt
fn clone(&self) -> CoseEncrypt
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for CoseEncrypt
impl Debug for CoseEncrypt
source§impl Default for CoseEncrypt
impl Default for CoseEncrypt
source§fn default() -> CoseEncrypt
fn default() -> CoseEncrypt
Returns the “default value” for a type. Read more
source§impl PartialEq<CoseEncrypt> for CoseEncrypt
impl PartialEq<CoseEncrypt> for CoseEncrypt
source§fn eq(&self, other: &CoseEncrypt) -> bool
fn eq(&self, other: &CoseEncrypt) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl TaggedCborSerializable for CoseEncrypt
impl TaggedCborSerializable for CoseEncrypt
source§fn from_tagged_slice(slice: &[u8]) -> Result<Self>
fn from_tagged_slice(slice: &[u8]) -> Result<Self>
Create an object instance from serialized CBOR data in a slice, expecting an initial
tag value.
impl StructuralPartialEq for CoseEncrypt
Auto Trait Implementations§
impl RefUnwindSafe for CoseEncrypt
impl Send for CoseEncrypt
impl Sync for CoseEncrypt
impl Unpin for CoseEncrypt
impl UnwindSafe for CoseEncrypt
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more