pub struct VerificationKey { /* private fields */ }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;
Implementations§
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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for VerificationKey
Source§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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for VerificationKey
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 From<VerificationKey> for VerificationKeyBytes
impl From<VerificationKey> for VerificationKeyBytes
Source§fn from(vk: VerificationKey) -> VerificationKeyBytes
fn from(vk: VerificationKey) -> VerificationKeyBytes
Source§impl Hash for VerificationKey
impl Hash for VerificationKey
Source§impl Ord for VerificationKey
impl Ord for VerificationKey
1.21.0 (const: unstable) · 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§impl PartialOrd for VerificationKey
impl PartialOrd for VerificationKey
Source§impl Serialize for VerificationKey
impl Serialize for VerificationKey
impl StructuralPartialEq for VerificationKey
Source§impl TryFrom<&[u8]> for VerificationKey
impl TryFrom<&[u8]> for VerificationKey
Auto Trait Implementations§
impl Freeze for VerificationKey
impl RefUnwindSafe for VerificationKey
impl Send for VerificationKey
impl Sync for VerificationKey
impl Unpin for VerificationKey
impl UnsafeUnpin 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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)