Botan  1.11.33
Crypto and TLS for C++11
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Botan::DL_Group Class Reference

#include <dl_group.h>

Public Types

enum  Format {
  ANSI_X9_42, ANSI_X9_57, PKCS_3, DSA_PARAMETERS = ANSI_X9_57,
  DH_PARAMETERS = ANSI_X9_42, ANSI_X9_42_DH_PARAMETERS = ANSI_X9_42, PKCS3_DH_PARAMETERS = PKCS_3
}
 
enum  PrimeType { Strong, Prime_Subgroup, DSA_Kosherizer }
 

Public Member Functions

void BER_decode (const std::vector< uint8_t > &ber, Format format)
 
std::vector< uint8_t > DER_encode (Format format) const
 
 DL_Group ()
 
 DL_Group (const std::string &name)
 
 DL_Group (RandomNumberGenerator &rng, PrimeType type, size_t pbits, size_t qbits=0)
 
 DL_Group (RandomNumberGenerator &rng, const std::vector< uint8_t > &seed, size_t pbits=1024, size_t qbits=0)
 
 DL_Group (const BigInt &p, const BigInt &g)
 
 DL_Group (const BigInt &p, const BigInt &q, const BigInt &g)
 
const BigIntget_g () const
 
const BigIntget_p () const
 
const BigIntget_q () const
 
void PEM_decode (const std::string &pem)
 
std::string PEM_encode (Format format) const
 
bool verify_group (RandomNumberGenerator &rng, bool strong) const
 

Static Public Member Functions

static std::string PEM_for_named_group (const std::string &name)
 

Detailed Description

This class represents discrete logarithm groups. It holds a prime p, a prime q = (p-1)/2 and g = x^((p-1)/q) mod p.

Definition at line 20 of file dl_group.h.

Member Enumeration Documentation

§ Format

The DL group encoding format variants.

Enumerator
ANSI_X9_42 
ANSI_X9_57 
PKCS_3 
DSA_PARAMETERS 
DH_PARAMETERS 
ANSI_X9_42_DH_PARAMETERS 
PKCS3_DH_PARAMETERS 

Definition at line 45 of file dl_group.h.

§ PrimeType

Determine the prime creation for DL groups.

Enumerator
Strong 
Prime_Subgroup 
DSA_Kosherizer 

Definition at line 59 of file dl_group.h.

Constructor & Destructor Documentation

§ DL_Group() [1/6]

Botan::DL_Group::DL_Group ( )

Construct a DL group with uninitialized internal value. Use this constructor is you wish to set the groups values from a DER or PEM encoded group.

Definition at line 22 of file dl_group.cpp.

23  {
24  m_initialized = false;
25  }

§ DL_Group() [2/6]

Botan::DL_Group::DL_Group ( const std::string &  name)

Construct a DL group that is registered in the configuration.

Parameters
namethe name that is configured in the global configuration for the desired group. If no configuration file is specified, the default values from the file policy.cpp will be used. For instance, use "modp/ietf/3072".

Definition at line 30 of file dl_group.cpp.

References PEM_decode(), and PEM_for_named_group().

31  {
32  const std::string pem = PEM_for_named_group(name);
33 
34  if(pem == "")
35  throw Invalid_Argument("DL_Group: Unknown group " + name);
36 
37  PEM_decode(pem);
38  }
void PEM_decode(const std::string &pem)
Definition: dl_group.cpp:322
static std::string PEM_for_named_group(const std::string &name)
Definition: dl_named.cpp:12

§ DL_Group() [3/6]

Botan::DL_Group::DL_Group ( RandomNumberGenerator rng,
PrimeType  type,
size_t  pbits,
size_t  qbits = 0 
)

Create a new group randomly.

Parameters
rngthe random number generator to use
typespecifies how the creation of primes p and q shall be performed. If type=Strong, then p will be determined as a safe prime, and q will be chosen as (p-1)/2. If type=Prime_Subgroup and qbits = 0, then the size of q will be determined according to the estimated difficulty of the DL problem. If type=DSA_Kosherizer, DSA primes will be created.
pbitsthe number of bits of p
qbitsthe number of bits of q. Leave it as 0 to have the value determined according to pbits.

Definition at line 43 of file dl_group.cpp.

References Botan::BigInt::bits(), Botan::dl_exponent_size(), DSA_Kosherizer, Botan::generate_dsa_primes(), Botan::is_prime(), Botan::jacobi(), Prime_Subgroup, Botan::PRIME_TABLE_SIZE, Botan::PRIMES, Botan::random_prime(), Botan::random_safe_prime(), Botan::BigInt::randomize(), Strong, and Botan::ASN1::to_string().

45  {
46  if(pbits < 1024)
47  throw Invalid_Argument("DL_Group: prime size " + std::to_string(pbits) +
48  " is too small");
49 
50  if(type == Strong)
51  {
52  m_p = random_safe_prime(rng, pbits);
53  m_q = (m_p - 1) / 2;
54  m_g = 2;
55 
56  /*
57  Always choose a generator that is quadratic reside mod p,
58  this forces g to be a generator of the subgroup of size q.
59  */
60  if(jacobi(m_g, m_p) != 1)
61  {
62  // prime table does not contain 2
63  for(size_t i = 0; i < PRIME_TABLE_SIZE; ++i)
64  {
65  m_g = PRIMES[i];
66  if(jacobi(m_g, m_p) == 1)
67  break;
68  }
69  }
70  }
71  else if(type == Prime_Subgroup)
72  {
73  if(!qbits)
74  qbits = dl_exponent_size(pbits);
75 
76  m_q = random_prime(rng, qbits);
77  BigInt X;
78  while(m_p.bits() != pbits || !is_prime(m_p, rng))
79  {
80  X.randomize(rng, pbits);
81  m_p = X - (X % (2*m_q) - 1);
82  }
83 
84  m_g = make_dsa_generator(m_p, m_q);
85  }
86  else if(type == DSA_Kosherizer)
87  {
88  qbits = qbits ? qbits : ((pbits <= 1024) ? 160 : 256);
89 
90  generate_dsa_primes(rng, m_p, m_q, pbits, qbits);
91 
92  m_g = make_dsa_generator(m_p, m_q);
93  }
94 
95  m_initialized = true;
96  }
const size_t PRIME_TABLE_SIZE
Definition: numthry.h:240
const uint16_t BOTAN_DLL PRIMES[]
Definition: primes.cpp:12
size_t dl_exponent_size(size_t bits)
Definition: workfactor.cpp:40
size_t bits() const
Definition: bigint.cpp:184
bool is_prime(const BigInt &n, RandomNumberGenerator &rng, size_t prob, bool is_random)
Definition: numthry.cpp:441
std::string to_string(const BER_Object &obj)
Definition: asn1_obj.cpp:47
MechanismType type
bool generate_dsa_primes(RandomNumberGenerator &rng, BigInt &p, BigInt &q, size_t pbits, size_t qbits, const std::vector< uint8_t > &seed_c, size_t offset)
Definition: dsa_gen.cpp:39
BigInt random_safe_prime(RandomNumberGenerator &rng, size_t bits)
Definition: make_prm.cpp:114
int32_t jacobi(const BigInt &a, const BigInt &n)
Definition: jacobi.cpp:15
BigInt random_prime(RandomNumberGenerator &rng, size_t bits, const BigInt &coprime, size_t equiv, size_t modulo)
Definition: make_prm.cpp:17

