aboutsummaryrefslogtreecommitdiffstats
path: root/include/dl_algo.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-05-18 18:33:19 +0000
committerlloyd <[email protected]>2006-05-18 18:33:19 +0000
commita2c99d3270eb73ef2db5704fc54356c6b75096f8 (patch)
treead3d6c4fcc8dd0f403f8105598943616246fe172 /include/dl_algo.h
Initial checkin1.5.6
Diffstat (limited to 'include/dl_algo.h')
-rw-r--r--include/dl_algo.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/include/dl_algo.h b/include/dl_algo.h
new file mode 100644
index 000000000..ccb8a05a0
--- /dev/null
+++ b/include/dl_algo.h
@@ -0,0 +1,67 @@
+/*************************************************
+* DL Scheme Header File *
+* (C) 1999-2006 The Botan Project *
+*************************************************/
+
+#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 {
+
+/*************************************************
+* DL Public Key *
+*************************************************/
+class DL_Scheme_PublicKey : public virtual X509_PublicKey
+ {
+ public:
+ bool check_key(bool) const;
+
+ const DL_Group& get_domain() const { return group; }
+ const BigInt& get_y() const { return y; }
+
+ virtual ~DL_Scheme_PublicKey() {}
+ protected:
+ const BigInt& group_p() const { return group.get_p(); }
+ const BigInt& group_q() const { return group.get_q(); }
+ const BigInt& group_g() const { return group.get_g(); }
+
+ BigInt y;
+ DL_Group group;
+ private:
+ MemoryVector<byte> DER_encode_pub() const;
+ MemoryVector<byte> DER_encode_params() const;
+ void BER_decode_pub(DataSource&);
+ void BER_decode_params(DataSource&);
+
+ virtual DL_Group::Format group_format() const = 0;
+ virtual void X509_load_hook() {}
+ };
+
+/*************************************************
+* DL Private Key *
+*************************************************/
+class DL_Scheme_PrivateKey : public virtual DL_Scheme_PublicKey,
+ public virtual PKCS8_PrivateKey
+ {
+ public:
+ bool check_key(bool) const;
+
+ const BigInt& get_x() const { return x; }
+
+ virtual ~DL_Scheme_PrivateKey() {}
+ protected:
+ BigInt x;
+ private:
+ SecureVector<byte> DER_encode_priv() const;
+ void BER_decode_priv(DataSource&);
+
+ virtual void PKCS8_load_hook() {}
+ };
+
+}
+
+#endif