The req utility is used to generate a
self-signed certificate or a certificate signing request (CSR). A CSR contains
details of a certificate to be issued by a CA. When creating a CSR, the req command prompts you for the necessary
information from which a certificate request file and an encrypted private key
file are produced. The certificate request is then submitted to a CA for
signing.
If the -nodes (no DES) parameter is not
supplied to req, you are prompted for a pass
phrase which will be used to protect the private key.
![]() | Note |
|---|---|
It is important to specify a validity period (using the |
The options supported by the openssl req
utility are as follows:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
To create a self-signed certificate with an expiry date a year from now, the
req utility can be used as follows to
create the certificate CA_cert.pem and the
corresponding encrypted private key file CA_pk.pem:
openssl req -config ssl_conf_path_name -days 365
-out CA_cert.pem -new -x509 -keyout CA_pk.pemThis following command creates the certificate request MyReq.pem and the corresponding encrypted private
key file MyEncryptedKey.pem:
openssl req -config ssl_conf_path_name -days 365
-out MyReq.pem -new -keyout MyEncryptedKey.pem