§ DL_Group() [4/6]

Botan::DL_Group::DL_Group ( RandomNumberGenerator rng,
const std::vector< uint8_t > &  seed,
size_t  pbits = 1024,
size_t  qbits = 0 
)

Create a DSA group with a given seed.

Parameters
rngthe random number generator to use
seedthe seed to use to create the random primes
pbitsthe desired bit size of the prime p
qbitsthe desired bit size of the prime q.

Definition at line 101 of file dl_group.cpp.

References Botan::generate_dsa_primes().

104  {
105  if(!generate_dsa_primes(rng, m_p, m_q, pbits, qbits, seed))
106  throw Invalid_Argument("DL_Group: The seed given does not "
107  "generate a DSA group");
108 
109  m_g = make_dsa_generator(m_p, m_q);
110 
111  m_initialized = true;
112  }
bool generate_dsa_primes(RandomNumberGenerator &rng, BigInt &p, BigInt &q, size_t pbits, size_t qbits, const std::vector< uint8_t > &seed_c, size_t offset)
Definition: dsa_gen.cpp:39

§ DL_Group() [5/6]

Botan::DL_Group::DL_Group ( const BigInt p,
const BigInt g 
)

Create a DL group. The prime q will be determined according to p.

Parameters
pthe prime p
gthe base g

Definition at line 117 of file dl_group.cpp.

118  {
119  initialize(p1, 0, g1);
120  }

§ DL_Group() [6/6]

Botan::DL_Group::DL_Group ( const BigInt p,
const BigInt q,
const BigInt g 
)

Create a DL group.

Parameters
pthe prime p
qthe prime q
gthe base g

Definition at line 125 of file dl_group.cpp.

126  {
127  initialize(p1, q1, g1);
128  }

Member Function Documentation

§ BER_decode()

void Botan::DL_Group::BER_decode ( const std::vector< uint8_t > &  ber,
Format  format 
)

Decode a DER/BER encoded group into this instance.

Parameters
bera vector containing the DER/BER encoded group
formatthe format of the encoded group

Definition at line 285 of file dl_group.cpp.

References ANSI_X9_42, ANSI_X9_57, Botan::BER_Decoder::decode(), Botan::BER_Decoder::discard_remaining(), PKCS_3, Botan::SEQUENCE, Botan::BER_Decoder::start_cons(), Botan::ASN1::to_string(), and Botan::BER_Decoder::verify_end().

Referenced by Botan::DL_Scheme_PrivateKey::DL_Scheme_PrivateKey(), Botan::DL_Scheme_PublicKey::DL_Scheme_PublicKey(), and PEM_decode().

287  {
288  BigInt new_p, new_q, new_g;
289 
290  BER_Decoder decoder(data);
291  BER_Decoder ber = decoder.start_cons(SEQUENCE);
292 
293  if(format == ANSI_X9_57)
294  {
295  ber.decode(new_p)
296  .decode(new_q)
297  .decode(new_g)
298  .verify_end();
299  }
300  else if(format == ANSI_X9_42)
301  {
302  ber.decode(new_p)
303  .decode(new_g)
304  .decode(new_q)
305  .discard_remaining();
306  }
307  else if(format == PKCS_3)
308  {
309  ber.decode(new_p)
310  .decode(new_g)
311  .discard_remaining();
312  }
313  else
314  throw Invalid_Argument("Unknown DL_Group encoding " + std::to_string(format));
315 
316  initialize(new_p, new_q, new_g);
317  }
std::string to_string(const BER_Object &obj)
Definition: asn1_obj.cpp:47

§ DER_encode()

std::vector< uint8_t > Botan::DL_Group::DER_encode ( Format  format) const

Encode this group into a string using DER encoding.

Parameters
formatthe encoding format
Returns
string holding the DER encoded group

Definition at line 225 of file dl_group.cpp.

References ANSI_X9_42, ANSI_X9_57, Botan::DER_Encoder::encode(), Botan::DER_Encoder::end_cons(), Botan::DER_Encoder::get_contents_unlocked(), PKCS_3, Botan::SEQUENCE, Botan::DER_Encoder::start_cons(), and Botan::ASN1::to_string().

Referenced by Botan::DL_Scheme_PublicKey::algorithm_identifier(), and PEM_encode().

226  {
227  init_check();
228 
229  if((m_q == 0) && (format != PKCS_3))
230  throw Encoding_Error("The ANSI DL parameter formats require a subgroup");
231 
232  if(format == ANSI_X9_57)
233  {
234  return DER_Encoder()
235  .start_cons(SEQUENCE)
236  .encode(m_p)
237  .encode(m_q)
238  .encode(m_g)
239  .end_cons()
240  .get_contents_unlocked();
241  }
242  else if(format == ANSI_X9_42)
243  {
244  return DER_Encoder()
245  .start_cons(SEQUENCE)
246  .encode(m_p)
247  .encode(m_g)
248  .encode(m_q)
249  .end_cons()
250  .get_contents_unlocked();
251  }
252  else if(format == PKCS_3)
253  {
254  return DER_Encoder()
255  .start_cons(SEQUENCE)
256  .encode(m_p)
257  .encode(m_g)
258  .end_cons()
259  .get_contents_unlocked();
260  }
261 
262  throw Invalid_Argument("Unknown DL_Group encoding " + std::to_string(format));
263  }
std::string to_string(const BER_Object &obj)
Definition: asn1_obj.cpp:47

§ get_g()

const BigInt & Botan::DL_Group::get_g ( ) const

Get the base g.

Returns
base g

Definition at line 205 of file dl_group.cpp.

Referenced by Botan::generate_srp6_verifier(), Botan::TLS::Server_Key_Exchange::Server_Key_Exchange(), Botan::srp6_client_agree(), and Botan::SRP6_Server_Session::step1().

206  {
207  init_check();
208  return m_g;
209  }

§ get_p()

const BigInt & Botan::DL_Group::get_p ( ) const

Get the prime p.

Returns
prime p

Definition at line 196 of file dl_group.cpp.

Referenced by Botan::generate_srp6_verifier(), Botan::DL_Scheme_PublicKey::key_length(), Botan::TLS::Server_Key_Exchange::Server_Key_Exchange(), Botan::srp6_client_agree(), and Botan::SRP6_Server_Session::step1().

