Skip to main content

Ed25519VerifyKey

Struct Ed25519VerifyKey 

Source
pub struct Ed25519VerifyKey { /* private fields */ }
Expand description

A public key with its point already recovered.

Verification needs the public key as a curve point, and decompressing one is a field exponentiation – about two microseconds, against the twenty a verification takes. A key used more than once should not pay that more than once, which is the same reason Ed25519Key exists on the signing side.

The point is stored negated, because the equation verification checks is [S]B + [k](-A) == R, so that is the form every signature wants.

Ed25519::verify builds one of these and throws it away, which is the right thing for a caller with one signature and the wrong thing for a caller with many.

Implementations§

Source§

impl Ed25519VerifyKey

Source

pub fn from_bytes(public_key: &[u8]) -> Result<Self>

Decompress public_key, rejecting anything not on the curve.

Source

pub fn as_bytes(&self) -> &[u8; 32]

The key as it was given.

Source

pub fn verify(&self, message: &[u8], signature: &[u8]) -> Result<()>

Verify signature over message.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.