The req utility is used to generate a self-signed certificate or a certificate signing request (CSR). A CSR contains details of a certificate issued by a CA. When creating a CSR, the req utility prompts you for the necessary information to produce a certificate request file and an encrypted private key file. 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 is 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 is used to create the certificate
CA_cert.pem
and the corresponding encrypted private key
file CA_pk.pem
, as follows:
openssl req -config ssl_conf_path_name -days 365
-out CA_cert.pem -new -x509 -keyout CA_pk.pem
This 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