Remove old VerifierFilter, switch to SignatureVerificationFilter

VerifierFilter was a typedef for SignatureVerificationFilter. The name changed at Crypto++ 5.0
Updated documentation
pull/378/head
Jeffrey Walton 2017-02-07 18:51:44 -05:00
parent 48b0d8ade5
commit 9d7c5fce55
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
5 changed files with 40 additions and 11 deletions

View File

@ -250,7 +250,7 @@ void TestSignatureScheme(TestData &v)
if (test == "Verify" || test == "NotVerify") if (test == "Verify" || test == "NotVerify")
{ {
VerifierFilter verifierFilter(*verifier, NULL, VerifierFilter::SIGNATURE_AT_BEGIN); SignatureVerificationFilter verifierFilter(*verifier, NULL, SignatureVerificationFilter::SIGNATURE_AT_BEGIN);
PutDecodedDatumInto(v, "Signature", verifierFilter); PutDecodedDatumInto(v, "Signature", verifierFilter);
PutDecodedDatumInto(v, "Message", verifierFilter); PutDecodedDatumInto(v, "Message", verifierFilter);
verifierFilter.MessageEnd(); verifierFilter.MessageEnd();
@ -274,7 +274,7 @@ void TestSignatureScheme(TestData &v)
if (test == "GenerateKey" || test == "KeyPairValidAndConsistent") if (test == "GenerateKey" || test == "KeyPairValidAndConsistent")
{ {
TestKeyPairValidAndConsistent(verifier->AccessMaterial(), signer->GetMaterial()); TestKeyPairValidAndConsistent(verifier->AccessMaterial(), signer->GetMaterial());
VerifierFilter verifierFilter(*verifier, NULL, VerifierFilter::THROW_EXCEPTION); SignatureVerificationFilter verifierFilter(*verifier, NULL, SignatureVerificationFilter::THROW_EXCEPTION);
verifierFilter.Put((const byte *)"abc", 3); verifierFilter.Put((const byte *)"abc", 3);
StringSource ss("abc", true, new SignerFilter(GlobalRNG(), *signer, new Redirector(verifierFilter))); StringSource ss("abc", true, new SignerFilter(GlobalRNG(), *signer, new Redirector(verifierFilter)));
} }

2
drbg.h
View File

@ -662,7 +662,7 @@ void HMAC_DRBG<HASH, STRENGTH, SEEDLENGTH>::HMAC_Update(const byte* input1, size
// Step 3 // Step 3
if ((inlen1 | inlen2 | inlen3) == 0) if ((inlen1 | inlen2 | inlen3) == 0)
return; return;
// Step 4 // Step 4
hmac.SetKey(m_k, m_k.size()); hmac.SetKey(m_k, m_k.size());
hmac.Update(m_v, m_v.size()); hmac.Update(m_v, m_v.size());

View File

@ -462,6 +462,7 @@ protected:
//! \struct BlockPaddingSchemeDef //! \struct BlockPaddingSchemeDef
//! \brief Padding schemes used for block ciphers //! \brief Padding schemes used for block ciphers
//! \since Crypto++ 5.0
struct BlockPaddingSchemeDef struct BlockPaddingSchemeDef
{ {
//! \enum BlockPaddingScheme //! \enum BlockPaddingScheme
@ -471,14 +472,19 @@ struct BlockPaddingSchemeDef
//! NO_PADDING for modes like OFB, CFB, CTR, CBC-CTS. //! NO_PADDING for modes like OFB, CFB, CTR, CBC-CTS.
//! \sa <A HREF="http://www.weidai.com/scan-mirror/csp.html">Block Cipher Padding</A> for //! \sa <A HREF="http://www.weidai.com/scan-mirror/csp.html">Block Cipher Padding</A> for
//! additional details. //! additional details.
//! \since Crypto++ 5.0
enum BlockPaddingScheme { enum BlockPaddingScheme {
//! \brief No padding added to a block //! \brief No padding added to a block
//! \since Crypto++ 5.0
NO_PADDING, NO_PADDING,
//! \brief 0's padding added to a block //! \brief 0's padding added to a block
//! \since Crypto++ 5.0
ZEROS_PADDING, ZEROS_PADDING,
//! \brief PKCS #5 padding added to a block //! \brief PKCS #5 padding added to a block
//! \since Crypto++ 5.0
PKCS_PADDING, PKCS_PADDING,
//! \brief 1 and 0's padding added to a block //! \brief 1 and 0's padding added to a block
//! \since Crypto++ 5.0
ONE_AND_ZEROS_PADDING, ONE_AND_ZEROS_PADDING,
//! \brief W3C padding added to a block //! \brief W3C padding added to a block
//! \sa <A HREF="http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html">XML //! \sa <A HREF="http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html">XML
@ -486,6 +492,7 @@ struct BlockPaddingSchemeDef
//! \since Crypto++ 5.7 //! \since Crypto++ 5.7
W3C_PADDING, W3C_PADDING,
//! \brief Default padding scheme //! \brief Default padding scheme
//! \since Crypto++ 5.0
DEFAULT_PADDING DEFAULT_PADDING
}; };
}; };
@ -493,6 +500,7 @@ struct BlockPaddingSchemeDef
//! \class StreamTransformationFilter //! \class StreamTransformationFilter
//! \brief Filter wrapper for StreamTransformation //! \brief Filter wrapper for StreamTransformation
//! \details StreamTransformationFilter is a filter wrapper for StreamTransformation. The filter will optionally handle padding/unpadding when needed //! \details StreamTransformationFilter is a filter wrapper for StreamTransformation. The filter will optionally handle padding/unpadding when needed
//! \since Crypto++ 5.0
class CRYPTOPP_DLL StreamTransformationFilter : public FilterWithBufferedInput, public BlockPaddingSchemeDef, private FilterPutSpaceHelper class CRYPTOPP_DLL StreamTransformationFilter : public FilterWithBufferedInput, public BlockPaddingSchemeDef, private FilterPutSpaceHelper
{ {
public: public:
@ -523,6 +531,7 @@ protected:
//! \class HashFilter //! \class HashFilter
//! \brief Filter wrapper for HashTransformation //! \brief Filter wrapper for HashTransformation
//! \since Crypto++ 1.0
class CRYPTOPP_DLL HashFilter : public Bufferless<Filter>, private FilterPutSpaceHelper class CRYPTOPP_DLL HashFilter : public Bufferless<Filter>, private FilterPutSpaceHelper
{ {
public: public:
@ -552,6 +561,7 @@ private:
//! \class HashVerificationFilter //! \class HashVerificationFilter
//! \brief Filter wrapper for HashTransformation //! \brief Filter wrapper for HashTransformation
//! \since Crypto++ 4.0
class CRYPTOPP_DLL HashVerificationFilter : public FilterWithBufferedInput class CRYPTOPP_DLL HashVerificationFilter : public FilterWithBufferedInput
{ {
public: public:
@ -719,6 +729,7 @@ protected:
//! \class SignerFilter //! \class SignerFilter
//! \brief Filter wrapper for PK_Signer //! \brief Filter wrapper for PK_Signer
//! \since Crypto++ 4.0
class CRYPTOPP_DLL SignerFilter : public Unflushable<Filter> class CRYPTOPP_DLL SignerFilter : public Unflushable<Filter>
{ {
public: public:
@ -747,6 +758,8 @@ private:
//! \class SignatureVerificationFilter //! \class SignatureVerificationFilter
//! \brief Filter wrapper for PK_Verifier //! \brief Filter wrapper for PK_Verifier
//! \details This filter was formerly named <tt>VerifierFilter</tt>. The name changed at Crypto++ 5.0.
//! \since Crypto++ 4.0
class CRYPTOPP_DLL SignatureVerificationFilter : public FilterWithBufferedInput class CRYPTOPP_DLL SignatureVerificationFilter : public FilterWithBufferedInput
{ {
public: public:
@ -806,10 +819,9 @@ private:
bool m_verified; bool m_verified;
}; };
typedef SignatureVerificationFilter VerifierFilter; // for backwards compatibility
//! \class Redirector //! \class Redirector
//! \brief Redirect input to another BufferedTransformation without owning it //! \brief Redirect input to another BufferedTransformation without owning it
//! \since Crypto++ 4.0
class CRYPTOPP_DLL Redirector : public CustomSignalPropagation<Sink> class CRYPTOPP_DLL Redirector : public CustomSignalPropagation<Sink>
{ {
public: public:
@ -905,6 +917,7 @@ private:
//! \class OutputProxy //! \class OutputProxy
//! \brief Filter class that is a proxy for a sink //! \brief Filter class that is a proxy for a sink
//! \details Used By ProxyFilter //! \details Used By ProxyFilter
//! \since Crypto++ 4.0
class CRYPTOPP_DLL OutputProxy : public CustomSignalPropagation<Sink> class CRYPTOPP_DLL OutputProxy : public CustomSignalPropagation<Sink>
{ {
public: public:
@ -953,6 +966,7 @@ private:
//! \class ProxyFilter //! \class ProxyFilter
//! \brief Base class for Filter classes that are proxies for a chain of other filters //! \brief Base class for Filter classes that are proxies for a chain of other filters
//! \since Crypto++ 4.0
class CRYPTOPP_DLL ProxyFilter : public FilterWithBufferedInput class CRYPTOPP_DLL ProxyFilter : public FilterWithBufferedInput
{ {
public: public:
@ -979,6 +993,7 @@ protected:
//! \class SimpleProxyFilter //! \class SimpleProxyFilter
//! \brief Proxy filter that doesn't modify the underlying filter's input or output //! \brief Proxy filter that doesn't modify the underlying filter's input or output
//! \since Crypto++ 5.0
class CRYPTOPP_DLL SimpleProxyFilter : public ProxyFilter class CRYPTOPP_DLL SimpleProxyFilter : public ProxyFilter
{ {
public: public:
@ -1009,6 +1024,7 @@ public:
//! \brief Filter wrapper for PK_Encryptor //! \brief Filter wrapper for PK_Encryptor
//! \details PK_DecryptorFilter is a proxy for the filter created by PK_Encryptor::CreateEncryptionFilter. //! \details PK_DecryptorFilter is a proxy for the filter created by PK_Encryptor::CreateEncryptionFilter.
//! This class provides symmetry with VerifierFilter. //! This class provides symmetry with VerifierFilter.
//! \since Crypto++ 5.0
class CRYPTOPP_DLL PK_EncryptorFilter : public SimpleProxyFilter class CRYPTOPP_DLL PK_EncryptorFilter : public SimpleProxyFilter
{ {
public: public:
@ -1024,6 +1040,7 @@ public:
//! \brief Filter wrapper for PK_Decryptor //! \brief Filter wrapper for PK_Decryptor
//! \details PK_DecryptorFilter is a proxy for the filter created by PK_Decryptor::CreateDecryptionFilter. //! \details PK_DecryptorFilter is a proxy for the filter created by PK_Decryptor::CreateDecryptionFilter.
//! This class provides symmetry with SignerFilter. //! This class provides symmetry with SignerFilter.
//! \since Crypto++ 5.0
class CRYPTOPP_DLL PK_DecryptorFilter : public SimpleProxyFilter class CRYPTOPP_DLL PK_DecryptorFilter : public SimpleProxyFilter
{ {
public: public:
@ -1039,6 +1056,7 @@ public:
//! \brief Append input to a string object //! \brief Append input to a string object
//! \tparam T std::basic_string<char> type //! \tparam T std::basic_string<char> type
//! \details \ref StringSinkTemplate "StringSink" is a StringSinkTemplate typedef //! \details \ref StringSinkTemplate "StringSink" is a StringSinkTemplate typedef
//! \since Crypto++ 5.0
template <class T> template <class T>
class StringSinkTemplate : public Bufferless<Sink> class StringSinkTemplate : public Bufferless<Sink>
{ {
@ -1080,6 +1098,7 @@ CRYPTOPP_DLL_TEMPLATE_CLASS StringSinkTemplate<std::string>;
//! \class RandomNumberSink //! \class RandomNumberSink
//! \brief Incorporates input into RNG as additional entropy //! \brief Incorporates input into RNG as additional entropy
//! \since Crypto++ 4.0
class RandomNumberSink : public Bufferless<Sink> class RandomNumberSink : public Bufferless<Sink>
{ {
public: public:
@ -1103,6 +1122,7 @@ private:
//! \class ArraySink //! \class ArraySink
//! \brief Copy input to a memory buffer //! \brief Copy input to a memory buffer
//! \since Crypto++ 4.0
class CRYPTOPP_DLL ArraySink : public Bufferless<Sink> class CRYPTOPP_DLL ArraySink : public Bufferless<Sink>
{ {
public: public:
@ -1140,6 +1160,7 @@ protected:
//! \class ArrayXorSink //! \class ArrayXorSink
//! \brief Xor input to a memory buffer //! \brief Xor input to a memory buffer
//! \since Crypto++ 4.0
class CRYPTOPP_DLL ArrayXorSink : public ArraySink class CRYPTOPP_DLL ArrayXorSink : public ArraySink
{ {
public: public:
@ -1157,6 +1178,7 @@ public:
//! \class StringStore //! \class StringStore
//! \brief String-based implementation of Store interface //! \brief String-based implementation of Store interface
//! \since Crypto++ 4.0
class StringStore : public Store class StringStore : public Store
{ {
public: public:
@ -1187,7 +1209,9 @@ private:
size_t m_length, m_count; size_t m_length, m_count;
}; };
//! RNG-based implementation of Source interface //! \class RandomNumberStore
//! \brief RNG-based implementation of Source interface
//! \since Crypto++ 4.0
class CRYPTOPP_DLL RandomNumberStore : public Store class CRYPTOPP_DLL RandomNumberStore : public Store
{ {
public: public:
@ -1216,7 +1240,8 @@ private:
lword m_length, m_count; lword m_length, m_count;
}; };
//! empty store //! \brief Empty store
//! \since Crypto++ 5.0
class CRYPTOPP_DLL NullStore : public Store class CRYPTOPP_DLL NullStore : public Store
{ {
public: public:
@ -1241,6 +1266,7 @@ private:
//! \details See the discussion of BufferedTransformation in cryptlib.h for //! \details See the discussion of BufferedTransformation in cryptlib.h for
//! more details. //! more details.
//! \sa Store and SourceTemplate //! \sa Store and SourceTemplate
//! \since Crypto++ 1.0
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Source : public InputRejecting<Filter> class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Source : public InputRejecting<Filter>
{ {
public: public:
@ -1313,6 +1339,7 @@ protected:
//! \class SourceTemplate //! \class SourceTemplate
//! \brief Transform a Store into a Source //! \brief Transform a Store into a Source
//! \tparam T the class or type //! \tparam T the class or type
//! \since Crypto++ 5.0
template <class T> template <class T>
class SourceTemplate : public Source class SourceTemplate : public Source
{ {
@ -1345,6 +1372,7 @@ protected:
//! \class SourceTemplate //! \class SourceTemplate
//! \brief String-based implementation of the Source interface //! \brief String-based implementation of the Source interface
//! \since Crypto++ 4.0
class CRYPTOPP_DLL StringSource : public SourceTemplate<StringStore> class CRYPTOPP_DLL StringSource : public SourceTemplate<StringStore>
{ {
public: public:
@ -1383,7 +1411,8 @@ public:
//! \since Crypto++ 5.6.0 //! \since Crypto++ 5.6.0
DOCUMENTED_TYPEDEF(StringSource, ArraySource); DOCUMENTED_TYPEDEF(StringSource, ArraySource);
//! RNG-based implementation of Source interface //! \brief RNG-based implementation of Source interface
//! \since Crypto++ 4.0
class CRYPTOPP_DLL RandomNumberSource : public SourceTemplate<RandomNumberStore> class CRYPTOPP_DLL RandomNumberSource : public SourceTemplate<RandomNumberStore>
{ {
public: public:

View File

@ -197,7 +197,7 @@ void SignatureKnownAnswerTest(const char *key, const char *message, const char *
comparison.ChannelMessageSeriesEnd("0"); comparison.ChannelMessageSeriesEnd("0");
comparison.ChannelMessageSeriesEnd("1"); comparison.ChannelMessageSeriesEnd("1");
VerifierFilter verifierFilter(verifier, NULL, VerifierFilter::SIGNATURE_AT_BEGIN | VerifierFilter::THROW_EXCEPTION); SignatureVerificationFilter verifierFilter(verifier, NULL, SignatureVerificationFilter::SIGNATURE_AT_BEGIN | SignatureVerificationFilter::THROW_EXCEPTION);
StringSource(signature, true, new HexDecoder(new Redirector(verifierFilter, Redirector::DATA_ONLY))); StringSource(signature, true, new HexDecoder(new Redirector(verifierFilter, Redirector::DATA_ONLY)));
StringSource(message, true, new Redirector(verifierFilter)); StringSource(message, true, new Redirector(verifierFilter));
} }
@ -250,7 +250,7 @@ void SignaturePairwiseConsistencyTest(const PK_Signer &signer, const PK_Verifier
new SignerFilter( new SignerFilter(
rng, rng,
signer, signer,
new VerifierFilter(verifier, NULL, VerifierFilter::THROW_EXCEPTION), new SignatureVerificationFilter(verifier, NULL, SignatureVerificationFilter::THROW_EXCEPTION),
true)); true));
} }
catch (...) catch (...)

View File

@ -547,7 +547,7 @@ bool RSAVerifyFile(const char *pubFilename, const char *messageFilename, const c
SecByteBlock signature(pub.SignatureLength()); SecByteBlock signature(pub.SignatureLength());
signatureFile.Get(signature, signature.size()); signatureFile.Get(signature, signature.size());
VerifierFilter *verifierFilter = new VerifierFilter(pub); SignatureVerificationFilter *verifierFilter = new SignatureVerificationFilter(pub);
verifierFilter->Put(signature, pub.SignatureLength()); verifierFilter->Put(signature, pub.SignatureLength());
FileSource f(messageFilename, true, verifierFilter); FileSource f(messageFilename, true, verifierFilter);