Remove AsymmetricAlgorithm::BERDecode (GH #569)
parent
565bd844fc
commit
9b174e84de
|
|
@ -2307,6 +2307,10 @@ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CryptoParameters : public GeneratableCrypt
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief Interface for asymmetric algorithms
|
/// \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
|
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE AsymmetricAlgorithm : public Algorithm
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -2320,17 +2324,21 @@ public:
|
||||||
/// \return a const reference to the crypto material
|
/// \return a const reference to the crypto material
|
||||||
virtual const CryptoMaterial & GetMaterial() const =0;
|
virtual const CryptoMaterial & GetMaterial() const =0;
|
||||||
|
|
||||||
|
#if 0
|
||||||
/// \brief Loads this object from a BufferedTransformation
|
/// \brief Loads this object from a BufferedTransformation
|
||||||
/// \param bt a BufferedTransformation object
|
/// \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>
|
/// \deprecated for backwards compatibility, calls <tt>AccessMaterial().Load(bt)</tt>
|
||||||
void BERDecode(BufferedTransformation &bt)
|
void BERDecode(BufferedTransformation &bt)
|
||||||
{AccessMaterial().Load(bt);}
|
{AccessMaterial().Load(bt);}
|
||||||
|
|
||||||
/// \brief Saves this object to a BufferedTransformation
|
/// \brief Saves this object to a BufferedTransformation
|
||||||
/// \param bt a BufferedTransformation object
|
/// \param bt a BufferedTransformation object
|
||||||
|
/// \details Use of DEREncode() changed to Save() at Issue 569.
|
||||||
/// \deprecated for backwards compatibility, calls GetMaterial().Save(bt)
|
/// \deprecated for backwards compatibility, calls GetMaterial().Save(bt)
|
||||||
void DEREncode(BufferedTransformation &bt) const
|
void DEREncode(BufferedTransformation &bt) const
|
||||||
{GetMaterial().Save(bt);}
|
{GetMaterial().Save(bt);}
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief Interface for asymmetric algorithms using public keys
|
/// \brief Interface for asymmetric algorithms using public keys
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ private:
|
||||||
/// \details You should migrate away from OldRandomPool at the earliest opportunity. Use a
|
/// \details You should migrate away from OldRandomPool at the earliest opportunity. Use a
|
||||||
/// modern random number generator or key derivation function, like AutoSeededRandomPool or
|
/// modern random number generator or key derivation function, like AutoSeededRandomPool or
|
||||||
/// HKDF.
|
/// 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
|
/// random random numbers after state rollback. You should migrate away from OldRandomPool
|
||||||
/// at the earliest opportunity.
|
/// at the earliest opportunity.
|
||||||
/// \sa RandomPool, AutoSeededRandomPool, HKDF, P1363_KDF2, PKCS12_PBKDF, PKCS5_PBKDF2_HMAC
|
/// \sa RandomPool, AutoSeededRandomPool, HKDF, P1363_KDF2, PKCS12_PBKDF, PKCS5_PBKDF2_HMAC
|
||||||
|
|
|
||||||
5
test.cpp
5
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)
|
void GenerateRSAKey(unsigned int keyLength, const char *privFilename, const char *pubFilename, const char *seed)
|
||||||
{
|
{
|
||||||
|
// DEREncode() changed to Save() at Issue 569.
|
||||||
RandomPool randPool;
|
RandomPool randPool;
|
||||||
randPool.IncorporateEntropy((byte *)seed, strlen(seed));
|
randPool.IncorporateEntropy((byte *)seed, strlen(seed));
|
||||||
|
|
||||||
RSAES_OAEP_SHA_Decryptor priv(randPool, keyLength);
|
RSAES_OAEP_SHA_Decryptor priv(randPool, keyLength);
|
||||||
HexEncoder privFile(new FileSink(privFilename));
|
HexEncoder privFile(new FileSink(privFilename));
|
||||||
priv.DEREncode(privFile);
|
priv.AccessMaterial().Save(privFile);
|
||||||
privFile.MessageEnd();
|
privFile.MessageEnd();
|
||||||
|
|
||||||
RSAES_OAEP_SHA_Encryptor pub(priv);
|
RSAES_OAEP_SHA_Encryptor pub(priv);
|
||||||
HexEncoder pubFile(new FileSink(pubFilename));
|
HexEncoder pubFile(new FileSink(pubFilename));
|
||||||
pub.DEREncode(pubFile);
|
pub.AccessMaterial().Save(pubFile);
|
||||||
pubFile.MessageEnd();
|
pubFile.MessageEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -898,12 +898,13 @@ bool ValidateEC2N()
|
||||||
{
|
{
|
||||||
std::cout << "\nEC2N validation suite running...\n\n";
|
std::cout << "\nEC2N validation suite running...\n\n";
|
||||||
|
|
||||||
|
// DEREncode() changed to Save() at Issue 569.
|
||||||
ECIES<EC2N>::Decryptor cpriv(GlobalRNG(), ASN1::sect193r1());
|
ECIES<EC2N>::Decryptor cpriv(GlobalRNG(), ASN1::sect193r1());
|
||||||
ECIES<EC2N>::Encryptor cpub(cpriv);
|
ECIES<EC2N>::Encryptor cpub(cpriv);
|
||||||
ByteQueue bq;
|
ByteQueue bq;
|
||||||
cpriv.DEREncode(bq);
|
cpriv.AccessMaterial().Save(bq);
|
||||||
cpub.AccessKey().AccessGroupParameters().SetEncodeAsOID(true);
|
cpub.AccessKey().AccessGroupParameters().SetEncodeAsOID(true);
|
||||||
cpub.DEREncode(bq);
|
cpub.AccessMaterial().Save(bq);
|
||||||
ECDSA<EC2N, SHA1>::Signer spriv(bq);
|
ECDSA<EC2N, SHA1>::Signer spriv(bq);
|
||||||
ECDSA<EC2N, SHA1>::Verifier spub(bq);
|
ECDSA<EC2N, SHA1>::Verifier spub(bq);
|
||||||
ECDH<EC2N>::Domain ecdhc(ASN1::sect193r1());
|
ECDH<EC2N>::Domain ecdhc(ASN1::sect193r1());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue