monotone

monotone Mtn Source Tree

Root/botan/dl_group.h

1/*************************************************
2* Discrete Logarithm Group Header File *
3* (C) 1999-2007 The Botan Project *
4*************************************************/
5
6#ifndef BOTAN_DL_PARAM_H__
7#define BOTAN_DL_PARAM_H__
8
9#include <botan/bigint.h>
10#include <botan/data_src.h>
11
12namespace Botan {
13
14/*************************************************
15* Discrete Logarithm Group *
16*************************************************/
17class DL_Group
18 {
19 public:
20 const BigInt& get_p() const;
21 const BigInt& get_q() const;
22 const BigInt& get_g() const;
23
24 enum Format { ANSI_X9_42, ANSI_X9_57, PKCS_3 };
25 enum PrimeType { Strong, Prime_Subgroup, DSA_Kosherizer };
26
27 bool verify_group(bool) const;
28
29 std::string PEM_encode(Format) const;
30 SecureVector<byte> DER_encode(Format) const;
31 void BER_decode(DataSource&, Format);
32 void PEM_decode(DataSource&);
33
34 DL_Group();
35 DL_Group(const std::string&);
36 DL_Group(PrimeType, u32bit, u32bit = 0);
37 DL_Group(const MemoryRegion<byte>&, u32bit = 1024, u32bit = 0);
38 DL_Group(const BigInt&, const BigInt&);
39 DL_Group(const BigInt&, const BigInt&, const BigInt&);
40 private:
41 static BigInt make_dsa_generator(const BigInt&, const BigInt&);
42 static SecureVector<byte> generate_dsa_primes(BigInt&, BigInt&,
43 u32bit, u32bit);
44 static bool generate_dsa_primes(BigInt&, BigInt&, u32bit, u32bit,
45 const MemoryRegion<byte>&);
46
47 void init_check() const;
48 void initialize(const BigInt&, const BigInt&, const BigInt&);
49 bool initialized;
50 BigInt p, q, g;
51 };
52
53}
54
55#endif

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status