monotone

monotone Mtn Source Tree

Root/botan/dl_param.h

1/*************************************************
2* Discrete Logarithm Group Header File *
3* (C) 1999-2005 The Botan Project *
4*************************************************/
5
6#ifndef BOTAN_DL_PARM_H__
7#define BOTAN_DL_PARM_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 static BigInt make_dsa_generator(const BigInt&, const BigInt&);
35
36 DL_Group();
37 DL_Group(u32bit, PrimeType = Strong);
38 DL_Group(const MemoryRegion<byte>&, u32bit = 1024, u32bit = 0);
39 DL_Group(const BigInt&, const BigInt&);
40 DL_Group(const BigInt&, const BigInt&, const BigInt&);
41 private:
42 void init_check() const;
43 void initialize(const BigInt&, const BigInt&, const BigInt&);
44 bool initialized;
45 BigInt p, q, g;
46 };
47
48/*************************************************
49* Retrieve a DL group by name *
50*************************************************/
51const DL_Group& get_dl_group(const std::string&);
52
53/*************************************************
54* Register a named DL group *
55*************************************************/
56void add_dl_group(const std::string&, const DL_Group&);
57
58}
59
60#endif

Archive Download this file

Branches

Tags

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