pub struct Signature { /* private fields */ }
Expand description
A cryptographic signature.
Implementations§
Source§impl Signature
impl Signature
pub const fn zero() -> Self
Sourcepub fn sign(
data: Hash256,
private_key: &PrivateKey,
) -> Result<Self, CryptoError>
pub fn sign( data: Hash256, private_key: &PrivateKey, ) -> Result<Self, CryptoError>
Creates a new signature from the given data and keys.
Sourcepub fn verify(
&self,
data: Hash256,
public_key: &PublicKey,
) -> Result<(), CryptoError>
pub fn verify( &self, data: Hash256, public_key: &PublicKey, ) -> Result<(), CryptoError>
Verifies the signature against the given data and public key.
Sourcepub fn recover(&self, data: Hash256) -> Result<PublicKey, CryptoError>
pub fn recover(&self, data: Hash256) -> Result<PublicKey, CryptoError>
Recover a public key from the given signature.
Sourcepub fn from_array(bytes: [u8; 65]) -> Self
pub fn from_array(bytes: [u8; 65]) -> Self
Constructs a signature from the given bytes, but does not verify its validity.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Signature
impl<'de> Deserialize<'de> for Signature
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Signature
impl Ord for Signature
Source§impl PartialOrd for Signature
impl PartialOrd for Signature
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> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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.Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self
into the result. Lower case
letters are used (e.g. f9b4ca
)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self
into the result. Upper case
letters are used (e.g. F9B4CA
)