Generate Key And Crt File Apache Openssl

 admin

May 07, 2019 Facebook Twitter Gmail LinkedIn SSL certificates are cool. They will be used more and more. This tutorial should be used only on development and/or test environments! For a production environment please use the already trusted Certificate Authorities (CAs). This key & certificate will be used to sign other self signed certificates. That will be covered. How exactly would I generate a.key file and a.crt file from a.p12 file? Stack Exchange Network Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

  1. Generate Crt File
  2. Generate Key File From Crt

If you want to convert your website from HTTP to HTTPS, you need to get a SSL certificate from a valid organization like Verisign or Thawte. You can also generate self signed SSL certificate for testing purpose.

In this article, let us review how to generate private key file (server.key), certificate signing request file (server.csr) and webserver certificate file (server.crt) that can be used on Apache server with mod_ssl.

Key, CSR and CRT File Naming Convention

Generating a Certificate Signing Request (CSR) using OpenSSL (Apache & modssl, NGINX) A CSR is a file containing your certificate application information, including your Public Key. Generate your CSR and then copy and paste the CSR file into the web form in the enrollment process.

The public key will be signed by a Certification Authority, and the result is a digital certificate (which can be in a CRT file) My point is: if you have a CRT file (aka certificate), it means a key pair was already generated and signed by a Certification Authority. There's no way to generate a new key from it (because it already has a key). How to Create CSR and Install a Wildcard SSL Certificate on Apache Using OpenSSL. Step 2: Copy these files on your server along with the Private Key file. Step 3: Discover Apache httpd.

I typically like to name the files with the domain name of the HTTPS URL that will be using this certificate. This makes it easier to identify and maintain. https://flickspowerup.weebly.com/blog/how-to-use-auto-tune-voice-app.

  • Instead of server.key, I use www.thegeekstuff.com.key
  • Instead of server.csr, I use www.thegeekstuff.com.csr
  • Instead of server.crt, I use www.thegeekstuff.com.crt

1. Generate Private Key on the Server Running Apache + mod_ssl

First, generate a private key on the Linux server that runs Apache webserver using openssl command as shown below.

The generated private key looks like the following.

2. Generate a Certificate Signing Request (CSR)

Using the key generate above, you should generate a certificate request file (csr) using openssl as shown below.

3. Generate a Self-Signed SSL Certificate

For testing purpose, you can generate a self-signed SSL certificate that is valid for 1 year using openssl command as shown below.


You can use this method to generate Apache SSL Key, CSR and CRT file in most of the Linux, Unix systems including Ubuntu, Debian, CentOS, Fedora and Red Hat.

4. Get a Valid Trial SSL Certificate (Optional)

Instead of signing it youself, you can also generate a valid trial SSL certificate from thawte. i.e Before spending the money on purchasing a certificate, you can also get a valid fully functional 21 day trial SSL certificates from Thawte. Once this valid certificate works, you can either decide to purchase it from Thawte or any other SSL signing organization.

This step is optional and not really required. For testing purpose, you can always use the self-signed certificate that was generated from the above step.

Go to Thwate trial certificate request page and do the following:

  • Select “SSL Web Server Certificate (All servers)” under the “select your trial certificate”.
  • Do not check the PKCS #7 check-box under the “configure certificate”
  • Copy/Paste the *.csr file that you generate above in the textbox under “certificate signing request (CSR)”
  • Click on next at the bottom, which will give you a 21-day free trial certificate.


Copy/Paste the trial certificate to the www.thegeekstuff.com.crt file as shown below.

> Add your comment

If you enjoyed this article, you might also like.

Generate Crt File



Next post: Google Chrome OS – Beginning of End of Microsoft?

Generate Key File From Crt

Previous post: Blog Makeover: New Thesis Theme In Action