aboutsummaryrefslogtreecommitdiffstats
path: root/include/dl_group.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_group.h
Initial checkin1.5.6
Diffstat (limited to 'include/dl_group.h')
-rw-r--r--include/dl_group.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/include/dl_group.h b/include/dl_group.h
new file mode 100644
index 000000000..28161023e
--- /dev/null
+++ b/include/dl_group.h
@@ -0,0 +1,51 @@
+/*************************************************
+* Discrete Logarithm Group Header File *
+* (C) 1999-2006 The Botan Project *
+*************************************************/
+
+#ifndef BOTAN_DL_PARAM_H__
+#define BOTAN_DL_PARAM_H__
+
+#include <botan/bigint.h>
+#include <botan/data_src.h>
+
+namespace Botan {
+
+/*************************************************
+* Discrete Logarithm Group *
+*************************************************/
+class DL_Group
+ {
+ public:
+ const BigInt& get_p() const;
+ const BigInt& get_q() const;
+ const BigInt& get_g() const;
+
+ enum Format { ANSI_X9_42, ANSI_X9_57, PKCS_3 };
+ enum PrimeType { Strong, Prime_Subgroup, DSA_Kosherizer };
+
+ bool verify_group(bool) const;
+
+ std::string PEM_encode(Format) const;
+ SecureVector<byte> DER_encode(Format) const;
+ void BER_decode(DataSource&, Format);
+ void PEM_decode(DataSource&);
+
+ static BigInt make_dsa_generator(const BigInt&, const BigInt&);
+
+ DL_Group();
+ DL_Group(const std::string&);
+ DL_Group(u32bit, PrimeType = Strong);
+ DL_Group(const MemoryRegion<byte>&, u32bit = 1024, u32bit = 0);
+ DL_Group(const BigInt&, const BigInt&);
+ DL_Group(const BigInt&, const BigInt&, const BigInt&);
+ private:
+ void init_check() const;
+ void initialize(const BigInt&, const BigInt&, const BigInt&);
+ bool initialized;
+ BigInt p, q, g;
+ };
+
+}
+
+#endif