Struct threshold_crypto::PublicKey
source · pub struct PublicKey(_);
Expand description
A public key.
Implementations§
source§impl 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) -> bool
pub fn verify<M: AsRef<[u8]>>(&self, sig: &Signature, msg: M) -> bool
Returns true
if the signature matches the message.
This is equivalent to verify_g2(sig, hash_g2(msg))
.
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: Rng, M: AsRef<[u8]>>(
&self,
rng: &mut R,
msg: M
) -> Ciphertext
pub fn encrypt_with_rng<R: Rng, M: AsRef<[u8]>>(
&self,
rng: &mut R,
msg: M
) -> Ciphertext
Encrypts the message.
Trait Implementations§
source§impl<'de> Deserialize<'de> for PublicKey
impl<'de> Deserialize<'de> for PublicKey
source§fn 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