Crypto++ 8.9
Free C++ class library of cryptographic schemes
Public Member Functions | List of all members
PK_Verifier Class Referenceabstract

Interface for public-key signature verifiers. More...

#include <cryptlib.h>

+ Inheritance diagram for PK_Verifier:

Public Member Functions

virtual PK_MessageAccumulatorNewVerificationAccumulator () const =0
 Create a new HashTransformation to accumulate the message to be verified.
 
virtual void InputSignature (PK_MessageAccumulator &messageAccumulator, const byte *signature, size_t signatureLength) const =0
 Input signature into a message accumulator.
 
virtual bool Verify (PK_MessageAccumulator *messageAccumulator) const
 Check whether messageAccumulator contains a valid signature and message.
 
virtual bool VerifyAndRestart (PK_MessageAccumulator &messageAccumulator) const =0
 Check whether messageAccumulator contains a valid signature and message, and restart messageAccumulator.
 
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.
 
virtual DecodingResult Recover (byte *recoveredMessage, PK_MessageAccumulator *messageAccumulator) const
 Recover a message from its signature.
 
virtual DecodingResult RecoverAndRestart (byte *recoveredMessage, PK_MessageAccumulator &messageAccumulator) const =0
 Recover a message from its signature.
 
virtual DecodingResult RecoverMessage (byte *recoveredMessage, const byte *nonrecoverableMessage, size_t nonrecoverableMessageLength, const byte *signature, size_t signatureLength) const
 Recover a message from its signature.
 
- Public Member Functions inherited from PK_SignatureScheme
virtual size_t SignatureLength () const =0
 Provides the signature length if it only depends on the key.
 
virtual size_t MaxSignatureLength (size_t recoverablePartLength=0) const
 Provides the maximum signature length produced given the length of the recoverable message part.
 
virtual size_t MaxRecoverableLength () const =0
 Provides the length of longest message that can be recovered.
 
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.
 
virtual bool IsProbabilistic () const =0
 Determines whether a signature scheme requires a random number generator.
 
virtual bool AllowNonrecoverablePart () const =0
 Determines whether the non-recoverable message part can be signed.
 
virtual bool SignatureUpfront () const
 Determines whether the signature must be input before the message.
 
virtual bool RecoverablePartFirst () const =0
 Determines whether the recoverable part must be input before the non-recoverable part.
 
- Public Member Functions inherited from PublicKeyAlgorithm
CryptoMaterialAccessMaterial ()
 Retrieves a reference to a Public Key.
 
const CryptoMaterialGetMaterial () const
 Retrieves a reference to a Public Key.
 
virtual PublicKeyAccessPublicKey ()=0
 Retrieves a reference to a Public Key.
 
virtual const PublicKeyGetPublicKey () const
 Retrieves a reference to a Public Key.
 
- Public Member Functions inherited from Algorithm
 Algorithm (bool checkSelfTestStatus=true)
 Interface for all crypto algorithms.
 
virtual std::string AlgorithmName () const
 Provides the name of this algorithm.
 
virtual std::string AlgorithmProvider () const
 Retrieve the provider of this algorithm.
 
- Public Member Functions inherited from Clonable
virtual ClonableClone () const
 Copies this object.
 

Detailed Description

Interface for public-key signature verifiers.

The Recover* functions throw NotImplemented if the signature scheme does not support message recovery.

The Verify* functions throw InvalidDataFormat if the scheme does support message recovery and the signature contains a non-empty recoverable message part. The Recover* functions should be used in that case.

Definition at line 2945 of file cryptlib.h.

Constructor & Destructor Documentation

◆ ~PK_Verifier()

virtual PK_Verifier::~PK_Verifier ( )
inlinevirtual

Definition at line 2948 of file cryptlib.h.

Member Function Documentation

◆ NewVerificationAccumulator()

virtual PK_MessageAccumulator * PK_Verifier::NewVerificationAccumulator ( ) const
pure virtual

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.

Implemented in ed25519Verifier.

◆ InputSignature()

virtual void PK_Verifier::InputSignature ( PK_MessageAccumulator & messageAccumulator,
const byte * signature,
size_t signatureLength ) const
pure virtual

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

Implemented in TF_VerifierBase, DL_VerifierBase< T >, and ed25519Verifier.

◆ Verify()

virtual bool PK_Verifier::Verify ( PK_MessageAccumulator * messageAccumulator) const
virtual

Check whether messageAccumulator contains a valid signature and message.

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

Verify() deletes the messageAccumulator, even if an exception is thrown.

◆ VerifyAndRestart()

virtual bool PK_Verifier::VerifyAndRestart ( PK_MessageAccumulator & messageAccumulator) const
pure 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

Implemented in TF_VerifierBase, DL_VerifierBase< T >, and ed25519Verifier.

◆ VerifyMessage()

virtual bool PK_Verifier::VerifyMessage ( const byte * message,
size_t messageLen,
const byte * signature,
size_t signatureLen ) const
virtual

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

Parameters
messagea pointer to the message to be verified
messageLenthe size of the message
signaturea pointer to the signature over the message
signatureLenthe size of the signature
Returns
true if the signature is valid, false otherwise

◆ Recover()

virtual DecodingResult PK_Verifier::Recover ( byte * recoveredMessage,
PK_MessageAccumulator * messageAccumulator ) const
virtual

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

Recover() deletes the messageAccumulator, even if an exception is thrown.

Precondition
COUNTOF(recoveredMessage) == MaxRecoverableLengthFromSignatureLength(signatureLength)

◆ RecoverAndRestart()

virtual DecodingResult PK_Verifier::RecoverAndRestart ( byte * recoveredMessage,
PK_MessageAccumulator & messageAccumulator ) const
pure virtual

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)

Implemented in DL_VerifierBase< T >, ed25519Verifier, and TF_VerifierBase.

◆ RecoverMessage()

virtual DecodingResult PK_Verifier::RecoverMessage ( byte * recoveredMessage,
const byte * nonrecoverableMessage,
size_t nonrecoverableMessageLength,
const byte * signature,
size_t signatureLength ) const
virtual

Recover a message from its signature.

Parameters
recoveredMessagea pointer for the recovered message
nonrecoverableMessagea pointer to the non-recoverable message part to be signed
nonrecoverableMessageLengththe size of the non-recoverable message part
signaturethe signature on the message
signatureLengththe size of the signature
Returns
the result of the verification operation
Precondition
COUNTOF(recoveredMessage) == MaxRecoverableLengthFromSignatureLength(signatureLength)

The documentation for this class was generated from the following file: