pub struct PublicKey(/* private fields */);
Available on crate feature
secp256k1
only.Expand description
A Secp256k1 public key.
Implementations§
Source§impl PublicKey
impl PublicKey
Sourcepub fn verify(&self, msg: &[u8], sig: &[u8]) -> bool
pub fn verify(&self, msg: &[u8], sig: &[u8]) -> bool
Verify the Secp256k1 signature on a message using the public key.
Sourcepub fn verify_hash(&self, msg: &[u8], sig: &[u8]) -> bool
pub fn verify_hash(&self, msg: &[u8], sig: &[u8]) -> bool
Verify the Secp256k1 DER-encoded signature on a raw 256-bit message using the public key.
Sourcepub fn to_bytes(&self) -> [u8; 33]
pub fn to_bytes(&self) -> [u8; 33]
Convert the public key to a byte buffer in compressed form, i.e. with one coordinate represented by a single bit.
Sourcepub fn to_bytes_uncompressed(&self) -> [u8; 65]
pub fn to_bytes_uncompressed(&self) -> [u8; 65]
Convert the public key to a byte buffer in uncompressed form.
Sourcepub fn try_from_bytes(k: &[u8]) -> Result<PublicKey, DecodingError>
pub fn try_from_bytes(k: &[u8]) -> Result<PublicKey, DecodingError>
Decode a public key from a byte slice in the format produced
by encode
.
Trait Implementations§
Source§impl Ord for PublicKey
impl Ord for PublicKey
Source§impl PartialOrd for PublicKey
impl PartialOrd for PublicKey
impl Eq 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