pub struct SignedObject(/* private fields */);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.
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.
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.
Trait Implementations§
Source§impl Clone for SignedObject
impl Clone for SignedObject
Source§fn clone(&self) -> SignedObject
fn clone(&self) -> SignedObject
Returns a duplicate 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<CoseSign1ContentFormat> for SignedObject
impl CoseSerializable<CoseSign1ContentFormat> for SignedObject
Source§fn from_cose(bytes: &CoseSign1Bytes) -> Result<Self, EncodingError>
fn from_cose(bytes: &CoseSign1Bytes) -> Result<Self, EncodingError>
Deserializes a serialized COSE object to a struct
Source§fn to_cose(&self) -> CoseSign1Bytes
fn to_cose(&self) -> CoseSign1Bytes
Serializes the struct to COSE serialization
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§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