Struct libp2p_identity::secp256k1::PublicKey
source · pub struct PublicKey(_);
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 encode(&self) -> [u8; 33]
👎Deprecated since 0.2.0: Renamed to PublicKey::to_bytes
.
pub fn encode(&self) -> [u8; 33]
PublicKey::to_bytes
.Encode the public key in compressed form, i.e. with one coordinate represented by a single bit.
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 encode_uncompressed(&self) -> [u8; 65]
👎Deprecated since 0.2.0: Renamed to PublicKey::to_bytes_uncompressed
.
pub fn encode_uncompressed(&self) -> [u8; 65]
PublicKey::to_bytes_uncompressed
.Encode the public key in uncompressed form.
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 decode(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 decode(k: &[u8]) -> Result<PublicKey, DecodingError>
PublicKey::try_from_bytes
instead.Decode a public key from a byte slice in the the format produced
by encode
.
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 the format produced
by encode
.
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