[−][src]Struct solana_libra_nextgen_crypto::bls12381::BLS12381PublicKey
A BLS12-381 public key
Methods
impl BLS12381PublicKey
[src]
Methods from Deref<Target = PublicKey>
pub fn verify_g2<H>(&self, sig: &Signature, hash: H) -> bool where
H: Into<G2Affine>,
[src]
H: Into<G2Affine>,
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]
M: AsRef<[u8]>,
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]
M: AsRef<[u8]>,
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]
M: AsRef<[u8]>,
R: Rng,
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 to_bytes(&self) -> Vec<u8>
[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
fn length() -> usize
[src]
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]
&self,
message: &HashValue,
signature: &Self::SignatureMaterial
) -> Result<()>
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]
message: &HashValue,
keys_and_signatures: Vec<(Self, Self::SignatureMaterial)>
) -> Result<()>
We provide the implementation which dispatches to the signature.
impl Clone for BLS12381PublicKey
[src]
fn clone(&self) -> 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]
fn from(secret_key: &BLS12381PrivateKey) -> Self
[src]
impl PartialEq<BLS12381PublicKey> for BLS12381PublicKey
[src]
fn eq(&self, other: &BLS12381PublicKey) -> bool
[src]
fn ne(&self, other: &BLS12381PublicKey) -> bool
[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.
fn deref(&self) -> &Self::Target
[src]
impl Hash for BLS12381PublicKey
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
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.
fn try_from(bytes: &[u8]) -> Result<BLS12381PublicKey, CryptoMaterialError>
[src]
impl Serialize for BLS12381PublicKey
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de> Deserialize<'de> for BLS12381PublicKey
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
impl Sync for BLS12381PublicKey
impl Send for BLS12381PublicKey
impl Unpin for BLS12381PublicKey
impl RefUnwindSafe for BLS12381PublicKey
impl UnwindSafe for BLS12381PublicKey
Blanket Implementations
impl<T> ValidKeyStringExt for T where
T: ValidKey,
[src]
T: ValidKey,
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]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> TestOnlyHash for T where
T: Serialize + ?Sized,
T: Serialize + ?Sized,
fn test_only_hash(&self) -> HashValue
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,