[][src]Struct ed25519_zebra::VerificationKey

pub struct VerificationKey { /* fields omitted */ }

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 prime l, per libsodium 1.0.15 crypto_sign/ed25519/ref10/open.c:126;

  • R MUST NOT be one of the excluded encodings, per libsodium 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 the VerificationKey type.

Trait Implementations

impl AsRef<[u8]> for VerificationKey[src]

impl Clone for VerificationKey[src]

impl Copy for VerificationKey[src]

impl Debug for VerificationKey[src]

impl<'de> Deserialize<'de> for VerificationKey[src]

impl<'a> From<&'a SigningKey> for VerificationKey[src]

impl From<VerificationKey> for VerificationKeyBytes[src]

impl From<VerificationKey> for [u8; 32][src]

impl Serialize for VerificationKey[src]

impl<'_> TryFrom<&'_ [u8]> for VerificationKey[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 32]> for VerificationKey[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<VerificationKeyBytes> for VerificationKey[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToHex for T where
    T: AsRef<[u8]>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.