197  {
198  init_check();
199  return m_p;
200  }

§ get_q()

const BigInt & Botan::DL_Group::get_q ( ) const

Get the prime q.

Returns
prime q

Definition at line 214 of file dl_group.cpp.

215  {
216  init_check();
217  if(m_q == 0)
218  throw Invalid_State("DLP group has no q prime specified");
219  return m_q;
220  }

§ PEM_decode()

void Botan::DL_Group::PEM_decode ( const std::string &  pem)

Decode a PEM encoded group into this instance.

Parameters
pemthe PEM encoding of the group

Definition at line 322 of file dl_group.cpp.

References ANSI_X9_42, ANSI_X9_57, BER_decode(), Botan::PEM_Code::decode(), PKCS_3, Botan::power_mod(), Botan::PRIME_TABLE_SIZE, Botan::PRIMES, and Botan::unlock().

Referenced by DL_Group().

323  {
324  std::string label;
325 
326  auto ber = unlock(PEM_Code::decode(pem, label));
327 
328  if(label == "DH PARAMETERS")
329  BER_decode(ber, PKCS_3);
330  else if(label == "DSA PARAMETERS")
331  BER_decode(ber, ANSI_X9_57);
332  else if(label == "X942 DH PARAMETERS" || label == "X9.42 DH PARAMETERS")
333  BER_decode(ber, ANSI_X9_42);
334  else
335  throw Decoding_Error("DL_Group: Invalid PEM label " + label);
336  }
secure_vector< uint8_t > decode(DataSource &source, std::string &label)
Definition: pem.cpp:68
std::vector< T > unlock(const secure_vector< T > &in)
Definition: secmem.h:117
void BER_decode(const std::vector< uint8_t > &ber, Format format)
Definition: dl_group.cpp:285

§ PEM_encode()

std::string Botan::DL_Group::PEM_encode ( Format  format) const

Encode this group into a string using PEM encoding.

Parameters
formatthe encoding format
Returns
string holding the PEM encoded group

Definition at line 268 of file dl_group.cpp.

References ANSI_X9_42, ANSI_X9_57, DER_encode(), Botan::PEM_Code::encode(), PKCS_3, and Botan::ASN1::to_string().

269  {
270  const std::vector<uint8_t> encoding = DER_encode(format);
271 
272  if(format == PKCS_3)
273  return PEM_Code::encode(encoding, "DH PARAMETERS");
274  else if(format == ANSI_X9_57)
275  return PEM_Code::encode(encoding, "DSA PARAMETERS");
276  else if(format == ANSI_X9_42)
277  return PEM_Code::encode(encoding, "X9.42 DH PARAMETERS");
278  else
279  throw Invalid_Argument("Unknown DL_Group encoding " + std::to_string(format));
280  }
std::string encode(const uint8_t der[], size_t length, const std::string &label, size_t width)
Definition: pem.cpp:43
std::string to_string(const BER_Object &obj)
Definition: asn1_obj.cpp:47
std::vector< uint8_t > DER_encode(Format format) const
Definition: dl_group.cpp:225

§ PEM_for_named_group()

std::string Botan::DL_Group::PEM_for_named_group ( const std::string &  name)
static

Return PEM representation of named DL group

Definition at line 12 of file dl_named.cpp.

Referenced by DL_Group().

