pub struct PublicKey(/* private fields */);
Available on crate feature
ecdsa
only.Expand description
An ECDSA 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 an ECDSA signature on a message using the public key.
Sourcepub fn try_from_bytes(k: &[u8]) -> Result<PublicKey, DecodingError>
pub fn try_from_bytes(k: &[u8]) -> Result<PublicKey, DecodingError>
Try to parse a public key from a byte buffer containing raw components of a key with or without compression.
Sourcepub fn to_bytes(&self) -> Vec<u8>
pub fn to_bytes(&self) -> Vec<u8>
Convert a public key into a byte buffer containing raw components of the key without compression.
Sourcepub fn encode_der(&self) -> Vec<u8>
pub fn encode_der(&self) -> Vec<u8>
Encode a public key into a DER encoded byte buffer as defined by SEC1 standard.
Sourcepub fn try_decode_der(k: &[u8]) -> Result<PublicKey, DecodingError>
pub fn try_decode_der(k: &[u8]) -> Result<PublicKey, DecodingError>
Try to decode a public key from a DER encoded byte buffer as defined by SEC1 standard.
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