Crypto++ 8.7
Free C++ class library of cryptographic schemes
Public Types | Public Member Functions | Static Public Attributes | List of all members
ed25519Verifier Struct Reference

Ed25519 signature verification algorithm. More...

#include <xed25519.h>

+ Inheritance diagram for ed25519Verifier:

Public Types

typedef Integer Element
 

Public Member Functions

 ed25519Verifier ()
 Create an ed25519Verifier object. More...
 
 ed25519Verifier (const byte y[PUBLIC_KEYLENGTH])
 Create an ed25519Verifier object. More...
 
 ed25519Verifier (const Integer &y)
 Create an ed25519Verifier object. More...
 
 ed25519Verifier (const X509PublicKey &key)
 Create an ed25519Verifier object. More...
 
 ed25519Verifier (BufferedTransformation &params)
 Create an ed25519Verifier object. More...
 
 ed25519Verifier (const ed25519Signer &signer)
 Create an ed25519Verifier object. More...
 
PublicKeyAccessKey ()
 Retrieves a reference to a Public Key. More...
 
PublicKeyAccessPublicKey ()
 Retrieves a reference to a Public Key. More...
 
const PublicKeyGetKey () const
 Retrieves a reference to a Public Key. More...
 
const PublicKeyGetPublicKey () const
 Retrieves a reference to a Public Key. More...
 
size_t SignatureLength () const
 Provides the signature length if it only depends on the key. More...
 
size_t MaxRecoverableLength () const
 Provides the length of longest message that can be recovered. More...
 
size_t MaxRecoverableLengthFromSignatureLength (size_t signatureLength) const
 Provides the length of longest message that can be recovered from a signature of given length. More...
 
bool IsProbabilistic () const
 Determines whether a signature scheme requires a random number generator. More...
 
bool AllowNonrecoverablePart () const
 Determines whether the non-recoverable message part can be signed. More...
 
bool RecoverablePartFirst () const
 Determines whether the recoverable part must be input before the non-recoverable part. More...
 
ed25519_MessageAccumulatorNewVerificationAccumulator () const
 Create a new HashTransformation to accumulate the message to be verified. More...
 
void InputSignature (PK_MessageAccumulator &messageAccumulator, const byte *signature, size_t signatureLength) const
 Input signature into a message accumulator. More...
 
bool VerifyAndRestart (PK_MessageAccumulator &messageAccumulator) const
 Check whether messageAccumulator contains a valid signature and message, and restart messageAccumulator. More...
 
bool VerifyStream (std::istream &stream, const byte *signature, size_t signatureLen) const
 Check whether input signature is a valid signature for input message. More...
 
DecodingResult RecoverAndRestart (byte *recoveredMessage, PK_MessageAccumulator &messageAccumulator) const
 Recover a message from its signature. More...
 
- Public Member Functions inherited from PK_Verifier
virtual PK_MessageAccumulatorNewVerificationAccumulator () const =0
 Create a new HashTransformation to accumulate the message to be verified. More...
 
virtual void InputSignature (PK_MessageAccumulator &messageAccumulator, const byte *signature, size_t signatureLength) const =0
 Input signature into a message accumulator. More...
 
virtual bool Verify (PK_MessageAccumulator *messageAccumulator) const
 Check whether messageAccumulator contains a valid signature and message. More...
 
virtual bool VerifyAndRestart (PK_MessageAccumulator &messageAccumulator) const =0
 Check whether messageAccumulator contains a valid signature and message, and restart messageAccumulator. More...
 
virtual bool VerifyMessage (const byte *message, size_t messageLen, const byte *signature, size_t signatureLen) const
 Check whether input signature is a valid signature for input message. More...
 
virtual DecodingResult Recover (byte *recoveredMessage, PK_MessageAccumulator *messageAccumulator) const
 Recover a message from its signature. More...
 
virtual DecodingResult RecoverAndRestart (byte *recoveredMessage, PK_MessageAccumulator &messageAccumulator) const =0
 Recover a message from its signature. More...
 