13  {
14  if(name == "modp/ietf/1024")
15  return
16  "-----BEGIN X942 DH PARAMETERS-----"
17  "MIIBCgKBgQD//////////8kP2qIhaMI0xMZii4DcHNEpAk4IimfMdAILvqY7E5si"
18  "UUoIeY40BN3vlRmzzTpDGzArCm3yXxQ3T+E1bW1RwkXkhbV2Yl5+xvRMQummN+1r"
19  "C/9ctvQGt+3uOGv7Womfpa6fJBF8Sx/mSShmUezmU4H//////////wIBAgKBgH//"
20  "////////5IftURC0YRpiYzFFwG4OaJSBJwRFM+Y6AQXfUx2JzZEopQQ8xxoCbvfK"
21  "jNnmnSGNmBWFNvkvihun8Jq2tqjhIvJC2rsxLz9jeiYhdNMb9rWF/65begNb9vcc"
22  "Nf2tRM/S10+SCL4lj/MklDMo9nMpwP//////////"
23  "-----END X942 DH PARAMETERS-----";
24 
25  if(name == "modp/srp/1024")
26  return
27  "-----BEGIN X942 DH PARAMETERS-----"
28  "MIIBCgKBgQDurwq5rbON1pwz+Ar6j8XoYHJhh3X/PAueojFMnCVldtZ033SW6oHT"
29  "ODtIE9aSxuDg1djiULmL5I5JXB1gidrRXcfXtGFU1rbOjvStabFdSYJVmyl7zxiF"
30  "xSn1ZmYOV+xo7bw8BXJswC/Uy/SXbqqa/VE4/oN2Q1ufxh0vwOsG4wIBAgKBgHdX"
31  "hVzW2cbrThn8BX1H4vQwOTDDuv+eBc9RGKZOErK7azpvukt1QOmcHaQJ60ljcHBq"
32  "7HEoXMXyRySuDrBE7Wiu4+vaMKprW2dHela02K6kwSrNlL3njELilPqzMwcr9jR2"
33  "3h4CuTZgF+pl+ku3VU1+qJx/Qbshrc/jDpfgdYNx"
34  "-----END X942 DH PARAMETERS-----";
35 
36  if(name == "modp/ietf/1536")
37  return
38  "-----BEGIN X942 DH PARAMETERS-----"
39  "MIIBigKBwQD//////////8kP2qIhaMI0xMZii4DcHNEpAk4IimfMdAILvqY7E5si"
40  "UUoIeY40BN3vlRmzzTpDGzArCm3yXxQ3T+E1bW1RwkXkhbV2Yl5+xvRMQummN+1r"
41  "C/9ctvQGt+3uOGv7Womfpa6fJBF8Sx/mSShmUezkWz3CAHy4oWO/BZjaSDYcVdOa"
42  "aRY/qP0kz1+DZV0j3KOtlhxi81YghVK7ntUpB3CWlm1nDDVOSryYBPF0bAjKI3Mn"
43  "//////////8CAQICgcB//////////+SH7VEQtGEaYmMxRcBuDmiUgScERTPmOgEF"
44  "31Mdic2RKKUEPMcaAm73yozZ5p0hjZgVhTb5L4obp/Catrao4SLyQtq7MS8/Y3om"
45  "IXTTG/a1hf+uW3oDW/b3HDX9rUTP0tdPkgi+JY/zJJQzKPZyLZ7hAD5cULHfgsxt"
46  "JBsOKunNNIsf1H6SZ6/Bsq6R7lHWyw4xeasQQqldz2qUg7hLSzazhhqnJV5MAni6"
47  "NgRlEbmT//////////8="
48  "-----END X942 DH PARAMETERS-----";
49 
50  if(name == "modp/srp/1536")
51  return
52  "-----BEGIN DH PARAMETERS-----"
53  "MIHHAoHBAJ3vPK+5OSd6sfEqhheke7vbpR30maxMgL7uqWFLGcxNX09fVW4ny95R"
54  "xqlL5GB6KRVYkDug0PhDgLZVu5oi6NzfAop87Gfw0IE0sci5eYkUm2CeC+O6tj1H"
55  "VIOB28Wx/HZOP0tT3Z2hFYv9PiucjPVu3wGVOTSWJ9sv1T0kt8SGZXcuQ31sf4zk"
56  "QnNK98y3roN8Jkrjqb64f4ov6bi1KS5aAh//XpFHnoznoowkQsbzFRgPk0maI03P"
57  "duP+0TX5uwIBAg=="
58  "-----END DH PARAMETERS-----";
59 
60  if(name == "modp/ietf/2048")
61  return
62  "-----BEGIN X942 DH PARAMETERS-----"
63  "MIICDAKCAQEA///////////JD9qiIWjCNMTGYouA3BzRKQJOCIpnzHQCC76mOxOb"
64  "IlFKCHmONATd75UZs806QxswKwpt8l8UN0/hNW1tUcJF5IW1dmJefsb0TELppjft"
65  "awv/XLb0Brft7jhr+1qJn6WunyQRfEsf5kkoZlHs5Fs9wgB8uKFjvwWY2kg2HFXT"
66  "mmkWP6j9JM9fg2VdI9yjrZYcYvNWIIVSu57VKQdwlpZtZww1Tkq8mATxdGwIyhgh"
67  "fDKQXkYuNs474553LBgOhgObJ4Oi7Aeij7XFXfBvTFLJ3ivL9pVYFxg5lUl86pVq"
68  "5RXSJhiY+gUQFXKOWoqsqmj//////////wIBAgKCAQB//////////+SH7VEQtGEa"
69  "YmMxRcBuDmiUgScERTPmOgEF31Mdic2RKKUEPMcaAm73yozZ5p0hjZgVhTb5L4ob"
70  "p/Catrao4SLyQtq7MS8/Y3omIXTTG/a1hf+uW3oDW/b3HDX9rUTP0tdPkgi+JY/z"
71  "JJQzKPZyLZ7hAD5cULHfgsxtJBsOKunNNIsf1H6SZ6/Bsq6R7lHWyw4xeasQQqld"
72  "z2qUg7hLSzazhhqnJV5MAni6NgRlDBC+GUgvIxcbZx3xzzuWDAdDAc2TwdF2A9FH"
73  "2uKu+DemKWTvFeX7SqwLjBzKpL51SrVyiukTDEx9AogKuUctRVZVNH//////////"
74  "-----END X942 DH PARAMETERS-----";
75 
76  if(name == "modp/srp/2048")
77  return
78  "-----BEGIN X942 DH PARAMETERS-----"
79  "MIICDAKCAQEArGvbQTJKmpvxZt5eE4lYL69ytmUZh+4H/DGSlD21YFCjcynLtKCZ"
80  "7YGT4HV3Z6E91SMSq0sDMQ3Nf0ip2gT9UOgIOWntt2ewz2CVF5oWOrNmGgX71fqq"
81  "6CkYqZYvC5O4Vfl5k+yXXuqoDXQK2/T/dHNZ0EHVwz6nHSgeRGsUdzvKl7Q6I/uA"
82  "Fna9IHpDbGSB8dK5B4cXRhpbnTLmiPh3SFRFI7UksNV9Xqd6J3XS7PoDLPvb9S+z"
83  "eGFgJ5AE5Xrmr4dOcwPOUymczAQce8MI2CpWmPOo0MOCca41+Onb+7aUtcgD2J96"
84  "5DXeI21SX1R1m2XjcvzWjvIPpxEfnkr/cwIBAgKCAQBWNe2gmSVNTfizby8JxKwX"
85  "17lbMozD9wP+GMlKHtqwKFG5lOXaUEz2wMnwOruz0J7qkYlVpYGYhua/pFTtAn6o"
86  "dAQctPbbs9hnsEqLzQsdWbMNAv3q/VV0FIxUyxeFydwq/LzJ9kuvdVQGugVt+n+6"
87  "OazoIOrhn1OOlA8iNYo7neVL2h0R/cALO16QPSG2MkD46VyDw4ujDS3OmXNEfDuk"
88  "KiKR2pJYar6vU70Tuul2fQGWfe36l9m8MLATyAJyvXNXw6c5gecplM5mAg494YRs"
89  "FStMedRoYcE41xr8dO3920pa5AHsT71yGu8RtqkvqjrNsvG5fmtHeQfTiI/PJX+5"
90  "-----END X942 DH PARAMETERS-----";
91 
92  if(name == "modp/ietf/3072")
93  return
94  "-----BEGIN X942 DH PARAMETERS-----"
95  "MIIDDAKCAYEA///////////JD9qiIWjCNMTGYouA3BzRKQJOCIpnzHQCC76mOxOb"
96  "IlFKCHmONATd75UZs806QxswKwpt8l8UN0/hNW1tUcJF5IW1dmJefsb0TELppjft"
97  "awv/XLb0Brft7jhr+1qJn6WunyQRfEsf5kkoZlHs5Fs9wgB8uKFjvwWY2kg2HFXT"
98  "mmkWP6j9JM9fg2VdI9yjrZYcYvNWIIVSu57VKQdwlpZtZww1Tkq8mATxdGwIyhgh"
99  "fDKQXkYuNs474553LBgOhgObJ4Oi7Aeij7XFXfBvTFLJ3ivL9pVYFxg5lUl86pVq"
100  "5RXSJhiY+gUQFXKOWoqqxC2tMxcNBFB6M6hVIavfHLpk7PuFBFjb7wqK6nFXXQYM"
101  "fbOXD4Wm4eTHq/WujNsJM9cejJTgSiVhnc7j0iYa0u5r8S/6BtmKCGTYdgJzPshq"
102  "ZFIfKxgXeyAMu+EXV3phXWx3CYjAutlG4gjiT6B05asxQ9tb/OD9EI5LgtEgqTrS"
103  "yv//////////AgECAoIBgH//////////5IftURC0YRpiYzFFwG4OaJSBJwRFM+Y6"
104  "AQXfUx2JzZEopQQ8xxoCbvfKjNnmnSGNmBWFNvkvihun8Jq2tqjhIvJC2rsxLz9j"
105  "eiYhdNMb9rWF/65begNb9vccNf2tRM/S10+SCL4lj/MklDMo9nItnuEAPlxQsd+C"
106  "zG0kGw4q6c00ix/UfpJnr8GyrpHuUdbLDjF5qxBCqV3PapSDuEtLNrOGGqclXkwC"
107  "eLo2BGUMEL4ZSC8jFxtnHfHPO5YMB0MBzZPB0XYD0Ufa4q74N6YpZO8V5ftKrAuM"
108  "HMqkvnVKtXKK6RMMTH0CiAq5Ry1FVWIW1pmLhoIoPRnUKpDV745dMnZ9woIsbfeF"
109  "RXU4q66DBj7Zy4fC03DyY9X610ZthJnrj0ZKcCUSsM7ncekTDWl3NfiX/QNsxQQy"
110  "bDsBOZ9kNTIpD5WMC72QBl3wi6u9MK62O4TEYF1so3EEcSfQOnLVmKHtrf5wfohH"
111  "JcFokFSdaWV//////////w=="
112  "-----END X942 DH PARAMETERS-----";
113 
114  if(name == "modp/srp/3072")
115  return
116  "-----BEGIN DH PARAMETERS-----"
117  "MIIBiAKCAYEA///////////JD9qiIWjCNMTGYouA3BzRKQJOCIpnzHQCC76mOxOb"
118  "IlFKCHmONATd75UZs806QxswKwpt8l8UN0/hNW1tUcJF5IW1dmJefsb0TELppjft"
119  "awv/XLb0Brft7jhr+1qJn6WunyQRfEsf5kkoZlHs5Fs9wgB8uKFjvwWY2kg2HFXT"
120  "mmkWP6j9JM9fg2VdI9yjrZYcYvNWIIVSu57VKQdwlpZtZww1Tkq8mATxdGwIyhgh"
121  "fDKQXkYuNs474553LBgOhgObJ4Oi7Aeij7XFXfBvTFLJ3ivL9pVYFxg5lUl86pVq"
122  "5RXSJhiY+gUQFXKOWoqqxC2tMxcNBFB6M6hVIavfHLpk7PuFBFjb7wqK6nFXXQYM"
123  "fbOXD4Wm4eTHq/WujNsJM9cejJTgSiVhnc7j0iYa0u5r8S/6BtmKCGTYdgJzPshq"
124  "ZFIfKxgXeyAMu+EXV3phXWx3CYjAutlG4gjiT6B05asxQ9tb/OD9EI5LgtEgqTrS"
125  "yv//////////AgEF"
126  "-----END DH PARAMETERS-----";
127 
128  if(name == "modp/ietf/4096")
129  return
130  "-----BEGIN X942 DH PARAMETERS-----"
131  "MIIEDAKCAgEA///////////JD9qiIWjCNMTGYouA3BzRKQJOCIpnzHQCC76mOxOb"
132  "IlFKCHmONATd75UZs806QxswKwpt8l8UN0/hNW1tUcJF5IW1dmJefsb0TELppjft"
133  "awv/XLb0Brft7jhr+1qJn6WunyQRfEsf5kkoZlHs5Fs9wgB8uKFjvwWY2kg2HFXT"
134  "mmkWP6j9JM9fg2VdI9yjrZYcYvNWIIVSu57VKQdwlpZtZww1Tkq8mATxdGwIyhgh"
135  "fDKQXkYuNs474553LBgOhgObJ4Oi7Aeij7XFXfBvTFLJ3ivL9pVYFxg5lUl86pVq"
136  "5RXSJhiY+gUQFXKOWoqqxC2tMxcNBFB6M6hVIavfHLpk7PuFBFjb7wqK6nFXXQYM"
137  "fbOXD4Wm4eTHq/WujNsJM9cejJTgSiVhnc7j0iYa0u5r8S/6BtmKCGTYdgJzPshq"
138  "ZFIfKxgXeyAMu+EXV3phXWx3CYjAutlG4gjiT6B05asxQ9tb/OD9EI5LgtEgqSEI"
139  "ARpyPBKnh+bXiHGaEL26WyaZwycYavTiPBqUaDS2FQvaJYPpyirUTOjbu8LbBN6O"
140  "+S6O/BQfvsqmKHxZR05rwF2ZspZPoJDDoiM7oYZRW+ftH2EpcM7i16+4G912IXBI"
141  "HNAGkSfVsFqpk7TqmI2P3cGG/7fckKbAj030Nck0BjGZ//////////8CAQICggIA"
142  "f//////////kh+1RELRhGmJjMUXAbg5olIEnBEUz5joBBd9THYnNkSilBDzHGgJu"
143  "98qM2eadIY2YFYU2+S+KG6fwmra2qOEi8kLauzEvP2N6JiF00xv2tYX/rlt6A1v2"
144  "9xw1/a1Ez9LXT5IIviWP8ySUMyj2ci2e4QA+XFCx34LMbSQbDirpzTSLH9R+kmev"
145  "wbKuke5R1ssOMXmrEEKpXc9qlIO4S0s2s4YapyVeTAJ4ujYEZQwQvhlILyMXG2cd"
146  "8c87lgwHQwHNk8HRdgPRR9rirvg3pilk7xXl+0qsC4wcyqS+dUq1corpEwxMfQKI"
147  "CrlHLUVVYhbWmYuGgig9GdQqkNXvjl0ydn3Cgixt94VFdTirroMGPtnLh8LTcPJj"
148  "1frXRm2EmeuPRkpwJRKwzudx6RMNaXc1+Jf9A2zFBDJsOwE5n2Q1MikPlYwLvZAG"
149  "XfCLq70wrrY7hMRgXWyjcQRxJ9A6ctWYoe2t/nB+iEclwWiQVJCEAI05HglTw/Nr"
150  "xDjNCF7dLZNM4ZOMNXpxHg1KNBpbCoXtEsH05RVqJnRt3eFtgm9HfJdHfgoP32VT"
151  "FD4so6c14C7M2Usn0Ehh0RGd0MMorfP2j7CUuGdxa9fcDe67ELgkDmgDSJPq2C1U"
152  "ydp1TEbH7uDDf9vuSFNgR6b6GuSaAxjM//////////8="
153  "-----END X942 DH PARAMETERS-----";
154 
155  if(name == "modp/srp/4096")
156  return
157  "-----BEGIN DH PARAMETERS-----"
158  "MIICCAKCAgEA///////////JD9qiIWjCNMTGYouA3BzRKQJOCIpnzHQCC76mOxOb"
159  "IlFKCHmONATd75UZs806QxswKwpt8l8UN0/hNW1tUcJF5IW1dmJefsb0TELppjft"
160  "awv/XLb0Brft7jhr+1qJn6WunyQRfEsf5kkoZlHs5Fs9wgB8uKFjvwWY2kg2HFXT"
161  "mmkWP6j9JM9fg2VdI9yjrZYcYvNWIIVSu57VKQdwlpZtZww1Tkq8mATxdGwIyhgh"
162  "fDKQXkYuNs474553LBgOhgObJ4Oi7Aeij7XFXfBvTFLJ3ivL9pVYFxg5lUl86pVq"
163  "5RXSJhiY+gUQFXKOWoqqxC2tMxcNBFB6M6hVIavfHLpk7PuFBFjb7wqK6nFXXQYM"
164  "fbOXD4Wm4eTHq/WujNsJM9cejJTgSiVhnc7j0iYa0u5r8S/6BtmKCGTYdgJzPshq"
165  "ZFIfKxgXeyAMu+EXV3phXWx3CYjAutlG4gjiT6B05asxQ9tb/OD9EI5LgtEgqSEI"
166  "ARpyPBKnh+bXiHGaEL26WyaZwycYavTiPBqUaDS2FQvaJYPpyirUTOjbu8LbBN6O"
167  "+S6O/BQfvsqmKHxZR05rwF2ZspZPoJDDoiM7oYZRW+ftH2EpcM7i16+4G912IXBI"
168  "HNAGkSfVsFqpk7TqmI2P3cGG/7fckKbAj030Nck0BjGZ//////////8CAQU="
169  "-----END DH PARAMETERS-----";
170 
171  if(name == "modp/ietf/6144")
172  return
173  "-----BEGIN DSA PARAMETERS-----"
174  "MIIGDAKCAwEA///////////JD9qiIWjCNMTGYouA3BzRKQJOCIpnzHQCC76mOxOb"
175  "IlFKCHmONATd75UZs806QxswKwpt8l8UN0/hNW1tUcJF5IW1dmJefs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GNmBWFNvkvihun8Jq2tqjhIvJC2rsxLz9jeiYh"
192  "dNMb9rWF/65begNb9vccNf2tRM/S10+SCL4lj/MklDMo9nItnuEAPlxQsd+CzG0k"
193  "Gw4q6c00ix/UfpJnr8GyrpHuUdbLDjF5qxBCqV3PapSDuEtLNrOGGqclXkwCeLo2"
194  "BGUMEL4ZSC8jFxtnHfHPO5YMB0MBzZPB0XYD0Ufa4q74N6YpZO8V5ftKrAuMHMqk"
195  "vnVKtXKK6RMMTH0CiAq5Ry1FVWIW1pmLhoIoPRnUKpDV745dMnZ9woIsbfeFRXU4"
196  "q66DBj7Zy4fC03DyY9X610ZthJnrj0ZKcCUSsM7ncekTDWl3NfiX/QNsxQQybDsB"
197  "OZ9kNTIpD5WMC72QBl3wi6u9MK62O4TEYF1so3EEcSfQOnLVmKHtrf5wfohHJcFo"
198  "kFSQhACNOR4JU8Pza8Q4zQhe3S2TTOGTjDV6cR4NSjQaWwqF7RLB9OUVaiZ0bd3h"
199  "bYJvR3yXR34KD99lUxQ+LKOnNeAuzNlLJ9BIYdERndDDKK3z9o+wlLhncWvX3A3u"
200  "uxC4JA5oA0iT6tgtVMnadUxGx+7gw3/b7khTYEem+hrkmgFCSRth/VppPjgTYOpu"
201  "WTATI29kuo87Ht0b3vx/ygNWzymHcu2cF6CYANdYNSn2yBPsGIvLk9hDLUSMbR9t"
202  "9efNinaiZzZdZ2pdje2/iiPzZhKlmZAoqJXr16E33HoAm8ZpX6zB5QDjJcl2eBl1"
203  "Cui5DoH6QWvnNzp/e2qvOBejTAZBWtQgGMgFjk8s8+S/32P0eZHUvT8bZkRfB46i"
204  "2/+sLWKl6gPZFaCqVWZHtr9fpHDsCmYvaQfAG/BTy4r3eU3xlANQ6sXb4u07eqhV"
205  "HsUP3/h1jOZY0Ynqrm0rZPYXeUsZHD/0a7ceAjQCH0ezH6Qwdwlflq2Fujprc0p8"
206  "jzbmIBJ//////////wIBAg=="
207  "-----END DSA PARAMETERS-----";
208 
209  if(name == "modp/srp/6144")
210  return
211  "-----BEGIN DH PARAMETERS-----"
212  "MIIDCAKCAwEA///////////JD9qiIWjCNMTGYouA3BzRKQJOCIpnzHQCC76mOxOb"
213  "IlFKCHmONATd75UZs806QxswKwpt8l8UN0/hNW1tUcJF5IW1dmJefsb0TELppjft"
214  "awv/XLb0Brft7jhr+1qJn6WunyQRfEsf5kkoZlHs5Fs9wgB8uKFjvwWY2kg2HFXT"
215  "mmkWP6j9JM9fg2VdI9yjrZYcYvNWIIVSu57VKQdwlpZtZww1Tkq8mATxdGwIyhgh"
216  "fDKQXkYuNs474553LBgOhgObJ4Oi7Aeij7XFXfBvTFLJ3ivL9pVYFxg5lUl86pVq"
217  "5RXSJhiY+gUQFXKOWoqqxC2tMxcNBFB6M6hVIavfHLpk7PuFBFjb7wqK6nFXXQYM"
218  "fbOXD4Wm4eTHq/WujNsJM9cejJTgSiVhnc7j0iYa0u5r8S/6BtmKCGTYdgJzPshq"
219  "ZFIfKxgXeyAMu+EXV3phXWx3CYjAutlG4gjiT6B05asxQ9tb/OD9EI5LgtEgqSEI"
220  "ARpyPBKnh+bXiHGaEL26WyaZwycYavTiPBqUaDS2FQvaJYPpyirUTOjbu8LbBN6O"
221  "+S6O/BQfvsqmKHxZR05rwF2ZspZPoJDDoiM7oYZRW+ftH2EpcM7i16+4G912IXBI"
222  "HNAGkSfVsFqpk7TqmI2P3cGG/7fckKbAj030Nck0AoSSNsP6tNJ8cCbB1NyyYCZG"
223  "3sl1HnY9uje9+P+UBq2eUw7l2zgvQTABrrBqU+2QJ9gxF5cnsIZaiRjaPtvrz5sU"
224  "7UTObLrO1Lsb238UR+bMJUszIFFRK9evQm+49AE3jNK/WYPKAcZLkuzwMuoV0XId"
225  "A/SC185udP721V5wL0aYDIK1qEAxkAscnlnnyX++x+jzI6l6fjbMiL4PHUW3/1ha"
226  "xUvUB7IrQVSqzI9tfr9I4dgUzF7SD4A34KeXFe7ym+MoBqHVi7fF2nb1UKo9ih+/"
227  "8OsZzLGjE9Vc2lbJ7C7yljI4f+jXbjwEaAQ+j2Y/SGDuEr8tWwt0dNbmlPkebcxA"
228  "JP//////////AgEF"
229  "-----END DH PARAMETERS-----";
230 
231  if(name == "modp/ietf/8192")
232  return
233  "-----BEGIN DSA PARAMETERS-----"
234  "MIIIDAKCBAEA///////////JD9qiIWjCNMTGYouA3BzRKQJOCIpnzHQCC76mOxOb"
235  "IlFKCHmONATd75UZs806QxswKwpt8l8UN0/hNW1tUcJF5IW1dmJefsb0TELppjft"
236  "awv/XLb0Brft7jhr+1qJn6WunyQRfEsf5kkoZlHs5Fs9wgB8uKFjvwWY2kg2HFXT"
237  "mmkWP6j9JM9fg2VdI9yjrZYcYvNWIIVSu57VKQdwlpZtZww1Tkq8mATxdGwIyhgh"
238  "fDKQXkYuNs474553LBgOhgObJ4Oi7Aeij7XFXfBvTFLJ3ivL9pVYFxg5lUl86pVq"
239  "5RXSJhiY+gUQFXKOWoqqxC2tMxcNBFB6M6hVIavfHLpk7PuFBFjb7wqK6nFXXQYM"
240  "fbOXD4Wm4eTHq/WujNsJM9cejJTgSiVhnc7j0iYa0u5r8S/6BtmKCGTYdgJzPshq"
241  "ZFIfKxgXeyAMu+EXV3phXWx3CYjAutlG4gjiT6B05asxQ9tb/OD9EI5LgtEgqSEI"
242  "ARpyPBKnh+bXiHGaEL26WyaZwycYavTiPBqUaDS2FQvaJYPpyirUTOjbu8LbBN6O"
243  "+S6O/BQfvsqmKHxZR05rwF2ZspZPoJDDoiM7oYZRW+ftH2EpcM7i16+4G912IXBI"
244  "HNAGkSfVsFqpk7TqmI2P3cGG/7fckKbAj030Nck0AoSSNsP6tNJ8cCbB1NyyYCZG"
245  "3sl1HnY9uje9+P+UBq2eUw7l2zgvQTABrrBqU+2QJ9gxF5cnsIZaiRjaPtvrz5sU"
246  "7UTObLrO1Lsb238UR+bMJUszIFFRK9evQm+49AE3jNK/WYPKAcZLkuzwMuoV0XId"
247  "A/SC185udP721V5wL0aYDIK1qEAxkAscnlnn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7a3+cH6IRyXBaJBUkIQAjTkeCVPD82vEOM0IXt0tk0zhk4w1enEeDUo0"
264  "GlsKhe0SwfTlFWomdG3d4W2Cb0d8l0d+Cg/fZVMUPiyjpzXgLszZSyfQSGHREZ3Q"
265  "wyit8/aPsJS4Z3Fr19wN7rsQuCQOaANIk+rYLVTJ2nVMRsfu4MN/2+5IU2BHpvoa"
266  "5JoBQkkbYf1aaT44E2DqblkwEyNvZLqPOx7dG978f8oDVs8ph3LtnBegmADXWDUp"
267  "9sgT7BiLy5PYQy1EjG0fbfXnzYp2omc2XWdqXY3tv4oj82YSpZmQKKiV69ehN9x6"
268  "AJvGaV+sweUA4yXJdngZdQrouQ6B+kFr5zc6f3tqrzgXo0wGQVrUIBjIBY5PLPPk"
269  "v99j9HmR1L0/G2ZEXweOotv/rC1ipeoD2RWgqlVmR7a/X6Rw7ApmL2kHwBvwU8uK"
270  "93lN8ZQDUOrF2+LtO3qoVR7FD9/4dYzmWNGJ6q5tK2T2F3lLGRw/9Gu3HgI0Ah9H"
271  "sx+kMHcJX5athbo6a3NKfI823wisulHJN4l/cvIcO75bVJlvxmxfYmg53JjdHeQZ"
272  "W0bO6YA6D9PfxX4j9pK7e0m10hIzHVWxzi1yerQaEdo6FfjkvBHHi2XxzrKW8f7c"
273  "X35CRWyRERcCUgG+A4n1q9QNEfhjmjn+MjZ1GDWl5eRDF8HC7v1Opb/RYEP0PLQZ"
274  "gfat7p0DFZ562dE8UzaVCfwfonwW75iHcDpVtRsiy/RM0BKu4LJ5jmKEI0KO/NWk"
275  "DK72v1DY6ohev3Omuf15teGPZ9E0GsgjenXDz8kgBKHFpA42a8RNABdq9xwV5IyG"
276  "034BNyPKrHIjqzv01U8YKHE7K0pv5A+rdEBctziwZMBuzHbp7///////////AgEC"
277  "-----END DSA PARAMETERS-----";
278 
279  if(name == "modp/srp/8192")
280  return
281  "-----BEGIN DH PARAMETERS-----"
282  "MIIECAKCBAEA///////////JD9qiIWjCNMTGYouA3BzRKQJOCI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tqky34zYvsTQc7kxujvIMraNndMAdB+nv4r8R+0ldvaTa6Qk"
299  "ZjqrY5xa5PVoNCO0dCvxyXgjjxbL451lLeP9uL78hIrZIiIuBKQDfAcT61eoGiPw"
300  "xzRz/GRs6jBrS8vIhi+Dhd36nUt/osCH6HloMwPtW906Bis89bOieKZtKhP4P0T4"
301  "Ld8xDuB0q2o2RZfomaAlXcFk8xzFCEaFHfmrSBld7X6hsdUQvX7nTXP682vDHs+i"
302  "aDWQRvTrh5+SQAlDi0gcbNeImgAu1e44K8kZDab8Am5HlVjkR1Z36aqeMFDidlaU"
303  "38gfVuiAuW5xYMmA3Zjt09///////////wIBEw=="
304  "-----END DH PARAMETERS-----";
305 
306  if(name == "dsa/jce/1024")
307  return
308  "-----BEGIN DSA PARAMETERS-----"
309  "MIIBHgKBgQD9f1OBHXUSKVLfSpwu7OTn9hG3UjzvRADDHj+AtlEmaUVdQCJR+1k9"
310  "jVj6v8X1ujD2y5tVbNeBO4AdNG/yZmC3a5lQpaSfn+gEexAiwk+7qdf+t8Yb+DtX"
311  "58aophUPBPuD9tPFHsMCNVQTWhaRMvZ1864rYdcq7/IiAxmd0UgBxwIVAJdgUI8V"
312  "IwvMspK5gqLrhAvwWBz1AoGARpYDUS4wJ4zTlHWV2yLuyYJqYyKtyXNE9B10DDJX"
313  "JMj577qn1NgD/4xgnc0QDrxb38+tfGpCX66nhuogUOvpg1HqH9of3yTWlHqmuaoj"
314  "dmlTgC9NfUqOy6BtGXaKJJH/sW0O+cQ6mbX3FnL/bwoktETQc20E04oaEyLa9s3Y"
315  "jJ0="
316  "-----END DSA PARAMETERS-----";
317 
318  if(name == "dsa/botan/2048")
319  return
320  "-----BEGIN DSA PARAMETERS-----"
321  "MIICLAKCAQEAkcSKT9+898Aq6V59oSYSK13Shk9Vm4fo50oobVL1m9HeaN/WRdDg"
322  "DGDAgAMYkZgDdO61lKUyv9Z7mgnqxLhmOgeRDmjzlGX7cEDSXfE5MuusQ0elMOy6"
323  "YchU+biA08DDZgCAWHxFVm2t4mvVo5S+CTtMDyS1r/747GxbPlf7iQJam8FnaZMh"
324  "MeFtPJTvyrGNDfBhIDzFPmEDvHLVWUv9QMplOA9EqahR3LB1SV/AM6ilgHGhvXj+"
325  "BS9mVVZI60txnSr+i0iA+NrW8VgYuhePiSdMhwvpuW6wjEbEAEDMLv4d+xsYaN0x"
326  "nePDSjKmOrbrEiQgmkGWgMx5AtFyjU354QIhAIzX1FD4bwrZTu5M5GmodW0evRBY"
327  "JBlD6v+ws1RYXpJNAoIBAA2fXgdhtNvRgz1qsalhoJlsXyIwP3LYTBQPZ8Qx2Uq1"
328  "cVvqgaDJjTnOS8941rnryJXTT+idlAkdWEhhXvFfXobxHZb2yWniA936WDVkIKSc"
329  "tES1lbkBqTPP4HZ7WU8YoHt/kd7NukRriJkPePL/kfL+fNQ/0uRtGOraH3u2YCxh"
330  "f27zpLKE8v2boQo2BC3o+oeiyjZZf+yBFXoUheRAQd8CgwERy4gLvm7UlIFIhvll"
331  "zcMTX1zPE4Nyi/ZbgG+WksCxDWxMCcdabKO0ATyxarLBBfa+I66pAA6rIXiYX5cs"
332  "mAV+HIbkTnIYaI6krg82NtzKdFydzU5q/7Z8y8E9YTE="
333  "-----END DSA PARAMETERS-----";
334 
335  if(name == "dsa/botan/3072")
336  return
337  "-----BEGIN DSA PARAMETERS-----"
338  "MIIDLAKCAYEA5LUIgHWWY1heFCRgyi2d/xMviuTIQN2jomZoiRJP5WOLhOiim3rz"
339  "+hIJvmv8S1By7Tsrc4e68/hX9HioAijvNgC3az3Pth0g00RlslBtLK+H3259wM6R"
340  "vS0Wekb2rcwxxTHk+cervbkq3fNbCoBsZikqX14X6WTdCZkDczrEKKs12A6m9oW/"
341  "uovkBo5UGK5eytno/wc94rY+Tn6tNciptwtb1Hz7iNNztm83kxk5sKtxvVWVgJCG"
342  "2gFVM30YWg5Ps2pRmxtiArhZHmACRJzxzTpmOE9tIHOxzXO+ypO68eGmEX0COPIi"
343  "rh7X/tGFqJDn9n+rj+uXU8wTSlGD3+h64llfe1wtn7tCJJ/dWVE+HTOWs+sv2GaE"
344  "8oWoRI/nV6ApiBxAdguU75Gb35dAw4OJWZ7FGm6btRmo4GhJHpzgovz+PLYNZs8N"
345  "+tIKjsaEBIaEphREV1vRck1zUrRKdgB3s71r04XOWwpyUMwL92jagpI4Buuc+7E4"
346  "hDcxthggjHWbAiEAs+vTZOxp74zzuvZDt1c0sWM5suSeXN4bWcHp+0DuDFsCggGA"
347  "K+0h7vg5ZKIwrom7px2ffDnFL8gim047x+WUTTKdoQ8BDqyee69sAJ/E6ylgcj4r"
348  "Vt9GY+TDrIAOkljeL3ZJ0gZ4KJP4Ze/KSY0u7zAHTqXop6smJxKk2UovOwuaku5A"
349  "D7OKPMWaXcfkNtXABLIuNQKDgbUck0B+sy1K4P1Cy0XhLQ7O6KJiOO3iCCp7FSIR"
350  "PGbO+NdFxs88uUX4TS9N4W1Epx3hmCcOE/A1U8iLjTI60LlIob8hA6lJl5tu0W+1"
351  "88lT2Vt8jojKZ9z1pjb7nKOdkkIV96iE7Wx+48ltjZcVQnl0t8Q1EoLhPTdz99KL"
352  "RS8QiSoTx1hzKN6kgntrNpsqjcFyrcWD9R8qZZjFSD5bxGewL5HQWcQC0Y4sJoD3"
353  "dqoG9JKAoscsF8xC1bbnQMXEsas8UcLtCSviotiwU65Xc9FCXtKwjwbi3VBZLfGk"
354  "eMFVkc39EVZP+I/zi3IdQjkv2kcyEtz9jS2IqXagCv/m//tDCjWeZMorNRyiQSOU"
355  "-----END DSA PARAMETERS-----";
356 
357  return "";
358  }

