MySQL 5.6.14 Source Code Document
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
dsa.hpp
1
/*
2
Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
3
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; version 2 of the License.
7
8
This program is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
GNU General Public License for more details.
12
13
You should have received a copy of the GNU General Public License
14
along with this program; see the file COPYING. If not, write to the
15
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
16
MA 02110-1301 USA.
17
*/
18
19
/* dsa.hpp provides Digitial Signautre Algorithm see FIPS 186-2
20
*/
21
22
#ifndef TAO_CRYPT_DSA_HPP
23
#define TAO_CRYPT_DSA_HPP
24
25
#include "integer.hpp"
26
27
28
namespace
TaoCrypt {
29
30
class
Source;
31
32
33
class
DSA_PublicKey
{
34
protected
:
35
Integer
p_;
36
Integer
q_;
37
Integer
g_;
38
Integer
y_;
39
public
:
40
DSA_PublicKey
() {}
41
explicit
DSA_PublicKey
(
Source
&);
42
43
void
Initialize(
Source
&);
44
void
Initialize(
const
Integer
& p,
const
Integer
& q,
const
Integer
& g,
45
const
Integer
& y);
46
47
const
Integer
& GetModulus()
const
;
48
const
Integer
& GetSubGroupOrder()
const
;
49
const
Integer
& GetSubGroupGenerator()
const
;
50
const
Integer
& GetPublicPart()
const
;
51
52
void
SetModulus(
const
Integer
&);
53
void
SetSubGroupOrder(
const
Integer
&);
54
void
SetSubGroupGenerator(
const
Integer
&);
55
void
SetPublicPart(
const
Integer
&);
56
57
word32 SignatureLength()
const
;
58
59
DSA_PublicKey
(
const
DSA_PublicKey
&);
60
DSA_PublicKey
& operator=(
const
DSA_PublicKey
&);
61
62
void
Swap(
DSA_PublicKey
& other);
63
};
64
65
66
67
class
DSA_PrivateKey
:
public
DSA_PublicKey
{
68
Integer
x_;
69
public
:
70
DSA_PrivateKey
() {}
71
explicit
DSA_PrivateKey
(
Source
&);
72
73
void
Initialize(
Source
&);
74
void
Initialize(
const
Integer
& p,
const
Integer
& q,
const
Integer
& g,
75
const
Integer
& y,
const
Integer
& x);
76
77
const
Integer
& GetPrivatePart()
const
;
78
79
void
SetPrivatePart(
const
Integer
&);
80
private
:
81
DSA_PrivateKey
(
const
DSA_PrivateKey
&);
// hide copy
82
DSA_PrivateKey
& operator=(
const
DSA_PrivateKey
&);
// and assign
83
};
84
85
86
87
class
DSA_Signer
{
88
const
DSA_PrivateKey
& key_;
89
Integer
r_;
90
Integer
s_;
91
public
:
92
explicit
DSA_Signer
(
const
DSA_PrivateKey
&);
93
94
word32 Sign(
const
byte* sha_digest, byte* sig,
RandomNumberGenerator
&);
95
96
const
Integer
& GetR()
const
;
97
const
Integer
& GetS()
const
;
98
private
:
99
DSA_Signer
(
const
DSA_Signer
&);
// hide copy
100
DSA_Signer
& operator=(
DSA_Signer
&);
// and assign
101
};
102
103
104
class
DSA_Verifier
{
105
const
DSA_PublicKey
& key_;
106
Integer
r_;
107
Integer
s_;
108
public
:
109
explicit
DSA_Verifier
(
const
DSA_PublicKey
&);
110
111
bool
Verify(
const
byte* sha_digest,
const
byte* sig);
112
113
const
Integer
& GetR()
const
;
114
const
Integer
& GetS()
const
;
115
private
:
116
DSA_Verifier
(
const
DSA_Verifier
&);
// hide copy
117
DSA_Verifier
& operator=(
const
DSA_Verifier
&);
// and assign
118
};
119
120
121
122
123
124
}
// namespace
125
126
#endif // TAO_CRYPT_DSA_HPP
extra
yassl
taocrypt
include
dsa.hpp
Generated on Sat Nov 9 2013 01:24:42 for MySQL 5.6.14 Source Code Document by
1.8.1.2