virtual DecodingResult RecoverMessage (byte *recoveredMessage, const byte *nonrecoverableMessage, size_t nonrecoverableMessageLength, const byte *signature, size_t signatureLength) const
 Recover a message from its signature. More...
 
- Public Member Functions inherited from PK_SignatureScheme
virtual size_t SignatureLength () const =0
 Provides the signature length if it only depends on the key. More...
 
virtual size_t MaxSignatureLength (size_t recoverablePartLength=0) const
 Provides the maximum signature length produced given the length of the recoverable message part. More...
 
virtual size_t MaxRecoverableLength () const =0
 Provides the length of longest message that can be recovered. More...
 
virtual size_t MaxRecoverableLengthFromSignatureLength (size_t signatureLength) const =0
 Provides the length of longest message that can be recovered from a signature of given length. More...
 
virtual bool IsProbabilistic () const =0
 Determines whether a signature scheme requires a random number generator. More...
 
virtual bool AllowNonrecoverablePart () const =0
 Determines whether the non-recoverable message part can be signed. More...
 
virtual bool SignatureUpfront () const
 Determines whether the signature must be input before the message. More...
 
virtual bool RecoverablePartFirst () const =0
 Determines whether the recoverable part must be input before the non-recoverable part. More...
 
- Public Member Functions inherited from PublicKeyAlgorithm
CryptoMaterialAccessMaterial ()
 Retrieves a reference to a Public Key. More...
 
const CryptoMaterialGetMaterial () const
 Retrieves a reference to a Public Key. More...
 
virtual PublicKeyAccessPublicKey ()=0
 Retrieves a reference to a Public Key. More...
 
virtual const PublicKeyGetPublicKey () const
 Retrieves a reference to a Public Key. More...
 
virtual CryptoMaterialAccessMaterial ()=0
 Retrieves a reference to CryptoMaterial. More...
 
virtual const CryptoMaterialGetMaterial () const =0
 Retrieves a reference to CryptoMaterial. More...
 
- Public Member Functions inherited from Algorithm
 Algorithm (bool checkSelfTestStatus=true)
 Interface for all crypto algorithms. More...
 
virtual std::string AlgorithmName () const
 Provides the name of this algorithm. More...
 
virtual std::string AlgorithmProvider () const
 Retrieve the provider of this algorithm. More...
 
- Public Member Functions inherited from Clonable
virtual ClonableClone () const
 Copies this object. More...
 

Static Public Attributes

static const int PUBLIC_KEYLENGTH = 32
 
static const int SIGNATURE_LENGTH = 64
 

Detailed Description

Ed25519 signature verification algorithm.

Since
Crypto++ 8.0

Definition at line 712 of file xed25519.h.

Member Typedef Documentation

◆ Element

Definition at line 716 of file xed25519.h.

Constructor & Destructor Documentation

◆ ~ed25519Verifier()

virtual ed25519Verifier::~ed25519Verifier ( )
inlinevirtual

Definition at line 718 of file xed25519.h.

◆ ed25519Verifier() [1/6]

ed25519Verifier::ed25519Verifier ( )
inline

Create an ed25519Verifier object.

Definition at line 721 of file xed25519.h.

◆ ed25519Verifier() [2/6]

ed25519Verifier::ed25519Verifier ( const byte  y[PUBLIC_KEYLENGTH])

Create an ed25519Verifier object.

Parameters
ypublic key

This constructor creates an ed25519Verifier object using existing parameters.

Note
The public key is not validated.

Definition at line 843 of file xed25519.cpp.

◆ ed25519Verifier() [3/6]

ed25519Verifier::ed25519Verifier ( const Integer y)

Create an ed25519Verifier object.

Parameters
ypublic key

This constructor creates an ed25519Verifier object using existing parameters.

Note
The public key is not validated.

Definition at line 849 of file xed25519.cpp.

