pub struct PublicKey { /* private fields */ }Expand description
Public key for ECDSA signature verification over secp256k1 curve.
Implementations§
Source§impl PublicKey
impl PublicKey
Sourcepub fn to_commitment(&self) -> Word
pub fn to_commitment(&self) -> Word
Returns a commitment to the public key using the RPO256 hash function.
The commitment is computed by first converting the public key to field elements (4 bytes per element), and then computing a sequential hash of the elements.
Sourcepub fn verify(&self, message: Word, signature: &Signature) -> bool
pub fn verify(&self, message: Word, signature: &Signature) -> bool
Verifies a signature against this public key and message.
Sourcepub fn verify_prehash(
&self,
message_digest: [u8; 32],
signature: &Signature,
) -> bool
pub fn verify_prehash( &self, message_digest: [u8; 32], signature: &Signature, ) -> bool
Verifies a signature against this public key and pre-hashed message.
Sourcepub fn recover_from(
message: Word,
signature: &Signature,
) -> Result<PublicKey, PublicKeyError>
pub fn recover_from( message: Word, signature: &Signature, ) -> Result<PublicKey, PublicKeyError>
Recovers from the signature the public key associated to the secret key used to sign the message.
Trait Implementations§
Source§impl Deserializable for PublicKey
impl Deserializable for PublicKey
Source§fn read_from<R>(source: &mut R) -> Result<PublicKey, DeserializationError>where
R: ByteReader,
fn read_from<R>(source: &mut R) -> Result<PublicKey, DeserializationError>where
R: ByteReader,
Reads a sequence of bytes from the provided
source, attempts to deserialize these bytes
into Self, and returns the result. Read moreSource§fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>
fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>
Source§impl SequentialCommit for PublicKey
impl SequentialCommit for PublicKey
Source§type Commitment = Word
type Commitment = Word
A type of the commitment which must be derivable from Word.
Source§fn to_elements(&self) -> Vec<BaseElement>
fn to_elements(&self) -> Vec<BaseElement>
Returns a representation of the object as a sequence of fields elements.
Source§fn to_commitment(&self) -> Self::Commitment
fn to_commitment(&self) -> Self::Commitment
Computes the commitment to the object. Read more
Source§impl Serializable for PublicKey
impl Serializable for PublicKey
Source§fn write_into<W>(&self, target: &mut W)where
W: ByteWriter,
fn write_into<W>(&self, target: &mut W)where
W: ByteWriter,
Serializes
self into bytes and writes these bytes into the target.Source§fn get_size_hint(&self) -> usize
fn get_size_hint(&self) -> usize
Returns an estimate of how many bytes are needed to represent self. Read more
impl Eq for PublicKey
impl StructuralPartialEq for PublicKey
Auto Trait Implementations§
impl Freeze for PublicKey
impl RefUnwindSafe for PublicKey
impl Send for PublicKey
impl Sync for PublicKey
impl Unpin for PublicKey
impl UnwindSafe for PublicKey
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