EVP_PKEY-DSA(7ossl)
π EVP_PKEY-DSA β like, the whole DSA keytype situation
okay so bestie, welcome to the EVP_PKEY-DSA page from the 7ossl manual set (yes that's the OpenSSL 7 section, iykyk). This one covers EVP_PKEY-DSA and EVP_KEYMGMT-DSA β the EVP_PKEY DSA keytype and all the algorithm support that comes with it. Buckle up π
β¨ NAME β¨
EVP_PKEY-DSA, EVP_KEYMGMT-DSA β the EVP_PKEY DSA keytype + algorithm support, periodt.
πΈ DESCRIPTION πΈ
So for DSA, the FIPS 186-4 standard is lowkey strict: the values used for FFC parameter generation are also required for parameter validation. Which means those optional FFC domain parameter values for seed, pcounter and gindex might need to be stored for validation purposes. And here's the thing β for DSA these fields are not stored in the ASN1 data, so they have to be stored externally if validation is required. no cap, that's just how it is π
Also, as part of FIPS 140-3, DSA is no longer FIPS approved for key generation and signature validation. But! It's still allowed for signature verification. So it's giving "semi-retired but still invited to the party" π
π¦ DSA parameters
The DSA key type supports the FFC parameters (see "FFC parameters" in EVP_PKEY-FFC(7)).
It also supports the following parameters:
"sign-check" (OSSL_PKEY_PARAM_FIPS_SIGN_CHECK) <integerβ see "Common Information Parameters" inprovider-keymgmt(7)for more info."fips-indicator" (OSSL_PKEY_PARAM_FIPS_APPROVED_INDICATOR) <integer>β same deal, see "Common Information Parameters" inprovider-keymgmt(7)for more information.
π§ DSA key generation parameters
The DSA key type supports the FFC key generation parameters (see "FFC key generation parameters" in EVP_PKEY-FFC(7)).
The following restrictions apply to the "pbits" field:
- For
"fips186_4"this must be either2048or3072. - For
"fips186_2"this must be1024. - For
"group"this can be any one of2048,3072,4096,6144or8192.
π DSA key validation
For DSA keys, EVP_PKEY_param_check(3) behaves in the following way: the OpenSSL FIPS provider conforms to the rules within the FIPS186-4 standard for FFC parameter validation. For backwards compatibility, the OpenSSL default provider uses a much simpler check (see below) for parameter validation β unless the seed parameter is set. π
For DSA keys, EVP_PKEY_param_check_quick(3) behaves like this: a simple check of L and N and partial g is performed. The default provider also supports validation of legacy "fips186_2" keys. iconic.
For DSA keys with EVP_PKEY_public_check(3), EVP_PKEY_private_check(3) and EVP_PKEY_pairwise_check(3), the OpenSSL default and FIPS providers conform to the rules within SP800-56Ar3 for public, private and pairwise tests respectively. slay π«Ά
π₯ EXAMPLES π₯
An EVP_PKEY context can be obtained by calling:
EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_from_name(NULL, "DSA", NULL);
The DSA domain parameters can be generated by calling:
unsigned int pbits = 2048;
unsigned int qbits = 256;
int gindex = 1;
OSSL_PARAM params[5];
EVP_PKEY *param_key = NULL;
EVP_PKEY_CTX *pctx = NULL;
pctx = EVP_PKEY_CTX_new_from_name(NULL, "DSA", NULL);
EVP_PKEY_paramgen_init(pctx);
params[0] = OSSL_PARAM_construct_uint("pbits", &pbits);
params[1] = OSSL_PARAM_construct_uint("qbits", &qbits);
params[2] = OSSL_PARAM_construct_int("gindex", &gindex);
params[3] = OSSL_PARAM_construct_utf8_string("digest", "SHA384", 0);
params[4] = OSSL_PARAM_construct_end();
EVP_PKEY_CTX_set_params(pctx, params);
EVP_PKEY_generate(pctx, ¶m_key);
EVP_PKEY_CTX_free(pctx);
EVP_PKEY_print_params(bio_out, param_key, 0, NULL);
A DSA key can be generated using domain parameters by calling:
EVP_PKEY *key = NULL;
EVP_PKEY_CTX *gctx = NULL;
gctx = EVP_PKEY_CTX_new_from_pkey(NULL, param_key, NULL);
EVP_PKEY_keygen_init(gctx);
EVP_PKEY_generate(gctx, &key);
EVP_PKEY_CTX_free(gctx);
EVP_PKEY_print_private(bio_out, key, 0, NULL);
π CONFORMING TO π
The following sections of FIPS186-4, bestie:
- A.1.1.2 Generation of Probable Primes p and q Using an Approved Hash Function.
- A.2.3 Generation of canonical generator g.
- A.2.1 Unverifiable Generation of the Generator g.
π SEE ALSO π
EVP_PKEY-FFC(7), EVP_SIGNATURE-DSA(7) EVP_PKEY(3), provider-keymgmt(7), EVP_KEYMGMT(3), OSSL_PROVIDER-default(7), OSSL_PROVIDER-FIPS(7)
π HISTORY π
DSA key generation and signature generation are no longer FIPS approved in OpenSSL 3.4. See "FIPS indicators" in fips_module(7) for more information. yeah, it's a whole thing π
π COPYRIGHT π
Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and that's the whole page, bestie π this was version 3.5.0, dated 2026-09-25 β catch you on the flip side, mwah π«Άβ¨
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3 3.5.0-160000.11.1 Β· Apache-2.0
- opensuse-leap 16.0: openssl-3 3.5.0-160000.11.1 Β· Apache-2.0
- opensuse-leap 16.0: openssl-3 3.5.0-160000.11.1 Β· Apache-2.0
- opensuse-leap 16.0: openssl-3 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms