How to create a DSA public / private key pair using OpenSSL on Linux

Home > Search > How-to

A trusted certificate is one that is purchased from a trusted certificate authority (CA), such as Internet facing production applications should use a certificate from a trusted CA. For non-production applications, a self-signed certificate can be used.  Applications, such as a web browser, will complain when a self-signed certificate is used.



Use  apt-get or yum to install OpenSSL.

~]# apt-get install openssl
~]# yum install openssl


DSA Parameters

Move the the /etc/pki/tls directory, and then create the DSA parameters file.

~]# cd /etc/pki/tls
~]# openssl dsaparam -out dsaparam.pem 2048


View the content of the dsaparam file and ensure BEGIN DSA PARAMETERS is displayed.

~]# cat dsaparam.pem


Private key and Certificate

Ensure root owns the private directory, and that only root can read and write to the private directory.

~]# chown root:root /etc/pki/tls/private
~]# chmod 600 /etc/pki/tls/private


Create an DSA private key and certificate.

~]# openssl req -x509 -newkey dsa:dsaparam.pem -keyout /etc/pki/tls/private/private.key -out /etc/pki/tls/certs/certificate.crt


There will be a series of prompts.

Area Example Description
Password myPassword Password
Country Name US United States
State/Province FL Florida
Locality Name Miami City
Organization Name Example, Inc. Company name
Organization Unit Name Example, Inc. Company name
Common Name Domain name
Email Address Admin email


Ensure only root can read the private key file.

~]# chmod 400 /etc/pki/tls/private/private.key


View the content of the private.key file and ensure BEGIN DSA PARAMETERS is displayed.

~]# cat /etc/pki/tls/private/private.key


View the content of the certificate.crt file and ensure BEGIN CERTIFCATE is displayed.

~]# cat /etc/pki/tls/certs/certificate.crt


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter in the box below so that we can be sure you are a human.