Struct ed25519_zebra::VerificationKey
source · 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]
.
Zcash-specific 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_bytes
MUST be an encoding of a pointA
on the twisted Edwards form of Curve25519, and non-canonical encodings MUST be accepted;
Implementations§
source§impl VerificationKey
impl VerificationKey
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
.
Zcash-specific 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_bytes
andR_bytes
MUST be encodings of pointsA
andR
respectively on the twisted Edwards form of Curve25519, and non-canonical encodings MUST be accepted; -
s_bytes
MUST represent an integers
less thanl
, the order of the prime-order subgroup of Curve25519; -
the verification equation
[8][s]B = [8]R + [8][k]A
MUST 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<'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 TryFrom<&[u8]> for VerificationKey
impl TryFrom<&[u8]> for VerificationKey
impl Copy 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> ToHex for Twhere
T: AsRef<[u8]>,
impl<T> ToHex for Twhere
T: AsRef<[u8]>,
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
) Read moresource§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
) Read more