pub struct CoseSign {
pub protected: ProtectedHeader,
pub unprotected: Header,
pub payload: Option<Vec<u8>>,
pub signatures: Vec<CoseSignature>,
}
Expand description
Signed payload with signatures.
COSE_Sign = [
Headers,
payload : bstr / nil,
signatures : [+ COSE_Signature]
]
Fields§
§protected: ProtectedHeader
§unprotected: Header
§payload: Option<Vec<u8>>
§signatures: Vec<CoseSignature>
Implementations§
source§impl CoseSign
impl CoseSign
sourcepub fn verify_signature<F, E>(
&self,
which: usize,
aad: &[u8],
verifier: F,
) -> Result<(), E>
pub fn verify_signature<F, E>( &self, which: usize, aad: &[u8], verifier: F, ) -> Result<(), E>
Verify the indicated signature value, using verifier
on the signature value and serialized
data (in that order).
§Panics
This method will panic if which
is >= self.signatures.len()
.
sourcepub fn verify_detached_signature<F, E>(
&self,
which: usize,
payload: &[u8],
aad: &[u8],
verifier: F,
) -> Result<(), E>
pub fn verify_detached_signature<F, E>( &self, which: usize, payload: &[u8], aad: &[u8], verifier: F, ) -> Result<(), E>
Verify the indicated signature value for a detached payload, using verifier
on the
signature value and serialized data (in that order).
§Panics
This method will panic if which
is >= self.signatures.len()
.
This method will panic if self.payload.is_some()
.
sourcepub fn tbs_data(&self, aad: &[u8], sig: &CoseSignature) -> Vec<u8>
pub fn tbs_data(&self, aad: &[u8], sig: &CoseSignature) -> Vec<u8>
Construct the to-be-signed data for this object.
sourcepub fn tbs_detached_data(
&self,
payload: &[u8],
aad: &[u8],
sig: &CoseSignature,
) -> Vec<u8>
pub fn tbs_detached_data( &self, payload: &[u8], aad: &[u8], sig: &CoseSignature, ) -> Vec<u8>
Construct the to-be-signed data for this object, using a detached payload.
§Panics
This method will panic if self.payload.is_some()
.
Trait Implementations§
source§impl AsCborValue for CoseSign
impl AsCborValue for CoseSign
source§impl CborSerializable for CoseSign
impl CborSerializable for CoseSign
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 for CoseSign
impl PartialEq for CoseSign
source§impl TaggedCborSerializable for CoseSign
impl TaggedCborSerializable for CoseSign
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 CoseSign
Auto Trait Implementations§
impl Freeze for CoseSign
impl RefUnwindSafe for CoseSign
impl Send for CoseSign
impl Sync for CoseSign
impl Unpin for CoseSign
impl UnwindSafe for CoseSign
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)