pub struct CoseMac {
pub protected: ProtectedHeader,
pub unprotected: Header,
pub payload: Option<Vec<u8>>,
pub tag: Vec<u8>,
pub recipients: Vec<CoseRecipient>,
}
Expand description
Structure representing a message with authentication code (MAC).
COSE_Mac = [
Headers,
payload : bstr / nil,
tag : bstr,
recipients :[+COSE_recipient]
]
Fields§
§protected: ProtectedHeader
§unprotected: Header
§payload: Option<Vec<u8>>
§tag: Vec<u8>
§recipients: Vec<CoseRecipient>
Implementations§
source§impl CoseMac
impl CoseMac
sourcepub fn verify_tag<F, E>(&self, external_aad: &[u8], verify: F) -> Result<(), E>where
F: FnOnce(&[u8], &[u8]) -> Result<(), E>,
pub fn verify_tag<F, E>(&self, external_aad: &[u8], verify: F) -> Result<(), E>where F: FnOnce(&[u8], &[u8]) -> Result<(), E>,
Verify the tag
value using the provided mac
function, feeding it
the tag
value and the combined to-be-MACed data (in that order).
Panics
This function will panic if the payload
has not been set.
Trait Implementations§
source§impl AsCborValue for CoseMac
impl AsCborValue for CoseMac
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 CoseMac
impl CborSerializable for CoseMac
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 PartialEq<CoseMac> for CoseMac
impl PartialEq<CoseMac> for CoseMac
source§impl TaggedCborSerializable for CoseMac
impl TaggedCborSerializable for CoseMac
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 CoseMac
Auto Trait Implementations§
impl RefUnwindSafe for CoseMac
impl Send for CoseMac
impl Sync for CoseMac
impl Unpin for CoseMac
impl UnwindSafe for CoseMac
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