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>
👎Deprecated: Use verify_payload_tag() to ensure payload is present
pub fn verify_tag<F, E>(&self, external_aad: &[u8], verify: F) -> 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.
Sourcepub fn verify_payload_tag<F, E, G>(
&self,
external_aad: &[u8],
missing_payload_error: G,
verify: F,
) -> Result<(), E>
pub fn verify_payload_tag<F, E, G>( &self, external_aad: &[u8], missing_payload_error: G, verify: F, ) -> 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).
If the CoseMac
has no payload, then missing_payload_error()
will
be returned.
Trait Implementations§
Source§impl AsCborValue for CoseMac
impl AsCborValue for CoseMac
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 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 Freeze for CoseMac
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