Skip to main content

Ed25519phSigner

Struct Ed25519phSigner 

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

Multi-part Ed25519ph (prehashed Ed25519, RFC 8032) signer and verifier.

This is libsodium’s crypto_sign_init/crypto_sign_update/ crypto_sign_final_create/crypto_sign_final_verify interface: the message is fed in parts, hashed with SHA-512, and the digest is signed. Ed25519ph is a different signature scheme from Ed25519, not an incremental way to compute the same signature: signatures from Ed25519phSigner::finalize do not verify with plain Ed25519 verification (SignedMessage::verify, crypto_sign_verify_detached), and Ed25519 signatures from SigningKeyPair::sign do not verify with Ed25519phSigner::verify. Use it only when both sides agree on Ed25519ph.

Implementations§

Source§

impl Ed25519phSigner

Source

pub fn new() -> Self

Returns a new Ed25519ph signer with an empty message.

Source

pub fn update<Message: Bytes + ?Sized>(&mut self, message: &Message)

Appends message to the message being signed or verified.

Source

pub fn finalize<Signature: NewByteArray<CRYPTO_SIGN_BYTES>, SecretKey: ByteArray<CRYPTO_SIGN_SECRETKEYBYTES>>( self, secret_key: &SecretKey, ) -> Signature

Finalizes this signer with secret_key, returning the Ed25519ph signature of the accumulated message.

Source

pub fn verify<Signature: ByteArray<CRYPTO_SIGN_BYTES>, PublicKey: ByteArray<CRYPTO_SIGN_PUBLICKEYBYTES>>( self, signature: &Signature, public_key: &PublicKey, ) -> Result<(), Error>

Verifies that signature is a valid Ed25519ph signature of the accumulated message for public_key.

§Errors

Returns an error if signature is not a valid Ed25519ph signature for the accumulated message and public_key, including when it is a plain Ed25519 signature of that message.

Trait Implementations§

Source§

impl Default for Ed25519phSigner

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> Same for T

Source§

type Output = T

Should always be Self
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.