October 31, 2020

OpenSSL - Creating CSR with -subj switch

If you are creating a CSR file by using a generated private key, you may use this command:

	openssl req -new -key mycertificate.key -out mycertificate.csr

You will be asked a series of questions after entering the above command:

  • Country Name (2 letter code)
  • State or Province Name (full name)
  • Locality Name (e.g., city)
  • Organization Name (e.g., company)
  • Organizational Unit Name (e.g., section)
  • Common Name (e.g., server FQDN)
  • Email Address
  • A challenge password
  • An optional company name

Using the -subj Switch

-subj allows you to provide all necessary information within the command itself. This switch disables the question prompts when generating a CSR, hence you can generate the CSR without having to provide the answers for questions being asked after entering the command.

	openssl req -new -key mycertificate.key -out mycertificate.csr 
		-subj "/C=SA/ST=Riyadh/L=Riyadh/O=MyCompanyLtd/OU=IT/CN=mycompany"

References:

Related Post(s):

No comments:

Post a Comment