◆ ed25519Verifier() [4/6]

ed25519Verifier::ed25519Verifier ( const X509PublicKey key)

Create an ed25519Verifier object.

Parameters
keyX509 public key

This constructor creates an ed25519Verifier object using an existing public key.

Note
The public key is not validated.
Since
Crypto++ 8.6

Definition at line 860 of file xed25519.cpp.

◆ ed25519Verifier() [5/6]

ed25519Verifier::ed25519Verifier ( BufferedTransformation params)

Create an ed25519Verifier object.

Parameters
paramspublic and private key

This constructor creates an ed25519Verifier object using existing parameters. The params can be created with Save.

Note
The public key is not validated.

Definition at line 868 of file xed25519.cpp.

◆ ed25519Verifier() [6/6]

ed25519Verifier::ed25519Verifier ( const ed25519Signer signer)

Create an ed25519Verifier object.

Parameters
signered25519 signer object

This constructor creates an ed25519Verifier object using existing parameters. The params can be created with Save.

Note
The public key is not validated.

Definition at line 873 of file xed25519.cpp.

Member Function Documentation

◆ AccessKey()

PublicKey & ed25519Verifier::AccessKey ( )
inline

Retrieves a reference to a Public Key.

AccessKey() retrieves a non-const reference to a public key.

Definition at line 759 of file xed25519.h.

◆ AccessPublicKey()

PublicKey & ed25519Verifier::AccessPublicKey ( )
inlinevirtual

Retrieves a reference to a Public Key.

Returns
a reference to the public key

Implements PublicKeyAlgorithm.

Definition at line 760 of file xed25519.h.

◆ GetKey()

const PublicKey & ed25519Verifier::GetKey ( ) const
inline

Retrieves a reference to a Public Key.

GetKey() retrieves a const reference to a public key.

Definition at line 764 of file xed25519.h.

◆ GetPublicKey()

const PublicKey & ed25519Verifier::GetPublicKey ( ) const
inlinevirtual

Retrieves a reference to a Public Key.

Returns
a const reference the public key

Reimplemented from PublicKeyAlgorithm.

Definition at line 765 of file xed25519.h.

◆ SignatureLength()

size_t ed25519Verifier::SignatureLength ( ) const
inlinevirtual

Provides the signature length if it only depends on the key.

Returns
the signature length if it only depends on the key, in bytes

SignatureLength() returns the signature length if it only depends on the key, otherwise 0.

Implements PK_SignatureScheme.

Definition at line 768 of file xed25519.h.

◆ MaxRecoverableLength()

size_t ed25519Verifier::MaxRecoverableLength ( ) const
inlinevirtual

Provides the length of longest message that can be recovered.

Returns
the length of longest message that can be recovered, in bytes

MaxRecoverableLength() returns the length of longest message that can be recovered, or 0 if this signature scheme does not support message recovery.

Implements PK_SignatureScheme.

Definition at line 769 of file xed25519.h.

◆ MaxRecoverableLengthFromSignatureLength()

size_t ed25519Verifier::MaxRecoverableLengthFromSignatureLength ( size_t  signatureLength) const
inlinevirtual

Provides the length of longest message that can be recovered from a signature of given length.

Parameters
signatureLengththe length of the signature, in bytes
Returns
the length of longest message that can be recovered from a signature of given length, in bytes

MaxRecoverableLengthFromSignatureLength() returns the length of longest message that can be recovered from a signature of given length, or 0 if this signature scheme does not support message recovery.

Implements PK_SignatureScheme.

Definition at line 770 of file xed25519.h.

◆ IsProbabilistic()

bool ed25519Verifier::IsProbabilistic ( ) const
inlinevirtual

Determines whether a signature scheme requires a random number generator.

Returns
true if the signature scheme requires a RandomNumberGenerator() to sign

if IsProbabilistic() returns false, then NullRNG() can be passed to functions that take RandomNumberGenerator().

Implements PK_SignatureScheme.

