pub struct SignedObject(pub(crate) CoseSign1);
Expand description
A signed object is a message containing a payload and signature that attests the payload’s integrity and authenticity for a specific namespace and signature key. In order to gain access to the payload, the caller must provide the correct namespace and verifying key, ensuring that the caller cannot forget to validate the signature before using the payload.
Tuple Fields§
§0: CoseSign1
Implementations§
Source§impl SignedObject
impl SignedObject
Sourcepub fn content_type(&self) -> Result<CoapContentFormat, CryptoError>
pub fn content_type(&self) -> Result<CoapContentFormat, CryptoError>
Parses the signature headers and returns the content type of the signed data. The content type indicates how the serialized message that was signed was encoded.
fn inner(&self) -> &CoseSign1
fn namespace(&self) -> Result<SigningNamespace, CryptoError>
fn payload(&self) -> Result<Vec<u8>, CryptoError>
Sourcepub fn verify_and_unwrap<Message: DeserializeOwned>(
&self,
verifying_key: &VerifyingKey,
namespace: &SigningNamespace,
) -> Result<Message, CryptoError>
pub fn verify_and_unwrap<Message: DeserializeOwned>( &self, verifying_key: &VerifyingKey, namespace: &SigningNamespace, ) -> Result<Message, CryptoError>
Verifies the signature of the signed object and returns the payload, if the signature is valid.
Sourcefn verify_and_unwrap_bytes(
&self,
verifying_key: &VerifyingKey,
namespace: &SigningNamespace,
) -> Result<Vec<u8>, CryptoError>
fn verify_and_unwrap_bytes( &self, verifying_key: &VerifyingKey, namespace: &SigningNamespace, ) -> Result<Vec<u8>, CryptoError>
Verifies the signature of the signed object and returns the payload as raw bytes, if the signature is valid.
Trait Implementations§
Source§impl Clone for SignedObject
impl Clone for SignedObject
Source§fn clone(&self) -> SignedObject
fn clone(&self) -> SignedObject
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 CoseSerializable for SignedObject
impl CoseSerializable for SignedObject
Source§impl Debug for SignedObject
impl Debug for SignedObject
Auto Trait Implementations§
impl Freeze for SignedObject
impl RefUnwindSafe for SignedObject
impl Send for SignedObject
impl Sync for SignedObject
impl Unpin for SignedObject
impl UnwindSafe for SignedObject
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,
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
Create a new handle for an Arc value Read more
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
Clone a handle Read more
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Consume a handle, getting back the initial
Arc<>
Read moreSource§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more