---
name: "EVP_PKEY-DSA"
section: "7ssl"
platform: "linux"
package: "openssl"
version: "3.6.5-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/EVP_PKEY-DSA"
---

# EVP\_PKEY-DSA(7ssl)

EVP\_PKEY DSA keytype and algorithm support

## NAME

EVP\_PKEY-DSA, EVP\_KEYMGMT-DSA - EVP\_PKEY DSA keytype and algorithm support

## DESCRIPTION

For **DSA** the FIPS 186-4 standard specifies that the values used for FFC parameter generation are also required for parameter validation. This means that optional FFC domain parameter values for *seed*, *pcounter* and *gindex* may need to be stored for validation purposes. For **DSA** these fields are not stored in the ASN1 data so they need to be stored externally if validation is required.

As part of FIPS 140-3 DSA is not longer FIPS approved for key generation and signature validation, but is still allowed for signature verification.

### 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

  - "fips-indicator" (**OSSL\_PKEY\_PARAM\_FIPS\_APPROVED\_INDICATOR**) \<integer\>

  See "Common Information Parameters" in **provider-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 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.

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.

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.

## 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:

- 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.

## COPYRIGHT

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\>.
