
gendsa Command in Linux
OpenSSL gendsa is a command-line utility in Linux that generates a Digital Signature Algorithm (DSA) private key from a set of parameters. The term gendsa is derived from "gen" for generate and "dsa" for Digital Signature Algorithm. However, this command is now deprecated and has been replaced by "openssl genpkey".
OpenSSL gendsa is not available by default in modern Linux distributions, however, you can still install it manually and use it to get the desired results. In this tutorial, we'll show how to install and use the gendsa command in Linux to generate DSA private keys.
Table of Contents
Here is a comprehensive guide to the options available with the gendsa command −
- How to Install gendsa Command in Linux?
- How to Use gendsa Command in Linux?
- Generating a DSA Private Key Using OpenSSL gendsa
How to Install gendsa Command in Linux?
The gendsa is a part of the OpenSSL toolkit and is usually used to generate DSA private keys that can then be used to generate public keys, create certificates, or sign data. You can install it on Linux using the following commands −
#Installing gendsa on Debian-based Systems sudo apt install openssl #Installing gendsa on Red Hat-based Systems sudo yum install openssl #Installing gendsa on Arch Linux sudo pacman -S openssl
For example, we are using Ubuntu 24.04, so we run the following command to install it on our system −
sudo apt install openssl
The OpenSSL installation requires additional disk space; press y and hit Enter to continue the installation −

Note − Although you can still install gendsa on Linux since gendsa is deprecated, it's recommended to use the openssl genpkey command.
Check Gendsa Version
Now run the given command to verify the OpenSSL gendsa installation on your Linux system −
openssl version
The output confirms that we are using the latest version of OpenSSL −

Access the Man Page of Gendsa
You can also access the manual page for the gendsa command to confirm its installation or to get a basic understanding of the command. For this purpose, you must run the following command −
man gendsa
This command opens the manual page of the OpenSSL, which provides all the information like name, synopsis, description, options, etc.

How to Use gendsa Command in Linux?
The openssl gendsa command is used to generate a Digital Signature Algorithm private key using a DSA parameter file. This parameter file is typically created using the openssl dsaparam command.
Basic Syntax of gendsa Command
To use the gendsa command in Linux, you must type openssl gendsa followed by a valid option and then hit the enter key −
openssl gendsa [-out file_name] [-des] [-des3] [-idea] [-rand file(s)] [-engine id] [paramfile]
Here, file_name is the output file that contains the generated private key. However, if you donât specify the file_name, then the key will be printed to the terminal/standard output.
Options for gendsa Command
Let's discuss the valid options accepted by the openssl gendsa command −
Option | Description |
---|---|
-des|-des3|-idea |
These options encrypt the private key with ciphers before saving it. For instance, the "des" option encrypts the private key with Data Encryption Standard. The "des3" option encrypts the private key with triple DES. The "idea" option encrypts the private key with the IDEA (International Data Encryption Algorithm) cipher. However, if you didn't specify any of these options, the private key will be saved without encryption. |
-rand file(s) |
This option is used to provide one or more files with random data to help create randomness. You can also use an EGD socket. You can separate multiple files with a character based on your OS (; for Windows, , for OpenVMS, and : for others). |
-engine id | This option selects an engine by its unique ID, which gendsa will then use and initialize if necessary. This engine becomes the default for all supported algorithms. |
paramfile | This option specifies the DSA parameter file, which determines the size and properties of the private key. You can generate the DSA parameters using the openssl dsaparam command. |
Help Page of gendsa Command
For a better understanding of the gendsa command, you can run the "openssl gendsa" command followed by the "--help" command −
openssl gendsa --help
This command retrieves information about the general options, output options, random state options, provider options, and parameters −

Generating a DSA Private Key Using OpenSSL gendsa
In this example, we will show you how to generate DSA parameters and then how to generate the DSA Private Key. For this purpose, first, letâs run the dsaparam command to generate the DSA parameters required to create a DSA key −
openssl dsaparam -out dsaparamFile.pem 2048
This command generates DSA parameters with a 2048-bit key length and saves the result to a file named dsaparamFile.pem −

You can verify the file creation by using the ls command. After generating the DSA Parameters file, letâs run the gendsa command to generate a DSA private key for this file −
openssl gendsa -out gen_private_key.pem dsaparamFile.pem
This command generates a DSA private key from the DSA parameters in dsaparamFile.pem and saves it to gen_private_key.pem −

You can check the generated DSA key by running the cat command followed by the file name that contains your DSA private key −
cat gen_private_key.pem
The cat command displays the contents of a file named gen_private_key.pem to the terminal. When we run this command, it shows the following result for the specified private key file −

Thatâs all about using the gendsa command in Linux.
Conclusion
The openssl gendsa command is a part of the OpenSSL toolkit and is used to generate DSA private keys from DSA parameters. Although gendsa is deprecated and replaced by openssl genpkey, however you can still install it manually, and use it for generating DSA keys.
This tutorial covered how to install OpenSSL on different Linux distributions, verify the installation, and utilize the gendsa command for generating private keys. You can manage DSA key creation successfully by following the steps and commands provided in this article. For example, you can use openssl dsaparam to create DSA parameters and openssl gendsa to generate the private key.