summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2018-01-19 07:56:12 -0500
committerJeffrey Walton <noloader@gmail.com>2018-01-19 07:56:12 -0500
commita5a684d92986e8e2ede25fb9d8c77c9a7e500f20 (patch)
tree3f7a652310dc5a211bb7738b85416c4de3e70c4f
parent4fd250c5c4a5026ac5d4cffea01ab916b6e77df6 (diff)
downloadcryptopp-git-a5a684d92986e8e2ede25fb9d8c77c9a7e500f20.tar.gz
Remove DL_PrivateKey_GFP_OldFormat (GH #567)
-rw-r--r--TestData/elgc1024.dat2
-rw-r--r--elgamal.h8
-rw-r--r--gfpcrypt.h102
3 files changed, 7 insertions, 105 deletions
diff --git a/TestData/elgc1024.dat b/TestData/elgc1024.dat
index b14cac46..c2f6a39b 100644
--- a/TestData/elgc1024.dat
+++ b/TestData/elgc1024.dat
@@ -1 +1 @@
-3082018E028181008B333697371663F8869E3EC80A414E46BBAFE41F6D40E754A01ADA60FE7D12ACD16DE311C4115293114F6B92A54195909276380F04BCD4ED5CD993ED7F516DF7A752B928E5035E0D3A1A979A1CDE8387734338793C02001D59B662D4FC8F2BF0EABB1F553F9F46F57E74BCABCBA4E458812DB601FCD04609D435317181236B9702010202818038FBC56751763146BC107ECC59E9BAD3852EBC38799B41B40EF5745810BCF9DCC6D569B7E61063EA358B0DF2A194910029B72A9CFD11AD240681D3F976EDCB18D79C0530AB2944DC1E314C2B520BE23066C802754C19BF2EC15DE0439E2663383CEA5163DC857B6A5F91079F54FB47C9B33F23A9EB6B3FCBA8581524B3EC5C75028181008B333697371663F8869E3EC80A414E46BBAFE41F6D40E754A01ADA60FE7D12ACD16DE311C4115293114F6B92A54195909276380F04BCD4ED5CD993ED7F516DF7A752B928E5035E0D3A1A979A1CDE8387734338793C02001D59B662D4FC8F2BF0EABB1F553F9F46F57E74BC7F3EC6725F2FC0A6155ADCA43CEE7319E623824852
+308201A40201003082011706072A8648CE3804013082010A028181008B333697371663F8869E3EC80A414E46BBAFE41F6D40E754A01ADA60FE7D12ACD16DE311C4115293114F6B92A54195909276380F04BCD4ED5CD993ED7F516DF7A752B928E5035E0D3A1A979A1CDE8387734338793C02001D59B662D4FC8F2BF0EABB1F553F9F46F57E74BCABCBA4E458812DB601FCD04609D435317181236B9702818045999B4B9B8B31FC434F1F640520A7235DD7F20FB6A073AA500D6D307F3E895668B6F188E208A94988A7B5C952A0CAC8493B1C07825E6A76AE6CC9F6BFA8B6FBD3A95C947281AF069D0D4BCD0E6F41C3B9A19C3C9E01000EACDB316A7E4795F8755D8FAA9FCFA37ABF3A5E55E5D2722C4096DB00FE682304EA1A98B8C091B5CB02010204818302818045999B4B9B8B31FC434F1F640520A7235DD7F20FB6A073AA500D6D307F3E895668B6F188E208A94988A7B5C952A0CAC8493B1C07825E6A76AE6CC9F6BFA8B6FBD3A95C947281AF069D0D4BCD0E6F41C3B9A19C3C9E01000EACDB316A7E4795F8755D8FAA9FCFA37ABF3A5E2958F40032EF29CB145C7481380458812D62F09287 \ No newline at end of file
diff --git a/elgamal.h b/elgamal.h
index 79344b62..f48b46c7 100644
--- a/elgamal.h
+++ b/elgamal.h
@@ -118,11 +118,15 @@ protected:
/// \class ElGamalKeys
/// \brief ElGamal key agreement and encryption schemes keys
+/// \details The ElGamalKeys class used DL_PrivateKey_GFP_OldFormat and DL_PublicKey_GFP_OldFormat
+/// for the PrivateKey and PublicKey typedef from about Crypto++ 1.0 through Crypto++ 5.6.5.
+/// At Crypto++ 6.0 the serialization format was cutover to standard PKCS8 and X509 encodings.
+/// \sa Commit XXX
struct ElGamalKeys
{
typedef DL_CryptoKeys_GFP::GroupParameters GroupParameters;
- typedef DL_PrivateKey_GFP_OldFormat<DL_CryptoKeys_GFP::PrivateKey> PrivateKey;
- typedef DL_PublicKey_GFP_OldFormat<DL_CryptoKeys_GFP::PublicKey> PublicKey;
+ typedef DL_CryptoKeys_GFP::PrivateKey PrivateKey;
+ typedef DL_CryptoKeys_GFP::PublicKey PublicKey;
};
/// \class ElGamal
diff --git a/gfpcrypt.h b/gfpcrypt.h
index 1f28a864..230846f7 100644
--- a/gfpcrypt.h
+++ b/gfpcrypt.h
@@ -332,16 +332,6 @@ public:
protected:
-#if 0
- // Determine bits without converting to an Integer
- inline unsigned int BitCount(const byte* buffer, size_t size) const
- {
- unsigned int idx = 0;
- while (idx < size && buffer[idx] == 0) { idx++; }
- return (size-idx)*8 - (8-BitPrecision(buffer[idx]));
- }
-#endif
-
Integer bits2int(const SecByteBlock& bits, size_t qlen) const
{
Integer ret(bits, bits.size());
@@ -592,98 +582,6 @@ struct DL_CryptoKeys_GFP
typedef DL_PrivateKey_GFP<GroupParameters> PrivateKey;
};
-/// \class DL_PublicKey_GFP_OldFormat
-/// \brief Discrete Log (DL) public key in GF(p) groups
-/// \tparam BASE GroupParameters derived class
-/// \deprecated This implementation uses a non-standard Crypto++ key format. New implementations
-/// should use DL_PublicKey_GFP and DL_PrivateKey_GFP
-template <class BASE>
-class DL_PublicKey_GFP_OldFormat : public BASE
-{
-public:
- virtual ~DL_PublicKey_GFP_OldFormat() {}
-
- void BERDecode(BufferedTransformation &bt)
- {
- BERSequenceDecoder seq(bt);
- Integer v1(seq);
- Integer v2(seq);
- Integer v3(seq);
-
- if (seq.EndReached())
- {
- this->AccessGroupParameters().Initialize(v1, v1/2, v2);
- this->SetPublicElement(v3);
- }
- else
- {
- Integer v4(seq);
- this->AccessGroupParameters().Initialize(v1, v2, v3);
- this->SetPublicElement(v4);
- }
-
- seq.MessageEnd();
- }
-
- void DEREncode(BufferedTransformation &bt) const
- {
- DERSequenceEncoder seq(bt);
- this->GetGroupParameters().GetModulus().DEREncode(seq);
- if (this->GetGroupParameters().GetCofactor() != 2)
- this->GetGroupParameters().GetSubgroupOrder().DEREncode(seq);
- this->GetGroupParameters().GetGenerator().DEREncode(seq);
- this->GetPublicElement().DEREncode(seq);
- seq.MessageEnd();
- }
-};
-
-/// \class DL_PrivateKey_GFP_OldFormat
-/// \brief Discrete Log (DL) private key in GF(p) groups
-/// \tparam BASE GroupParameters derived class
-/// \deprecated This implementation uses a non-standard Crypto++ key format. New implementations
-/// should use DL_PublicKey_GFP and DL_PrivateKey_GFP
-template <class BASE>
-class DL_PrivateKey_GFP_OldFormat : public BASE
-{
-public:
- virtual ~DL_PrivateKey_GFP_OldFormat() {}
-
- void BERDecode(BufferedTransformation &bt)
- {
- BERSequenceDecoder seq(bt);
- Integer v1(seq);
- Integer v2(seq);
- Integer v3(seq);
- Integer v4(seq);
-
- if (seq.EndReached())
- {
- this->AccessGroupParameters().Initialize(v1, v1/2, v2);
- this->SetPrivateExponent(v4 % (v1/2)); // some old keys may have x >= q
- }
- else
- {
- Integer v5(seq);
- this->AccessGroupParameters().Initialize(v1, v2, v3);
- this->SetPrivateExponent(v5);
- }
-
- seq.MessageEnd();
- }
-
- void DEREncode(BufferedTransformation &bt) const
- {
- DERSequenceEncoder seq(bt);
- this->GetGroupParameters().GetModulus().DEREncode(seq);
- if (this->GetGroupParameters().GetCofactor() != 2)
- this->GetGroupParameters().GetSubgroupOrder().DEREncode(seq);
- this->GetGroupParameters().GetGenerator().DEREncode(seq);
- this->GetGroupParameters().ExponentiateBase(this->GetPrivateExponent()).DEREncode(seq);
- this->GetPrivateExponent().DEREncode(seq);
- seq.MessageEnd();
- }
-};
-
/// \class GDSA
/// \brief DSA signature scheme
/// \tparam H HashTransformation derived class