[][src]Struct solana_libra_nextgen_crypto::bls12381::BLS12381PublicKey

pub struct BLS12381PublicKey(_);

A BLS12-381 public key

Methods

impl BLS12381PublicKey[src]

pub fn to_bytes(&self) -> [u8; 48][src]

Serializes a BLS12381PublicKey

Methods from Deref<Target = PublicKey>

pub fn verify_g2<H>(&self, sig: &Signature, hash: H) -> bool where
    H: Into<G2Affine>, 
[src]

Returns true if the signature matches the element of G2.

pub fn verify<M>(&self, sig: &Signature, msg: M) -> bool where
    M: AsRef<[u8]>, 
[src]

Returns true if the signature matches the message.

This is equivalent to verify_g2(sig, hash_g2(msg)).

pub fn encrypt<M>(&self, msg: M) -> Ciphertext where
    M: AsRef<[u8]>, 
[src]

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().

pub fn encrypt_with_rng<R, M>(&self, rng: &mut R, msg: M) -> Ciphertext where
    M: AsRef<[u8]>,
    R: Rng
[src]

Encrypts the message.

pub fn to_bytes(&self) -> [u8; 48][src]

Returns a byte string representation of the public key.

Trait Implementations

impl ValidKey for BLS12381PublicKey[src]

fn validate(&self) -> Result<(), CryptoMaterialError>[src]

TryFrom is the source of truth on whether we can build a valid key. => we can use it once we've built, to validate! Read more

impl PublicKey for BLS12381PublicKey[src]

type PrivateKeyMaterial = BLS12381PrivateKey

We require public / private types to be coupled, i.e. their associated type is each other. Read more

impl VerifyingKey for BLS12381PublicKey[src]

type SigningKeyMaterial = BLS12381PrivateKey

The associated signing key type for this verifying key.

type SignatureMaterial = BLS12381Signature

The associated signature type for this verifying key.

fn verify_signature(
    &self,
    message: &HashValue,
    signature: &Self::SignatureMaterial
) -> Result<()>
[src]

We provide the logical implementation which dispatches to the signature.

fn batch_verify_signatures(
    message: &HashValue,
    keys_and_signatures: Vec<(Self, Self::SignatureMaterial)>
) -> Result<()>
[src]

We provide the implementation which dispatches to the signature.

impl Clone for BLS12381PublicKey[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'_> From<&'_ BLS12381PrivateKey> for BLS12381PublicKey[src]

impl PartialEq<BLS12381PublicKey> for BLS12381PublicKey[src]

impl Eq for BLS12381PublicKey[src]

impl Display for BLS12381PublicKey[src]

impl Debug for BLS12381PublicKey[src]

impl Deref for BLS12381PublicKey[src]

type Target = PublicKey

The resulting type after dereferencing.

impl Hash for BLS12381PublicKey[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl<'_> TryFrom<&'_ [u8]> for BLS12381PublicKey[src]

type Error = CryptoMaterialError

The type returned in the event of a conversion error.

impl Serialize for BLS12381PublicKey[src]

impl<'de> Deserialize<'de> for BLS12381PublicKey[src]

Auto Trait Implementations

Blanket Implementations

impl<T> ValidKeyStringExt for T where
    T: ValidKey
[src]

fn from_encoded_string(encoded_str: &str) -> Result<Self, CryptoMaterialError>[src]

When trying to convert from bytes, we simply decode the string into bytes before checking if we can convert. Read more

fn to_encoded_string(&self) -> Result<String>[src]

A function to encode into hex-string after serializing.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> TestOnlyHash for T where
    T: Serialize + ?Sized

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,