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
impl Ed25519phSigner
Sourcepub fn update<Message: Bytes + ?Sized>(&mut self, message: &Message)
pub fn update<Message: Bytes + ?Sized>(&mut self, message: &Message)
Appends message to the message being signed or verified.
Sourcepub fn finalize<Signature: NewByteArray<CRYPTO_SIGN_BYTES>, SecretKey: ByteArray<CRYPTO_SIGN_SECRETKEYBYTES>>(
self,
secret_key: &SecretKey,
) -> Signature
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.
Sourcepub fn verify<Signature: ByteArray<CRYPTO_SIGN_BYTES>, PublicKey: ByteArray<CRYPTO_SIGN_PUBLICKEYBYTES>>(
self,
signature: &Signature,
public_key: &PublicKey,
) -> Result<(), Error>
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.