Struct fog_crypto::identity::UnverifiedSignature
source · pub struct UnverifiedSignature { /* private fields */ }
Expand description
A signature that has been read from a byte slice but hasn’t been verified yet.
Verification can be done by getting the appropriate version of hash into the verify(...)
function.
Example
let data = b"I am some test data";
// ...
let unverified = UnverifiedSignature::try_from(&encoded[..])?;
let hash_version = unverified.hash_version();
let hash = Hash::with_version(&data[..], hash_version)?;
match unverified.verify(&hash) {
Ok(verified) => {
println!("Got valid signature, signed by {}", verified.signer());
},
Err(_) => {
println!("Signature failed validation");
}
}
Implementations§
source§impl UnverifiedSignature
impl UnverifiedSignature
sourcepub fn hash_version(&self) -> u8
pub fn hash_version(&self) -> u8
Get the version of hash needed to complete the signature.
Trait Implementations§
source§impl Clone for UnverifiedSignature
impl Clone for UnverifiedSignature
source§fn clone(&self) -> UnverifiedSignature
fn clone(&self) -> UnverifiedSignature
Returns a copy 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 Debug for UnverifiedSignature
impl Debug for UnverifiedSignature
source§impl PartialEq<UnverifiedSignature> for UnverifiedSignature
impl PartialEq<UnverifiedSignature> for UnverifiedSignature
source§fn eq(&self, other: &UnverifiedSignature) -> bool
fn eq(&self, other: &UnverifiedSignature) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl TryFrom<&[u8]> for UnverifiedSignature
impl TryFrom<&[u8]> for UnverifiedSignature
impl Eq for UnverifiedSignature
impl StructuralEq for UnverifiedSignature
impl StructuralPartialEq for UnverifiedSignature
Auto Trait Implementations§
impl RefUnwindSafe for UnverifiedSignature
impl Send for UnverifiedSignature
impl Sync for UnverifiedSignature
impl Unpin for UnverifiedSignature
impl UnwindSafe for UnverifiedSignature
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