aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey/dl_group/dl_group.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-10-01 14:36:27 +0000
committerlloyd <[email protected]>2008-10-01 14:36:27 +0000
commit06e35ed5375028f246f57b99ccf639e8ed317b35 (patch)
tree32021a79d1617a147f7fa7ac29c1eae60f9024ce /src/pubkey/dl_group/dl_group.h
parent9320b5e5c1b64894a6ff8797f392b57dfd72dea3 (diff)
Rename pk dir to pubkey, avoids tab-completion collision with pk_pad
Diffstat (limited to 'src/pubkey/dl_group/dl_group.h')
-rw-r--r--src/pubkey/dl_group/dl_group.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/pubkey/dl_group/dl_group.h b/src/pubkey/dl_group/dl_group.h
new file mode 100644
index 000000000..7d631433e
--- /dev/null
+++ b/src/pubkey/dl_group/dl_group.h
@@ -0,0 +1,64 @@
+/*************************************************
+* Discrete Logarithm Group Header File *
+* (C) 1999-2008 Jack Lloyd *
+*************************************************/
+
+#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 BOTAN_DLL 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,
+
+ DSA_PARAMETERS = ANSI_X9_57,
+ DH_PARAMETERS = ANSI_X9_42,
+ X942_DH_PARAMETERS = ANSI_X9_42,
+ PKCS3_DH_PARAMETERS = PKCS_3
+ };
+
+ enum PrimeType { Strong, Prime_Subgroup, DSA_Kosherizer };
+
+ bool verify_group(RandomNumberGenerator& rng, bool) const;
+
+ std::string PEM_encode(Format) const;
+ SecureVector<byte> DER_encode(Format) const;
+ void BER_decode(DataSource&, Format);
+ void PEM_decode(DataSource&);
+
+ DL_Group();
+ DL_Group(const std::string&);
+
+ DL_Group(RandomNumberGenerator& rng, PrimeType, u32bit, u32bit = 0);
+ DL_Group(RandomNumberGenerator& rng, const MemoryRegion<byte>&,
+ u32bit = 1024, u32bit = 0);
+
+ DL_Group(const BigInt& p, const BigInt& g);
+ DL_Group(const BigInt& p, const BigInt& g, const BigInt& q);
+ private:
+ static BigInt make_dsa_generator(const BigInt&, const BigInt&);
+
+ void init_check() const;
+ void initialize(const BigInt&, const BigInt&, const BigInt&);
+ bool initialized;
+ BigInt p, q, g;
+ };
+
+}
+
+#endif