summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2018-01-21 08:45:02 -0500
committerJeffrey Walton <noloader@gmail.com>2018-01-21 08:45:02 -0500
commit9b174e84de7a4cf92b9c640f011c455e88182862 (patch)
tree029face4f9124a3f936867aa19c6f14d4f4d7ac7
parent565bd844fcc0dec4712f8c4c3e74e056f4a9ed78 (diff)
downloadcryptopp-git-9b174e84de7a4cf92b9c640f011c455e88182862.tar.gz
Remove AsymmetricAlgorithm::BERDecode (GH #569)
-rw-r--r--cryptlib.h8
-rw-r--r--randpool.h2
-rw-r--r--test.cpp5
-rw-r--r--validat2.cpp5
4 files changed, 15 insertions, 5 deletions
diff --git a/cryptlib.h b/cryptlib.h
index 80c1f03f..5cc94c61 100644
--- a/cryptlib.h
+++ b/cryptlib.h
@@ -2307,6 +2307,10 @@ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CryptoParameters : public GeneratableCrypt
};
/// \brief Interface for asymmetric algorithms
+/// \details BERDecode() and DEREncode() were removed under Issue 569
+/// and Commit XXX. Programs should use <tt>AccessMaterial().Load(bt)</tt>
+/// or <tt>AccessMaterial().Save(bt)</tt> instead.
+/// \sa <A HREF="https://github.com/weidai11/cryptopp/issues/569">Issue 569</A>
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE AsymmetricAlgorithm : public Algorithm
{
public:
@@ -2320,17 +2324,21 @@ public:
/// \return a const reference to the crypto material
virtual const CryptoMaterial & GetMaterial() const =0;
+#if 0
/// \brief Loads this object from a BufferedTransformation
/// \param bt a BufferedTransformation object
+ /// \details Use of BERDecode() changed to Load() at Issue 569.
/// \deprecated for backwards compatibility, calls <tt>AccessMaterial().Load(bt)</tt>
void BERDecode(BufferedTransformation &bt)
{AccessMaterial().Load(bt);}
/// \brief Saves this object to a BufferedTransformation
/// \param bt a BufferedTransformation object
+ /// \details Use of DEREncode() changed to Save() at Issue 569.
/// \deprecated for backwards compatibility, calls GetMaterial().Save(bt)
void DEREncode(BufferedTransformation &bt) const
{GetMaterial().Save(bt);}
+#endif
};
/// \brief Interface for asymmetric algorithms using public keys
diff --git a/randpool.h b/randpool.h
index cd823862..6dd70dc8 100644
--- a/randpool.h
+++ b/randpool.h
@@ -64,7 +64,7 @@ private:
/// \details You should migrate away from OldRandomPool at the earliest opportunity. Use a
/// modern random number generator or key derivation function, like AutoSeededRandomPool or
/// HKDF.
-/// \deprecated This class uses an old style PGP 2.6.x with MDC. The generator risks reusing
+/// \warning This class uses an old style PGP 2.6.x with MDC. The generator risks reusing
/// random random numbers after state rollback. You should migrate away from OldRandomPool
/// at the earliest opportunity.
/// \sa RandomPool, AutoSeededRandomPool, HKDF, P1363_KDF2, PKCS12_PBKDF, PKCS5_PBKDF2_HMAC
diff --git a/test.cpp b/test.cpp
index 63d72021..7b1e8176 100644
--- a/test.cpp
+++ b/test.cpp
@@ -455,17 +455,18 @@ SecByteBlock HexDecodeString(const char *hex)
void GenerateRSAKey(unsigned int keyLength, const char *privFilename, const char *pubFilename, const char *seed)
{
+ // DEREncode() changed to Save() at Issue 569.
RandomPool randPool;
randPool.IncorporateEntropy((byte *)seed, strlen(seed));
RSAES_OAEP_SHA_Decryptor priv(randPool, keyLength);
HexEncoder privFile(new FileSink(privFilename));
- priv.DEREncode(privFile);
+ priv.AccessMaterial().Save(privFile);
privFile.MessageEnd();
RSAES_OAEP_SHA_Encryptor pub(priv);
HexEncoder pubFile(new FileSink(pubFilename));
- pub.DEREncode(pubFile);
+ pub.AccessMaterial().Save(pubFile);
pubFile.MessageEnd();
}
diff --git a/validat2.cpp b/validat2.cpp
index c8537c30..49af29b4 100644
--- a/validat2.cpp
+++ b/validat2.cpp
@@ -898,12 +898,13 @@ bool ValidateEC2N()
{
std::cout << "\nEC2N validation suite running...\n\n";
+ // DEREncode() changed to Save() at Issue 569.
ECIES<EC2N>::Decryptor cpriv(GlobalRNG(), ASN1::sect193r1());
ECIES<EC2N>::Encryptor cpub(cpriv);
ByteQueue bq;
- cpriv.DEREncode(bq);
+ cpriv.AccessMaterial().Save(bq);
cpub.AccessKey().AccessGroupParameters().SetEncodeAsOID(true);
- cpub.DEREncode(bq);
+ cpub.AccessMaterial().Save(bq);
ECDSA<EC2N, SHA1>::Signer spriv(bq);
ECDSA<EC2N, SHA1>::Verifier spub(bq);
ECDH<EC2N>::Domain ecdhc(ASN1::sect193r1());