LFCS · Question #425
What openssl command will generate a selfsigned test certificate?
The correct answer is A. openssl req new x509 key privkey.pem out cacert.pem days 365. A self-signed certificate can be generated using the openssl req command with the new and x509 options, specifying the private key and validity period.
Question
Options
- Aopenssl req new x509 key privkey.pem out cacert.pem days 365
- Bopenssl sign key privkey.pem out cacert.pem days 365
- Copenssl req key privkey.pem out cacert.pem days 365
- Dopenssl sign new x509 key privkey.pem out cacert.pem days 365
How the community answered
(31 responses)- A74% (23)
- B3% (1)
- C16% (5)
- D6% (2)
Why each option
A self-signed certificate can be generated using the `openssl req` command with the `new` and `x509` options, specifying the private key and validity period.
The `openssl req` command is used for certificate requests. Adding the `-x509` option transforms the certificate request into a self-signed certificate directly, meaning the certificate is signed by the same private key that generates the request. The `new` subcommand initiates a new request, `key privkey.pem` provides the private key, and `days 365` sets the certificate's validity duration.
There is no standard `openssl sign` subcommand for generating certificates; signing operations are typically handled by `openssl x509` when acting as a CA, or by `openssl req -x509` for self-signing.
This command is missing the crucial `-x509` flag, which is required to instruct `openssl req` to produce a self-signed certificate instead of a Certificate Signing Request (CSR).
This option uses the non-existent `openssl sign` subcommand and incorrectly combines `new` with `x509` in a non-standard syntax.
Concept tested: OpenSSL self-signed certificate generation
Source: https://www.openssl.org/docs/manmaster/man1/req.html
Topics
Community Discussion
No community discussion yet for this question.