To generate a Certificate Signing Request (CSR) for your SSL certificate using OpenSSL, follow these organized steps:
- OpenSSL Command Execution:
- Replace the placeholders with your actual information:
C=USfor your country (e.g., United States).ST=Californiafor your state.L=New Yorkfor your city.O=Company Namefor your organization.OU=ITfor your department or leave as NA if not applicable.CN=www.example.comfor your domain name. Use*.example.comfor a wildcard SSL.
- Replace the placeholders with your actual information:
- Verify and Copy CSR Content:
- Copy the entire content from the start to the end of the file.
- Apply for SSL Certificate:
- Submit the CSR to your Certificate Authority (CA). Ensure the CA receives the correct content without any errors.
- Convert to PFX if Needed:
- Replace
certificate.cerwith the actual file received from the CA.
- Replace
- Installation and Testing:
- Install the .pfx file on your server.
- Test SSL functionality by accessing your website to ensure the certificate is correctly implemented.
- Security Considerations:
- Ensure OpenSSL and related files have appropriate permissions for the user running the service.
- Backup both the private key (
server.key) and the SSL certificate securely.
Once you receive the SSL certificate, typically in .cer or .p7b format, convert it to a .pfx file using OpenSSL if installing on Windows:
openssl pkcs12 -export -out your_certificate.pfx -in certificate.cer -key server.key -certfile root.cer
Open server_csr.txt using a text editor (e.g., Notepad on Windows) by running:
notepad server_csr.txt
Open a terminal or command prompt and run the following command to create the private key and CSR:
openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server_csr.txt -subj "/C=US/ST=California/L=New York/O=Company Name/OU=IT/CN=www.example.com"
