pub struct Signature { /* private fields */ }
Available on crate feature
signatures
only.Expand description
A digital signature.
Implementations§
Source§impl Signature
impl Signature
Sourcepub fn new(id: &str, bytes: &[u8]) -> Result<Signature, Error>
pub fn new(id: &str, bytes: &[u8]) -> Result<Signature, Error>
Creates a signature from raw bytes.
While a signature can be created directly using struct literal syntax, this constructor can be used to automatically determine the algorithm and version from a key identifier in the form algorithm:version, e.g. “ed25519:1”.
This constructor will ensure that the version does not contain characters that violate the
guidelines in the specification. Because it may be necessary to represent signatures with
versions that don’t adhere to these guidelines, it’s possible to simply use the struct
literal syntax to construct a Signature
with an arbitrary key.
§Parameters
- id: A key identifier, e.g. “ed25519:1”.
- bytes: The digital signature, as a series of bytes.
§Errors
Returns an error if:
- The key ID specifies an unknown algorithm.
- The key ID is malformed.
- The key ID contains a version with invalid characters.
Sourcepub fn base64(&self) -> String
pub fn base64(&self) -> String
A base64 encoding of the signature.
Uses the standard character set with no padding.
Trait Implementations§
impl Eq for Signature
impl StructuralPartialEq 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.