pub struct PublicKey(_);
Expand description
A public key.
Implementations
sourceimpl PublicKey
impl PublicKey
sourcepub fn verify_g2<H: Into<G2Affine>>(&self, sig: &Signature, hash: H) -> bool
pub fn verify_g2<H: Into<G2Affine>>(&self, sig: &Signature, hash: H) -> bool
Returns true
if the signature matches the element of G2
.
sourcepub fn verify<M: AsRef<[u8]>>(&self, sig: &Signature, msg: M) -> Result<()>
pub fn verify<M: AsRef<[u8]>>(&self, sig: &Signature, msg: M) -> Result<()>
Returns true
if the signature matches the message.
sourcepub fn encrypt<M: AsRef<[u8]>>(&self, msg: M) -> Ciphertext
pub fn encrypt<M: AsRef<[u8]>>(&self, msg: M) -> Ciphertext
Encrypts the message using the OS random number generator.
Uses the OsRng
by default. To pass in a custom random number generator, use
encrypt_with_rng()
.
sourcepub fn encrypt_with_rng<R: RngCore, M: AsRef<[u8]>>(
&self,
rng: &mut R,
msg: M
) -> Ciphertext
pub fn encrypt_with_rng<R: RngCore, M: AsRef<[u8]>>(
&self,
rng: &mut R,
msg: M
) -> Ciphertext
Encrypts the message.
sourcepub fn derive_child(&self, index: &[u8]) -> Self
pub fn derive_child(&self, index: &[u8]) -> Self
Derives a child public key for a given index.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for PublicKey
impl<'de> Deserialize<'de> for PublicKey
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Ord for PublicKey
impl Ord for PublicKey
sourceimpl PartialOrd<PublicKey> for PublicKey
impl PartialOrd<PublicKey> for PublicKey
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn 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 more
impl Copy for PublicKey
impl Eq for PublicKey
impl StructuralEq for PublicKey
impl StructuralPartialEq 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more