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: CoseSign1Implementations§
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 signed_by_id(&self) -> Result<KeyId, CryptoError>
pub fn signed_by_id(&self) -> Result<KeyId, CryptoError>
Returns the signing key ID from the COSE protected header.
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
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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>
Source§fn to_cose(&self) -> CoseSign1Bytes
fn to_cose(&self) -> CoseSign1Bytes
Source§impl Debug for SignedObject
impl Debug for SignedObject
Source§impl From<CoseSign1> for SignedObject
impl From<CoseSign1> for SignedObject
Source§impl PartialEq for SignedObject
impl PartialEq 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 UnsafeUnpin 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
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
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Arc<> Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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