pub struct Signature(/* private fields */);
Expand description
Represents an ECDSA signature based on the secp256k1 curve with a recoverable public key.
This signature encodes the 2-bit recovery information into the
uppermost bits of MSB of the S value, which are never used by this ECDSA
instantiation over secp256k1.
The instance holds the byte array consisting of R
and S
values with the recovery bit
already embedded in S.
Implementations§
Source§impl Signature
impl Signature
pub fn new(raw_bytes: &[u8], recovery: u8) -> Signature
Sourcepub fn sign_message(message: &[u8], chain_keypair: &ChainKeypair) -> Signature
pub fn sign_message(message: &[u8], chain_keypair: &ChainKeypair) -> Signature
Signs the given message using the chain private key.
Sourcepub fn sign_hash(hash: &[u8], chain_keypair: &ChainKeypair) -> Signature
pub fn sign_hash(hash: &[u8], chain_keypair: &ChainKeypair) -> Signature
Signs the given hash using the raw private key.
Sourcepub fn verify_message(&self, message: &[u8], public_key: &PublicKey) -> bool
pub fn verify_message(&self, message: &[u8], public_key: &PublicKey) -> bool
Verifies this signature against the given message and a public key object
Sourcepub fn verify_hash(&self, hash: &[u8], public_key: &PublicKey) -> bool
pub fn verify_hash(&self, hash: &[u8], public_key: &PublicKey) -> bool
Verifies this signature against the given hash and a public key object
Sourcepub fn raw_signature(&self) -> ([u8; 64], u8)
pub fn raw_signature(&self) -> ([u8; 64], u8)
Returns the raw signature, without the encoded public key recovery bit and the recovery bit as a separate value.
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
impl Copy for Signature
impl Eq 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§
§impl<T, U> AsByteSlice<T> for U
impl<T, U> AsByteSlice<T> for U
fn as_byte_slice(&self) -> &[u8] ⓘ
§impl<U> AsSliceOf for U
impl<U> AsSliceOf for U
fn as_slice_of<T>(&self) -> Result<&[T], Error>where
T: FromByteSlice,
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> ToHex for Twhere
T: BytesRepresentable,
impl<T> ToHex for Twhere
T: BytesRepresentable,
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
)