[−][src]Struct ed25519_zebra::VerificationKey
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. However, it is not clear that the protocol specification
matches the implementation in libsodium
1.0.15
used by zcashd
. Note
that the precise version is important because libsodium
changed validation
rules in point releases.
The spec says that a verification key A
is
a point of order
l
on the Ed25519 curve, in the encoding specified by…
but libsodium
1.0.15
does not check this. Instead it only checks whether
the encoding of A
is an encoding of a point on the curve and that the
encoding is not all zeros. This implementation matches the libsodium
behavior. This has implications for signature verification behaviour, as noted
in the VerificationKey::verify
documentation.
Implementations
impl VerificationKey
[src]
pub fn verify(&self, signature: &Signature, msg: &[u8]) -> Result<(), Error>
[src]
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. Ed25519 validation is not well-specified, and the original
implementation of JoinSplit signatures for zcashd
inherited its precise
validation rules from a specific build configuration of libsodium
1.0.15
. Note that the precise version is important because libsodium
changed validation rules in point releases.
The additional validation checks are that:
-
s
MUST represent an integer less than the primel
, perlibsodium
1.0.15
crypto_sign/ed25519/ref10/open.c:126
; -
R
MUST NOT be one of the excluded encodings, perlibsodium
1.0.15
crypto_sign/ed25519/ref10/open.c:127
; -
The public key bytes must not be all 0, per
libsodium
1.0.15
crypto_sign/ed25519/ref10/open.c:138-143
, which we maintain as an invariant on theVerificationKey
type.
Trait Implementations
impl AsRef<[u8]> for VerificationKey
[src]
impl Clone for VerificationKey
[src]
fn clone(&self) -> VerificationKey
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for VerificationKey
[src]
impl Debug for VerificationKey
[src]
impl<'de> Deserialize<'de> for VerificationKey
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<'a> From<&'a SigningKey> for VerificationKey
[src]
fn from(sk: &'a SigningKey) -> VerificationKey
[src]
impl From<VerificationKey> for VerificationKeyBytes
[src]
fn from(vk: VerificationKey) -> VerificationKeyBytes
[src]
impl From<VerificationKey> for [u8; 32]
[src]
impl Serialize for VerificationKey
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'_> TryFrom<&'_ [u8]> for VerificationKey
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(slice: &[u8]) -> Result<VerificationKey, Error>
[src]
impl TryFrom<[u8; 32]> for VerificationKey
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(bytes: [u8; 32]) -> Result<Self, Self::Error>
[src]
impl TryFrom<VerificationKeyBytes> for VerificationKey
[src]
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToHex for T where
T: AsRef<[u8]>,
[src]
T: AsRef<[u8]>,
fn encode_hex<U>(&self) -> U where
U: FromIterator<char>,
[src]
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> U where
U: FromIterator<char>,
[src]
U: FromIterator<char>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,