pub struct Signature(CoseSign1);
Expand description
A signature cryptographically attests to a (namespace, data) pair. The namespace is included in the signature object, the data is not. One data object can be signed multiple times, with different namespaces / by different signers, depending on the application needs.
Tuple Fields§
§0: CoseSign1
Implementations§
Source§impl Signature
impl Signature
fn inner(&self) -> &CoseSign1
fn namespace(&self) -> Result<SigningNamespace, CryptoError>
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(
&self,
serialized_message_bytes: &[u8],
verifying_key: &VerifyingKey,
namespace: &SigningNamespace,
) -> bool
pub fn verify( &self, serialized_message_bytes: &[u8], verifying_key: &VerifyingKey, namespace: &SigningNamespace, ) -> bool
Verifies the signature of the given serialized message bytes, created by
SigningKey::sign_detached
, for the given namespace. The namespace must match the one
used to create the signature.
The first anticipated consumer will be signed org memberships / emergency access: https://bitwarden.atlassian.net/browse/PM-17458
Trait Implementations§
Source§impl CoseSerializable for Signature
impl CoseSerializable for Signature
Auto Trait Implementations§
impl Freeze for Signature
impl RefUnwindSafe for Signature
impl Send for Signature
impl Sync for Signature
impl Unpin for Signature
impl UnwindSafe for Signature
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
§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