Struct coset::CoseEncrypt0
source · pub struct CoseEncrypt0 {
pub protected: ProtectedHeader,
pub unprotected: Header,
pub ciphertext: Option<Vec<u8>>,
}
Expand description
Structure representing an encrypted object.
COSE_Encrypt0 = [
Headers,
ciphertext : bstr / nil,
]
Fields§
§protected: ProtectedHeader
§unprotected: Header
§ciphertext: Option<Vec<u8>>
Implementations§
source§impl CoseEncrypt0
impl CoseEncrypt0
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 CoseEncrypt0
impl AsCborValue for CoseEncrypt0
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 CoseEncrypt0
impl CborSerializable for CoseEncrypt0
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 CoseEncrypt0
impl Clone for CoseEncrypt0
source§fn clone(&self) -> CoseEncrypt0
fn clone(&self) -> CoseEncrypt0
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 CoseEncrypt0
impl Debug for CoseEncrypt0
source§impl Default for CoseEncrypt0
impl Default for CoseEncrypt0
source§fn default() -> CoseEncrypt0
fn default() -> CoseEncrypt0
Returns the “default value” for a type. Read more
source§impl PartialEq<CoseEncrypt0> for CoseEncrypt0
impl PartialEq<CoseEncrypt0> for CoseEncrypt0
source§fn eq(&self, other: &CoseEncrypt0) -> bool
fn eq(&self, other: &CoseEncrypt0) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl TaggedCborSerializable for CoseEncrypt0
impl TaggedCborSerializable for CoseEncrypt0
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 CoseEncrypt0
Auto Trait Implementations§
impl RefUnwindSafe for CoseEncrypt0
impl Send for CoseEncrypt0
impl Sync for CoseEncrypt0
impl Unpin for CoseEncrypt0
impl UnwindSafe for CoseEncrypt0
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