]> git.ipfire.org Git - thirdparty/openssl.git/blob - doc/man7/EVP_PKEY-FFC.pod
Update copyright year
[thirdparty/openssl.git] / doc / man7 / EVP_PKEY-FFC.pod
1 =pod
2
3 =head1 NAME
4
5 EVP_PKEY-FFC - EVP_PKEY DSA and DH shared FFC parameters.
6
7 =head1 DESCRIPTION
8
9 Finite field cryptography (FFC) is a method of implementing discrete logarithm
10 cryptography using finite field mathematics. DSA is an example of FFC and
11 Diffie-Hellman key establishment algorithms specified in SP800-56A can also be
12 implemented as FFC.
13
14 The B<DSA> and B<DH> keytypes are implemented in OpenSSL's default and FIPS
15 providers.
16 The implementations support the basic DSA and DH keys, containing the public
17 and private keys I<pub> and I<priv> as well as the three main domain parameters
18 I<p>, I<q> and I<g>.
19
20 For B<DSA> (and B<DH> that is not a named group) the FIPS186-4 standard
21 specifies that the values used for FFC parameter generation are also required
22 for parameter validation.
23 This means that optional FFC domain parameter values for I<seed>, I<pcounter>
24 and I<gindex> may need to be stored for validation purposes.
25 For B<DH> the I<seed> and I<pcounter> can be stored in ASN1 data
26 (but the I<gindex> is not). For B<DSA> however, these fields are not stored in
27 the ASN1 data so they need to be stored externally if validation is required.
28
29 =head2 FFC parameters
30
31 In addition to the common parameters that all keytypes should support (see
32 L<provider-keymgmt(7)/Common parameters>), the B<DSA> and B<DH> keytype
33 implementations support the following.
34
35 =over 4
36
37 =item "pub" (B<OSSL_PKEY_PARAM_PUB_KEY>) <unsigned integer>
38
39 The public key value.
40
41 =item "priv" (B<OSSL_PKEY_PARAM_PRIV_KEY>) <unsigned integer>
42
43 The private key value.
44
45 =item "p" (B<OSSL_PKEY_PARAM_FFC_P>) <unsigned integer>
46
47 A DSA or Diffie-Hellman prime "p" value.
48
49 =item "q" (B<OSSL_PKEY_PARAM_FFC_Q>) <unsigned integer>
50
51 A DSA or Diffie-Hellman prime "q" value.
52
53 =item "g" (B<OSSL_PKEY_PARAM_FFC_G>) <unsigned integer>
54
55 A DSA or Diffie-Hellman generator "g" value.
56
57 =item "seed" (B<OSSL_PKEY_PARAM_FFC_SEED>) <octet string>
58
59 An optional domain parameter I<seed> value used during generation and validation
60 of I<p>, I<q> and canonical I<g>.
61 For validation this needs to set the I<seed> that was produced during generation.
62
63 =item "gindex" (B<OSSL_PKEY_PARAM_FFC_GINDEX>) <integer>
64
65 Sets the index to use for canonical generation and verification of the generator
66 I<g>.
67 Set this to a positive value from 0..FF to use this mode. This I<gindex> can
68 then be reused during key validation to verify the value of I<g>. If this value
69 is not set or is -1 then unverifiable generation of the generator I<g> will be
70 used.
71
72 =item "pcounter" (B<OSSL_PKEY_PARAM_FFC_PCOUNTER>) <integer>
73
74 An optional domain parameter I<counter> value that is output during generation
75 of I<p>. This value must be saved if domain parameter validation is required.
76
77 =item "hindex" (B<OSSL_PKEY_PARAM_FFC_H>) <integer>
78
79 For unverifiable generation of the generator I<g> this value is output during
80 generation of I<g>. Its value is the first integer larger than one that
81 satisfies g = h^j mod p (where g != 1 and "j" is the cofactor).
82
83 =item "j" (B<OSSL_PKEY_PARAM_FFC_COFACTOR>) <unsigned integer>
84
85 An optional informational cofactor parameter that should equal to (p - 1) / q.
86
87 =back
88
89 =head2 FFC key generation parameters
90
91 The following key generation types are available for DSA and DH algorithms:
92
93 =over 4
94
95 =item "type" (B<OSSL_PKEY_PARAM_FFC_TYPE>) <utf8_string>
96
97 Sets the type of parameter generation. The shared valid values are:
98
99 =over 4
100
101 =item "fips186_4"
102
103 The current standard.
104
105 =item "fips186_2"
106
107 The old standard that should only be used for legacy purposes.
108
109 =item "default"
110
111 This can choose one of "fips186_4" or "fips186_2" depending on other
112 parameters set for parameter generation.
113
114 =back
115
116 =item "pbits" (B<OSSL_PKEY_PARAM_FFC_PBITS>) <unsigned integer>
117
118 Sets the size (in bits) of the prime 'p'.
119
120 =item "qbits" (B<OSSL_PKEY_PARAM_FFC_QBITS>) <unsigned integer>
121
122 Sets the size (in bits) of the prime 'q'.
123
124 For "fips186_4" this can be either 224 or 256.
125 For "fips186_2" this has a size of 160.
126
127 =item "digest" (B<OSSL_PKEY_PARAM_FFC_DIGEST>) <utf8_string>
128
129 Sets the Digest algorithm to be used as part of the Key Generation Function
130 associated with the given Key Generation I<ctx>.
131 This must also be set for key validation.
132
133 =item "properties" (B<OSSL_PKEY_PARAM_FFC_DIGEST_PROPS>) <utf8_string>
134
135 Sets properties to be used upon look up of the implementation for the selected
136 Digest algorithm for the Key Generation Function associated with the given key
137 generation I<ctx>. This may also be set for key validation.
138
139 =item "seed" (B<OSSL_PKEY_PARAM_FFC_SEED>) <octet string>
140
141 For "fips186_4" or "fips186_2" generation this sets the I<seed> data to use
142 instead of generating a random seed internally. This should be used for
143 testing purposes only. This will either produce fixed values for the generated
144 parameters OR it will fail if the seed did not generate valid primes.
145
146 =item "gindex" (B<OSSL_PKEY_PARAM_FFC_GINDEX>) <integer>
147
148 =item "pcounter" (B<OSSL_PKEY_PARAM_FFC_PCOUNTER>) <integer>
149
150 =item "hindex" (B<OSSL_PKEY_PARAM_FFC_H>) <integer>
151
152 These types are described above.
153
154 =back
155
156 =head1 CONFORMING TO
157
158 The following sections of SP800-56Ar3:
159
160 =over 4
161
162 =item 5.5.1.1 FFC Domain Parameter Selection/Generation
163
164 =back
165
166 The following sections of FIPS 186-4:
167
168 =over 4
169
170 =item A.1.1.2 Generation of Probable Primes p and q Using an Approved Hash Function.
171
172 =item A.2.3 Generation of canonical generator g.
173
174 =item A.2.1 Unverifiable Generation of the Generator g.
175
176 =back
177
178 =head1 SEE ALSO
179
180 L<EVP_PKEY-DSA(7)>,
181 L<EVP_PKEY-DH(7)>,
182 L<EVP_SIGNATURE-DSA(7)>,
183 L<EVP_KEYEXCH-DH(7)>
184 L<EVP_KEYMGMT(3)>,
185 L<EVP_PKEY(3)>,
186 L<provider-keymgmt(7)>,
187 L<OSSL_PROVIDER-default(7)>,
188 L<OSSL_PROVIDER-FIPS(7)>,
189
190 =head1 COPYRIGHT
191
192 Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
193
194 Licensed under the Apache License 2.0 (the "License"). You may not use
195 this file except in compliance with the License. You can obtain a copy
196 in the file LICENSE in the source distribution or at
197 L<https://www.openssl.org/source/license.html>.
198
199 =cut