Botan 1.10.17
dl_algo.h
Go to the documentation of this file.
1/*
2* DL Scheme
3* (C) 1999-2007 Jack Lloyd
4*
5* Distributed under the terms of the Botan license
6*/
7
8#ifndef BOTAN_DL_ALGO_H__
9#define BOTAN_DL_ALGO_H__
10
11#include <botan/dl_group.h>
12#include <botan/x509_key.h>
13#include <botan/pkcs8.h>
14
15namespace Botan {
16
17/**
18* This class represents discrete logarithm (DL) public keys.
19*/
20class BOTAN_DLL DL_Scheme_PublicKey : public virtual Public_Key
21 {
22 public:
23 bool check_key(RandomNumberGenerator& rng, bool) const;
24
26
28
29 /**
30 * Get the DL domain parameters of this key.
31 * @return DL domain parameters of this key
32 */
33 const DL_Group& get_domain() const { return group; }
34
35 /**
36 * Get the public value y with y = g^x mod p where x is the secret key.
37 */
38 const BigInt& get_y() const { return y; }
39
40 /**
41 * Get the prime p of the underlying DL group.
42 * @return prime p
43 */
44 const BigInt& group_p() const { return group.get_p(); }
45
46 /**
47 * Get the prime q of the underlying DL group.
48 * @return prime q
49 */
50 const BigInt& group_q() const { return group.get_q(); }
51
52 /**
53 * Get the generator g of the underlying DL group.
54 * @return generator g
55 */
56 const BigInt& group_g() const { return group.get_g(); }
57
58 /**
59 * Get the underlying groups encoding format.
60 * @return encoding format
61 */
62 virtual DL_Group::Format group_format() const = 0;
63
65 const MemoryRegion<byte>& key_bits,
67
68 protected:
70
71 /**
72 * The DL public key
73 */
75
76 /**
77 * The DL group
78 */
80 };
81
82/**
83* This class represents discrete logarithm (DL) private keys.
84*/
85class BOTAN_DLL DL_Scheme_PrivateKey : public virtual DL_Scheme_PublicKey,
86 public virtual Private_Key
87 {
88 public:
89 bool check_key(RandomNumberGenerator& rng, bool) const;
90
91 /**
92 * Get the secret key x.
93 * @return secret key
94 */
95 const BigInt& get_x() const { return x; }
96
97 MemoryVector<byte> pkcs8_private_key() const;
98
100 const MemoryRegion<byte>& key_bits,
101 DL_Group::Format group_format);
102
103 protected:
105
106 /**
107 * The DL private key
108 */
110 };
111
112}
113
114#endif
bool check_key(RandomNumberGenerator &rng, bool) const
Definition dl_algo.cpp:67
const BigInt & get_x() const
Definition dl_algo.h:95
DL_Scheme_PrivateKey(const AlgorithmIdentifier &alg_id, const MemoryRegion< byte > &key_bits, DL_Group::Format group_format)
Definition dl_algo.cpp:41
const BigInt & group_p() const
Definition dl_algo.h:44
DL_Scheme_PublicKey(const AlgorithmIdentifier &alg_id, const MemoryRegion< byte > &key_bits, DL_Group::Format group_format)
Definition dl_algo.cpp:26
const DL_Group & get_domain() const
Definition dl_algo.h:33
const BigInt & group_q() const
Definition dl_algo.h:50
const BigInt & get_y() const
Definition dl_algo.h:38
bool check_key(RandomNumberGenerator &rng, bool) const
Definition dl_algo.cpp:54
virtual DL_Group::Format group_format() const =0
AlgorithmIdentifier algorithm_identifier() const
Definition dl_algo.cpp:15
MemoryVector< byte > x509_subject_public_key() const
Definition dl_algo.cpp:21
const BigInt & group_g() const
Definition dl_algo.h:56