Definition at line 774 of file xed25519.h.

◆ AllowNonrecoverablePart()

bool ed25519Verifier::AllowNonrecoverablePart ( ) const
inlinevirtual

Determines whether the non-recoverable message part can be signed.

Returns
true if the non-recoverable message part can be signed

Implements PK_SignatureScheme.

Definition at line 775 of file xed25519.h.

◆ RecoverablePartFirst()

bool ed25519Verifier::RecoverablePartFirst ( ) const
inlinevirtual

Determines whether the recoverable part must be input before the non-recoverable part.

Returns
true if the recoverable part must be input before the non-recoverable part during signing

RecoverablePartFirst() determines whether you must input the recoverable part before the non-recoverable part during signing

Implements PK_SignatureScheme.

Definition at line 776 of file xed25519.h.

◆ NewVerificationAccumulator()

ed25519_MessageAccumulator * ed25519Verifier::NewVerificationAccumulator ( ) const
inlinevirtual

Create a new HashTransformation to accumulate the message to be verified.

Returns
a pointer to a PK_MessageAccumulator

NewVerificationAccumulator() can be used with all verification methods. Verify() will automatically delete the accumulator pointer. The caller is responsible for deletion if a method is called that takes a reference.

Implements PK_Verifier.

Definition at line 778 of file xed25519.h.

◆ InputSignature()

void ed25519Verifier::InputSignature ( PK_MessageAccumulator messageAccumulator,
const byte signature,
size_t  signatureLength 
) const
inlinevirtual

Input signature into a message accumulator.

Parameters
messageAccumulatora pointer to a PK_MessageAccumulator derived class
signaturethe signature on the message
signatureLengththe size of the signature

Implements PK_Verifier.

Definition at line 782 of file xed25519.h.

◆ VerifyAndRestart()

bool ed25519Verifier::VerifyAndRestart ( PK_MessageAccumulator messageAccumulator) const
virtual

Check whether messageAccumulator contains a valid signature and message, and restart messageAccumulator.

Parameters
messageAccumulatora reference to a PK_MessageAccumulator derived class
Returns
true if the signature is valid, false otherwise

VerifyAndRestart() restarts the messageAccumulator

Implements PK_Verifier.

Definition at line 879 of file xed25519.cpp.

◆ VerifyStream()

bool ed25519Verifier::VerifyStream ( std::istream &  stream,
const byte signature,
size_t  signatureLen 
) const

Check whether input signature is a valid signature for input message.

Parameters
streaman std::istream derived class
signaturea pointer to the signature over the message
signatureLenthe size of the signature
Returns
true if the signature is valid, false otherwise

VerifyStream() handles large streams. The Stream functions were added to ed25519 for signing and verifying files that are too large for a memory allocation. The functions are not present in other library signers and verifiers.

Since
Crypto++ 8.1

Definition at line 889 of file xed25519.cpp.

◆ RecoverAndRestart()

DecodingResult ed25519Verifier::RecoverAndRestart ( byte recoveredMessage,
PK_MessageAccumulator messageAccumulator 
) const
inlinevirtual

Recover a message from its signature.

Parameters
recoveredMessagea pointer to the recoverable message part to be verified
messageAccumulatora pointer to a PK_MessageAccumulator derived class
Returns
the result of the verification operation

RecoverAndRestart() restarts the messageAccumulator

Precondition
COUNTOF(recoveredMessage) == MaxRecoverableLengthFromSignatureLength(signatureLength)

Implements PK_Verifier.

Definition at line 803 of file xed25519.h.

Member Data Documentation

◆ PUBLIC_KEYLENGTH

const int ed25519Verifier::PUBLIC_KEYLENGTH = 32
static

Definition at line 714 of file xed25519.h.

◆ SIGNATURE_LENGTH

const int ed25519Verifier::SIGNATURE_LENGTH = 64
static

Definition at line 715 of file xed25519.h.


The documentation for this struct was generated from the following files: