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