1 | =pod
|
---|
2 |
|
---|
3 | =head1 NAME
|
---|
4 |
|
---|
5 | EVP_PKEY-DSA, EVP_KEYMGMT-DSA - EVP_PKEY DSA keytype and algorithm support
|
---|
6 |
|
---|
7 | =head1 DESCRIPTION
|
---|
8 |
|
---|
9 | For B<DSA> the FIPS186-4 standard specifies that the values used for FFC
|
---|
10 | parameter generation are also required for parameter validation.
|
---|
11 | This means that optional FFC domain parameter values for I<seed>, I<pcounter>
|
---|
12 | and I<gindex> may need to be stored for validation purposes. For B<DSA> these
|
---|
13 | fields are not stored in the ASN1 data so they need to be stored externally if
|
---|
14 | validation is required.
|
---|
15 |
|
---|
16 | =head2 DSA parameters
|
---|
17 |
|
---|
18 | The B<DSA> key type supports the FFC parameters (see
|
---|
19 | L<EVP_PKEY-FFC(7)/FFC parameters>).
|
---|
20 |
|
---|
21 | =head2 DSA key generation parameters
|
---|
22 |
|
---|
23 | The B<DSA> key type supports the FFC key generation parameters (see
|
---|
24 | L<EVP_PKEY-FFC(7)/FFC key generation parameters>
|
---|
25 |
|
---|
26 | The following restrictions apply to the "pbits" field:
|
---|
27 |
|
---|
28 | For "fips186_4" this must be either 2048 or 3072.
|
---|
29 | For "fips186_2" this must be 1024.
|
---|
30 | For "group" this can be any one of 2048, 3072, 4096, 6144 or 8192.
|
---|
31 |
|
---|
32 | =head2 DSA key validation
|
---|
33 |
|
---|
34 | For DSA keys, L<EVP_PKEY_param_check(3)> behaves in the following way:
|
---|
35 | The OpenSSL FIPS provider conforms to the rules within the FIPS186-4
|
---|
36 | standard for FFC parameter validation. For backwards compatibility the OpenSSL
|
---|
37 | default provider uses a much simpler check (see below) for parameter validation,
|
---|
38 | unless the seed parameter is set.
|
---|
39 |
|
---|
40 | For DSA keys, L<EVP_PKEY_param_check_quick(3)> behaves in the following way:
|
---|
41 | A simple check of L and N and partial g is performed. The default provider
|
---|
42 | also supports validation of legacy "fips186_2" keys.
|
---|
43 |
|
---|
44 | For DSA keys, L<EVP_PKEY_public_check(3)>, L<EVP_PKEY_private_check(3)> and
|
---|
45 | L<EVP_PKEY_pairwise_check(3)> the OpenSSL default and FIPS providers conform to
|
---|
46 | the rules within SP800-56Ar3 for public, private and pairwise tests respectively.
|
---|
47 |
|
---|
48 | =head1 EXAMPLES
|
---|
49 |
|
---|
50 | An B<EVP_PKEY> context can be obtained by calling:
|
---|
51 |
|
---|
52 | EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_from_name(NULL, "DSA", NULL);
|
---|
53 |
|
---|
54 | The B<DSA> domain parameters can be generated by calling:
|
---|
55 |
|
---|
56 | unsigned int pbits = 2048;
|
---|
57 | unsigned int qbits = 256;
|
---|
58 | int gindex = 1;
|
---|
59 | OSSL_PARAM params[5];
|
---|
60 | EVP_PKEY *param_key = NULL;
|
---|
61 | EVP_PKEY_CTX *pctx = NULL;
|
---|
62 |
|
---|
63 | pctx = EVP_PKEY_CTX_new_from_name(NULL, "DSA", NULL);
|
---|
64 | EVP_PKEY_paramgen_init(pctx);
|
---|
65 |
|
---|
66 | params[0] = OSSL_PARAM_construct_uint("pbits", &pbits);
|
---|
67 | params[1] = OSSL_PARAM_construct_uint("qbits", &qbits);
|
---|
68 | params[2] = OSSL_PARAM_construct_int("gindex", &gindex);
|
---|
69 | params[3] = OSSL_PARAM_construct_utf8_string("digest", "SHA384", 0);
|
---|
70 | params[4] = OSSL_PARAM_construct_end();
|
---|
71 | EVP_PKEY_CTX_set_params(pctx, params);
|
---|
72 |
|
---|
73 | EVP_PKEY_generate(pctx, ¶m_key);
|
---|
74 | EVP_PKEY_CTX_free(pctx);
|
---|
75 |
|
---|
76 | EVP_PKEY_print_params(bio_out, param_key, 0, NULL);
|
---|
77 |
|
---|
78 | A B<DSA> key can be generated using domain parameters by calling:
|
---|
79 |
|
---|
80 | EVP_PKEY *key = NULL;
|
---|
81 | EVP_PKEY_CTX *gctx = NULL;
|
---|
82 |
|
---|
83 | gctx = EVP_PKEY_CTX_new_from_pkey(NULL, param_key, NULL);
|
---|
84 | EVP_PKEY_keygen_init(gctx);
|
---|
85 | EVP_PKEY_generate(gctx, &key);
|
---|
86 | EVP_PKEY_CTX_free(gctx);
|
---|
87 | EVP_PKEY_print_private(bio_out, key, 0, NULL);
|
---|
88 |
|
---|
89 |
|
---|
90 | =head1 CONFORMING TO
|
---|
91 |
|
---|
92 | The following sections of FIPS186-4:
|
---|
93 |
|
---|
94 | =over 4
|
---|
95 |
|
---|
96 | =item A.1.1.2 Generation of Probable Primes p and q Using an Approved Hash Function.
|
---|
97 |
|
---|
98 | =item A.2.3 Generation of canonical generator g.
|
---|
99 |
|
---|
100 | =item A.2.1 Unverifiable Generation of the Generator g.
|
---|
101 |
|
---|
102 | =back
|
---|
103 |
|
---|
104 | =head1 SEE ALSO
|
---|
105 |
|
---|
106 | L<EVP_PKEY-FFC(7)>,
|
---|
107 | L<EVP_SIGNATURE-DSA(7)>
|
---|
108 | L<EVP_PKEY(3)>,
|
---|
109 | L<provider-keymgmt(7)>,
|
---|
110 | L<EVP_KEYMGMT(3)>,
|
---|
111 | L<OSSL_PROVIDER-default(7)>,
|
---|
112 | L<OSSL_PROVIDER-FIPS(7)>
|
---|
113 |
|
---|
114 | =head1 COPYRIGHT
|
---|
115 |
|
---|
116 | Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.
|
---|
117 |
|
---|
118 | Licensed under the Apache License 2.0 (the "License"). You may not use
|
---|
119 | this file except in compliance with the License. You can obtain a copy
|
---|
120 | in the file LICENSE in the source distribution or at
|
---|
121 | L<https://www.openssl.org/source/license.html>.
|
---|
122 |
|
---|
123 | =cut
|
---|