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
sourceimpl 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
sourceimpl AsRef<[u8]> for VerificationKey
impl AsRef<[u8]> for VerificationKey
sourceimpl Clone for VerificationKey
impl Clone for VerificationKey
sourcefn clone(&self) -> VerificationKey
fn clone(&self) -> VerificationKey
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for VerificationKey
impl Debug for VerificationKey
sourceimpl<'de> Deserialize<'de> for VerificationKey
impl<'de> Deserialize<'de> for VerificationKey
sourcefn 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>,
sourceimpl<'a> From<&'a SigningKey> for VerificationKey
impl<'a> From<&'a SigningKey> for VerificationKey
sourcefn from(sk: &'a SigningKey) -> VerificationKey
fn from(sk: &'a SigningKey) -> VerificationKey
sourceimpl From<VerificationKey> for [u8; 32]
impl From<VerificationKey> for [u8; 32]
sourcefn from(vk: VerificationKey) -> [u8; 32]
fn from(vk: VerificationKey) -> [u8; 32]
sourceimpl From<VerificationKey> for VerificationKeyBytes
impl From<VerificationKey> for VerificationKeyBytes
sourcefn from(vk: VerificationKey) -> VerificationKeyBytes
fn from(vk: VerificationKey) -> VerificationKeyBytes
sourceimpl Serialize for VerificationKey
impl Serialize for VerificationKey
sourceimpl TryFrom<&[u8]> for VerificationKey
impl TryFrom<&[u8]> for VerificationKey
sourceimpl TryFrom<[u8; 32]> for VerificationKey
impl TryFrom<[u8; 32]> for VerificationKey
sourceimpl TryFrom<VerificationKeyBytes> for VerificationKey
impl TryFrom<VerificationKeyBytes> 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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<T> ToHex for Twhere
T: AsRef<[u8]>,
impl<T> ToHex for Twhere
T: AsRef<[u8]>,
sourcefn 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 moresourcefn 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