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 Default for VerificationKey
impl Default for VerificationKey
source§fn default() -> VerificationKey
fn default() -> 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>,
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 Serialize for VerificationKey
impl Serialize for VerificationKey
source§impl TryFrom<&[u8]> for VerificationKey
impl TryFrom<&[u8]> for VerificationKey
source§impl Verifier<Signature> for VerificationKey
impl Verifier<Signature> for VerificationKey
impl Copy for VerificationKey
impl DefaultIsZeroes 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 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
)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
)