EVP_PKEY-DSA(7ossl)

πŸ’… EVP_PKEY-DSA (7ossl) β€” the DSA keytype & algorithm support page, bestie edition ✨

okay so this is the <pink>OpenSSL</pink> manual page for EVP_PKEY-DSA and EVP_KEYMGMT-DSA β€” aka the EVP_PKEY DSA keytype and algorithm support. yes, both names, one page, they're a package deal πŸŽ€


🌸 NAME 🌸

EVP_PKEY-DSA, EVP_KEYMGMT-DSA β€” EVP_PKEY DSA keytype and algorithm support. that's the whole vibe, no cap πŸ’…


✨ DESCRIPTION ✨

so for DSA, the FIPS 186-4 standard says the values used for FFC parameter generation are also required for parameter validation. like, they're not just for making the params β€” validation needs them too 🫢

that means the optional FFC domain parameter values for seed, pcounter and gindex may need to be stored for validation purposes. and here's the tea: for DSA these fields are not stored in the ASN1 data, so if you need validation you gotta store them externally. main character energy of "keep your own receipts" 😭

also, as part of FIPS 140-3, DSA is not longer FIPS approved for key generation and signature validation, but it's still allowed for signature verification. so like… generation era is over, verification era is still serving πŸ‘‘

πŸ¦‹ 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 β€” the sign check knob, literally exactly as the page spells it 🫢
  • "fips-indicator" (OSSL_PKEY_PARAM_FIPS_APPROVED_INDICATOR) <integer> β€” the fips indicator. see "Common Information Parameters" in provider-keymgmt(7) for more info πŸ’–

🌈 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, and yes they're strict, she has rules πŸ‘‘:

  • For "fips186_4" this must be either 2048 or 3072.
  • For "fips186_2" this must be 1024.
  • For "group" this can be any one of 2048, 3072, 4096, 6144 or 8192.

πŸ’œ 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. iykyk 🌸

for DSA keys, EVP_PKEY_param_check_quick(3) behaves in the following way: a simple check of L and N and partial g is performed. the default provider also supports validation of legacy "fips186_2" keys. nostalgia-core 😌

for DSA keys, 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. all three, all conforming, all slaying πŸ’…


πŸ”₯ 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, &param_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, and yes we're citing them properly, bestie is nothing if not academically honest πŸŽ€:

  • 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) β€” go read the whole friend group, they all know each other 🫢


⭐ 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. era ended, respectfully πŸ’€


Copyright 2020-2025 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>.


bestie this is from OpenSSL version 3.5.9, dated 2026-09-29 β€” that's the source/version and date, noted with love so you never have to squint at the footer again πŸ’…βœ¨πŸŒΈ
πŸ“¦ where this page comes from