pub struct Signature(/* private fields */);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.
Implementations§
Source§impl Signature
impl Signature
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<CoseSign1ContentFormat> for Signature
impl CoseSerializable<CoseSign1ContentFormat> for Signature
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
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
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