§ verify_group()

bool Botan::DL_Group::verify_group ( RandomNumberGenerator rng,
bool  strong 
) const

Perform validity checks on the group.

Parameters
rngthe rng to use
strongwhether to perform stronger by lengthier tests
Returns
true if the object is consistent, false otherwise

Definition at line 161 of file dl_group.cpp.

References Botan::is_prime(), and Botan::power_mod().

Referenced by Botan::DL_Scheme_PublicKey::check_key(), Botan::DL_Scheme_PrivateKey::check_key(), and Botan::TLS::Client_Key_Exchange::Client_Key_Exchange().

163  {
164  init_check();
165 
166  if(m_g < 2 || m_p < 3 || m_q < 0)
167  return false;
168 
169  const size_t prob = (strong) ? 128 : 10;
170 
171  if(m_q != 0)
172  {
173  if((m_p - 1) % m_q != 0)
174  {
175  return false;
176  }
177  if(power_mod(m_g, m_q, m_p) != 1)
178  {
179  return false;
180  }
181  if(!is_prime(m_q, rng, prob))
182  {
183  return false;
184  }
185  }
186  if(!is_prime(m_p, rng, prob))
187  {
188  return false;
189  }
190  return true;
191  }
bool is_prime(const BigInt &n, RandomNumberGenerator &rng, size_t prob, bool is_random)
Definition: numthry.cpp:441
BigInt power_mod(const BigInt &base, const BigInt &exp, const BigInt &mod)
Definition: numthry.cpp:373

The documentation for this class was generated from the following files: