Struct libp2p_identity::ecdsa::PublicKey
source · pub struct PublicKey(_);
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 from_bytes(k: &[u8]) -> Result<PublicKey, DecodingError>
👎Deprecated since 0.2.0: This method name does not follow Rust naming conventions, use PublicKey::try_from_bytes
instead.
pub fn from_bytes(k: &[u8]) -> Result<PublicKey, DecodingError>
PublicKey::try_from_bytes
instead.Decode a public key from a byte buffer containing raw components of a key with or without compression.
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 decode_der(k: &[u8]) -> Result<PublicKey, DecodingError>
👎Deprecated since 0.2.0: This method name does not follow Rust naming conventions, use PublicKey::try_decode_der
instead.
pub fn decode_der(k: &[u8]) -> Result<PublicKey, DecodingError>
PublicKey::try_decode_der
instead.Decode 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 From<PublicKey> for PublicKey
Available on crate features ecdsa
or secp256k1
or ed25519
or rsa
only.
impl From<PublicKey> for PublicKey
Available on crate features
ecdsa
or secp256k1
or ed25519
or rsa
only.source§impl Ord for PublicKey
impl Ord for PublicKey
source§impl PartialEq<PublicKey> for PublicKey
impl PartialEq<PublicKey> for PublicKey
source§impl PartialOrd<PublicKey> for PublicKey
impl PartialOrd<PublicKey> for PublicKey
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl TryInto<PublicKey> for PublicKey
Available on crate features ecdsa
or secp256k1
or ed25519
or rsa
only.
impl TryInto<PublicKey> for PublicKey
Available on crate features
ecdsa
or secp256k1
or ed25519
or rsa
only.impl Eq for PublicKey
impl StructuralEq for PublicKey
Auto Trait Implementations§
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