pub struct CoseMac0 {
pub protected: ProtectedHeader,
pub unprotected: Header,
pub payload: Option<Vec<u8>>,
pub tag: Vec<u8>,
}
Expand description
Structure representing a message with authentication code (MAC) where the relevant key is implicit.
COSE_Mac0 = [
Headers,
payload : bstr / nil,
tag : bstr,
]
Fields§
§protected: ProtectedHeader
§unprotected: Header
§payload: Option<Vec<u8>>
§tag: Vec<u8>
Implementations§
source§impl CoseMac0
impl CoseMac0
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 CoseMac0
impl AsCborValue for CoseMac0
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 CoseMac0
impl CborSerializable for CoseMac0
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<CoseMac0> for CoseMac0
impl PartialEq<CoseMac0> for CoseMac0
source§impl TaggedCborSerializable for CoseMac0
impl TaggedCborSerializable for CoseMac0
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 CoseMac0
Auto Trait Implementations§
impl RefUnwindSafe for CoseMac0
impl Send for CoseMac0
impl Sync for CoseMac0
impl Unpin for CoseMac0
impl UnwindSafe for CoseMac0
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