aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey/dl_algo
diff options
context:
space:
mode:
Diffstat (limited to 'src/pubkey/dl_algo')
-rw-r--r--src/pubkey/dl_algo/dl_algo.cpp91
-rw-r--r--src/pubkey/dl_algo/dl_algo.h116
-rw-r--r--src/pubkey/dl_algo/info.txt8
3 files changed, 0 insertions, 215 deletions
diff --git a/src/pubkey/dl_algo/dl_algo.cpp b/src/pubkey/dl_algo/dl_algo.cpp
deleted file mode 100644
index 92c78ac79..000000000
--- a/src/pubkey/dl_algo/dl_algo.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
-* DL Scheme
-* (C) 1999-2007 Jack Lloyd
-*
-* Distributed under the terms of the Botan license
-*/
-
-#include <botan/dl_algo.h>
-#include <botan/numthry.h>
-#include <botan/workfactor.h>
-#include <botan/der_enc.h>
-#include <botan/ber_dec.h>
-
-namespace Botan {
-
-size_t DL_Scheme_PublicKey::estimated_strength() const
- {
- return dl_work_factor(group.get_p().bits());
- }
-
-AlgorithmIdentifier DL_Scheme_PublicKey::algorithm_identifier() const
- {
- return AlgorithmIdentifier(get_oid(),
- group.DER_encode(group_format()));
- }
-
-std::vector<byte> DL_Scheme_PublicKey::x509_subject_public_key() const
- {
- return DER_Encoder().encode(y).get_contents_unlocked();
- }
-
-DL_Scheme_PublicKey::DL_Scheme_PublicKey(const AlgorithmIdentifier& alg_id,
- const secure_vector<byte>& key_bits,
- DL_Group::Format format)
- {
- group.BER_decode(alg_id.parameters, format);
-
- BER_Decoder(key_bits).decode(y);
- }
-
-secure_vector<byte> DL_Scheme_PrivateKey::pkcs8_private_key() const
- {
- return DER_Encoder().encode(x).get_contents();
- }
-
-DL_Scheme_PrivateKey::DL_Scheme_PrivateKey(const AlgorithmIdentifier& alg_id,
- const secure_vector<byte>& key_bits,
- DL_Group::Format format)
- {
- group.BER_decode(alg_id.parameters, format);
-
- BER_Decoder(key_bits).decode(x);
- }
-
-/*
-* Check Public DL Parameters
-*/
-bool DL_Scheme_PublicKey::check_key(RandomNumberGenerator& rng,
- bool strong) const
- {
- if(y < 2 || y >= group_p())
- return false;
- if(!group.verify_group(rng, strong))
- return false;
- return true;
- }
-
-/*
-* Check DL Scheme Private Parameters
-*/
-bool DL_Scheme_PrivateKey::check_key(RandomNumberGenerator& rng,
- bool strong) const
- {
- const BigInt& p = group_p();
- const BigInt& g = group_g();
-
- if(y < 2 || y >= p || x < 2 || x >= p)
- return false;
- if(!group.verify_group(rng, strong))
- return false;
-
- if(!strong)
- return true;
-
- if(y != power_mod(g, x, p))
- return false;
-
- return true;
- }
-
-}
diff --git a/src/pubkey/dl_algo/dl_algo.h b/src/pubkey/dl_algo/dl_algo.h
deleted file mode 100644
index abd2acba4..000000000
--- a/src/pubkey/dl_algo/dl_algo.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
-* DL Scheme
-* (C) 1999-2007 Jack Lloyd
-*
-* Distributed under the terms of the Botan license
-*/
-
-#ifndef BOTAN_DL_ALGO_H__
-#define BOTAN_DL_ALGO_H__
-
-#include <botan/dl_group.h>
-#include <botan/x509_key.h>
-#include <botan/pkcs8.h>
-
-namespace Botan {
-
-/**
-* This class represents discrete logarithm (DL) public keys.
-*/
-class BOTAN_DLL DL_Scheme_PublicKey : public virtual Public_Key
- {
- public:
- bool check_key(RandomNumberGenerator& rng, bool) const;
-
- AlgorithmIdentifier algorithm_identifier() const;
-
- std::vector<byte> x509_subject_public_key() const;
-
- /**
- * Get the DL domain parameters of this key.
- * @return DL domain parameters of this key
- */
- const DL_Group& get_domain() const { return group; }
-
- /**
- * Get the public value y with y = g^x mod p where x is the secret key.
- */
- const BigInt& get_y() const { return y; }
-
- /**
- * Get the prime p of the underlying DL group.
- * @return prime p
- */
- const BigInt& group_p() const { return group.get_p(); }
-
- /**
- * Get the prime q of the underlying DL group.
- * @return prime q
- */
- const BigInt& group_q() const { return group.get_q(); }
-
- /**
- * Get the generator g of the underlying DL group.
- * @return generator g
- */
- const BigInt& group_g() const { return group.get_g(); }
-
- /**
- * Get the underlying groups encoding format.
- * @return encoding format
- */
- virtual DL_Group::Format group_format() const = 0;
-
- size_t estimated_strength() const override;
-
- DL_Scheme_PublicKey(const AlgorithmIdentifier& alg_id,
- const secure_vector<byte>& key_bits,
- DL_Group::Format group_format);
-
- protected:
- DL_Scheme_PublicKey() {}
-
- /**
- * The DL public key
- */
- BigInt y;
-
- /**
- * The DL group
- */
- DL_Group group;
- };
-
-/**
-* This class represents discrete logarithm (DL) private keys.
-*/
-class BOTAN_DLL DL_Scheme_PrivateKey : public virtual DL_Scheme_PublicKey,
- public virtual Private_Key
- {
- public:
- bool check_key(RandomNumberGenerator& rng, bool) const;
-
- /**
- * Get the secret key x.
- * @return secret key
- */
- const BigInt& get_x() const { return x; }
-
- secure_vector<byte> pkcs8_private_key() const;
-
- DL_Scheme_PrivateKey(const AlgorithmIdentifier& alg_id,
- const secure_vector<byte>& key_bits,
- DL_Group::Format group_format);
-
- protected:
- DL_Scheme_PrivateKey() {}
-
- /**
- * The DL private key
- */
- BigInt x;
- };
-
-}
-
-#endif
diff --git a/src/pubkey/dl_algo/info.txt b/src/pubkey/dl_algo/info.txt
deleted file mode 100644
index 6f3b3195d..000000000
--- a/src/pubkey/dl_algo/info.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-define DL_PUBLIC_KEY_FAMILY 20131128
-
-<requires>
-asn1
-dl_group
-numbertheory
-rng
-</requires>