pub struct PublicKey(/* private fields */);Expand description
A Secp256k1 public key, used for verification of signatures
Implementations§
Source§impl PublicKey
impl PublicKey
Sourcepub fn as_ptr(&self) -> *const PublicKey
pub fn as_ptr(&self) -> *const PublicKey
Obtains a raw const pointer suitable for use with FFI functions
Sourcepub fn as_mut_ptr(&mut self) -> *mut PublicKey
pub fn as_mut_ptr(&mut self) -> *mut PublicKey
Obtains a raw mutable pointer suitable for use with FFI functions
Sourcepub fn from_secret_key<C>(secp: &Secp256k1<C>, sk: &SecretKey) -> PublicKeywhere
C: Signing,
pub fn from_secret_key<C>(secp: &Secp256k1<C>, sk: &SecretKey) -> PublicKeywhere
C: Signing,
Creates a new public key from a secret key.
Sourcepub fn from_slice(data: &[u8]) -> Result<PublicKey, Error>
pub fn from_slice(data: &[u8]) -> Result<PublicKey, Error>
Creates a public key directly from a slice
Sourcepub fn serialize(&self) -> [u8; 33]
pub fn serialize(&self) -> [u8; 33]
Serialize the key as a byte-encoded pair of values. In compressed form the y-coordinate is represented by only a single bit, as x determines it up to one bit.
Sourcepub fn serialize_uncompressed(&self) -> [u8; 65]
pub fn serialize_uncompressed(&self) -> [u8; 65]
Serialize the key as a byte-encoded pair of values, in uncompressed form
Sourcepub fn negate_assign<C>(&mut self, secp: &Secp256k1<C>)where
C: Verification,
pub fn negate_assign<C>(&mut self, secp: &Secp256k1<C>)where
C: Verification,
Negates the pk to the pk self in place
Will return an error if the pk would be invalid.
Sourcepub fn add_exp_assign<C>(
&mut self,
secp: &Secp256k1<C>,
other: &[u8],
) -> Result<(), Error>where
C: Verification,
pub fn add_exp_assign<C>(
&mut self,
secp: &Secp256k1<C>,
other: &[u8],
) -> Result<(), Error>where
C: Verification,
Adds the pk corresponding to other to the pk self in place
Will return an error if the resulting key would be invalid or
if the tweak was not a 32-byte length slice.
Sourcepub fn mul_assign<C>(
&mut self,
secp: &Secp256k1<C>,
other: &[u8],
) -> Result<(), Error>where
C: Verification,
pub fn mul_assign<C>(
&mut self,
secp: &Secp256k1<C>,
other: &[u8],
) -> Result<(), Error>where
C: Verification,
Muliplies the pk self in place by the scalar other
Will return an error if the resulting key would be invalid or
if the tweak was not a 32-byte length slice.
Trait Implementations§
impl Copy for PublicKey
impl Eq for PublicKey
Source§impl Ord for PublicKey
impl Ord for PublicKey
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for PublicKey
impl PartialOrd 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 UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.