Struct filament_crypto::VerificationKey
source · pub struct VerificationKey {
pub(crate) A_bytes: VerificationKeyBytes,
pub(crate) minus_A: EdwardsPoint,
}Expand description
A valid Ed25519 verification key.
This is also called a public key by other implementations.
This type holds decompressed state used in signature verification; if the
verification key may not be used immediately, it is probably better to use
VerificationKeyBytes, which is a refinement type for [u8; 32].
§Consensus properties
Ed25519 checks are described in §5.4.5 of the Zcash protocol specification and in
[ZIP 215]. The verification criteria for an (encoded) verification key A_bytes are:
A_bytesMUST be an encoding of a pointAon the twisted Edwards form of Curve25519, and non-canonical encodings MUST be accepted;
Fields§
§A_bytes: VerificationKeyBytes§minus_A: EdwardsPointImplementations§
source§impl VerificationKey
impl VerificationKey
sourcepub fn to_bytes(&self) -> [u8; 32]
pub fn to_bytes(&self) -> [u8; 32]
Returns the byte encoding of the verification key.
This is the same as .into(), but does not require type inference.
sourcepub fn verify(&self, signature: &Signature, msg: &[u8]) -> Result<(), Error>
pub fn verify(&self, signature: &Signature, msg: &[u8]) -> Result<(), Error>
Verify a purported signature on the given msg.
§Consensus properties
Ed25519 checks are described in §5.4.5 of the Zcash protocol specification and in
ZIP215. The verification criteria for an (encoded) signature (R_bytes, s_bytes) with
(encoded) verification key A_bytes are:
-
A_bytesandR_bytesMUST be encodings of pointsAandRrespectively on the twisted Edwards form of Curve25519, and non-canonical encodings MUST be accepted; -
s_bytesMUST represent an integersless thanl, the order of the prime-order subgroup of Curve25519; -
the verification equation
[8][s]B = [8]R + [8][k]AMUST be satisfied; -
the alternate verification equation
[s]B = R + [k]A, allowed by RFC 8032, MUST NOT be used.
Trait Implementations§
source§impl AsRef<[u8]> for VerificationKey
impl AsRef<[u8]> for VerificationKey
source§impl Clone for VerificationKey
impl Clone for VerificationKey
source§fn clone(&self) -> VerificationKey
fn clone(&self) -> VerificationKey
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for VerificationKey
impl Debug for VerificationKey
source§impl<'de> Deserialize<'de> for VerificationKey
impl<'de> Deserialize<'de> for VerificationKey
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<VerificationKey, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<VerificationKey, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl<'a> From<&'a SigningKey> for VerificationKey
impl<'a> From<&'a SigningKey> for VerificationKey
source§fn from(sk: &'a SigningKey) -> VerificationKey
fn from(sk: &'a SigningKey) -> VerificationKey
source§impl Hash for VerificationKey
impl Hash for VerificationKey
source§impl Ord for VerificationKey
impl Ord for VerificationKey
source§fn cmp(&self, other: &VerificationKey) -> Ordering
fn cmp(&self, other: &VerificationKey) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for VerificationKey
impl PartialEq for VerificationKey
source§fn eq(&self, other: &VerificationKey) -> bool
fn eq(&self, other: &VerificationKey) -> bool
self and other values to be equal, and is used
by ==.source§impl PartialOrd for VerificationKey
impl PartialOrd for VerificationKey
source§fn partial_cmp(&self, other: &VerificationKey) -> Option<Ordering>
fn partial_cmp(&self, other: &VerificationKey) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresource§impl Serialize for VerificationKey
impl Serialize for VerificationKey
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
source§impl TryFrom<&[u8]> for VerificationKey
impl TryFrom<&[u8]> for VerificationKey
source§impl TryFrom<VerificationKeyBytes> for VerificationKey
impl TryFrom<VerificationKeyBytes> for VerificationKey
source§fn try_from(
bytes: VerificationKeyBytes
) -> Result<VerificationKey, <VerificationKey as TryFrom<VerificationKeyBytes>>::Error>
fn try_from( bytes: VerificationKeyBytes ) -> Result<VerificationKey, <VerificationKey as TryFrom<VerificationKeyBytes>>::Error>
impl Copy for VerificationKey
impl Eq for VerificationKey
impl StructuralPartialEq for VerificationKey
Auto Trait Implementations§
impl RefUnwindSafe for VerificationKey
impl Send for VerificationKey
impl Sync for VerificationKey
impl Unpin for VerificationKey
impl UnwindSafe for VerificationKey
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
source§impl<T> ToHex for T
impl<T> ToHex for T
source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
self into the result. Lower case
letters are used (e.g. f9b4ca)source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
self into the result. Upper case
letters are used (e.g. F9B4CA)