Home » Wiki » CER vs CRT Files

CER vs CRT Files

by | SSL Certificate

CER vs CRT Files

How To Convert Files from CRT to CER and CER to CRT

CER and CRT are two common file extensions used for digital certificates. CER files contain encoded certificates in a binary DER format while CRT files contain Base64 encoded certificates in a text format.

While CER and CRT files contain essentially the same certificate data, they use different encoding formats. This means they are not directly interchangeable. To convert a certificate between CER and CRT formats requires decoding and re-encoding the certificate data.

This article will explain the key differences between CER vs CRT files, why you may need to convert between formats, and provide simple step-by-step instructions for converting certificates on Windows and Linux systems.

Key Differences Between CER vs CRT Files

Here are the main differences between CER and CRT certificate files:

  • Encoding: CER files use binary DER encoding while CRT files use Base64 text encoding.
  • File Format: CER files are binary while CRT files are ASCII text.
  • File Extension: CER and CRT file extensions are used to distinguish the encoding.
  • Portability: CRT files are more portable across operating systems than CER.
  • Software Support: Most modern software can handle both CER and CRT files. But some older systems only support one or the other.

The core certificate data is identical. But the different encodings mean the actual file contents will differ. This is why the files are not interchangeable without conversion.

Why Convert Between CER and CRT?

There are a few common scenarios where you may need to convert a certificate file between CER and CRT format:

  • To import a certificate to outdated software or hardware that only supports one format. For example, some older VPN devices may only accept CRT files.
  • To export a certificate from a system that only allows saving in one format. For example, only outputting CER from Windows Certificate Manager.
  • To view or edit a certificate in a text editor. CRT format allows easy viewing and editing as ASCII text.
  • To email a certificate file attachment. CRT works better for email as the Base64 text encoding is less likely to be corrupted or blocked.
  • To post a certificate in forums or wikis that only allow text content. The text CRT format allows easy copy-pasting.

So, while conversion between CER and CRT is rarely essential, it can help make certificates more portable and usable across various systems and software.

Converting CRT to CER on Windows

Windows provides built-in tools to simply convert certificates from CRT to CER format:

Using Certutil

  • Locate the CRT file you want to convert.
  • Open the Command Prompt (cmd).
  • Navigate to the folder containing the CRT file.
  • Run the command:
certutil -encode input.crt output.cer
  • Replace “input.crt” with your CRT file name. This will create a CER output file.
  • You now have a CER version of the certificate!

Using Windows Certificate Manager

  • Locate the CRT file and double-click to open it. This will launch Certificate Manager.
  • In Certificate Manager, click the Details tab and click Copy to File.
  • In the Certificate Export Wizard, select the DER encoded binary X.509 format (.CER) and click Next.
  • Choose a location and name for the exported CER file. Click Next.
  • Click Finish to export the CER file.

The CRT has now been converted and exported as a CER file.

Converting CER to CRT on Windows

Windows also makes it easy to go the other direction – converting CER to CRT:

Using Certutil

  • Locate the CER file you want to convert.
  • Open the Command Prompt (cmd).
  • Navigate to the folder containing the CER file.
  • Run the command:
certutil -decode input.cer output.crt
  • Replace “input.cer” with your CER file name. This will create a CRT output file.
  • You now have a CRT version of the certificate!

Using Windows Certificate Manager

  • Locate the CER file and double-click to open it. This launches Certificate Manager.
  • In Certificate Manager, click the Details tab and click Copy to File.
  • In the Certificate Export Wizard, select the Base-64 encoded X.509 format (.CRT) and click Next.
  • Choose a location and name for the exported CRT file. Click Next.
  • Click Finish to export the CRT file.

This exports and converts the certificate to CRT format.

Converting CER and CRT on Linux

The openssl command provides an easy way to convert certificates between CER and CRT on Linux and Unix systems:

CRT to CER

openssl x509 -inform PEM -in input.crt -out output.cer

This decodes the CRT file and encodes to CER.

CER to CRT

openssl x509 -inform DER -in input.cer -out output.crt

This decodes the CER file and encodes to CRT.

The openssl tool is included by default on most Linux distributions, providing a simple conversion solution.

Alternative Conversion Options

A few other options for CER/CRT conversion include:

  • Online Conversion Tools: various websites provide free online encoding/decoding tools.
  • Microsoft Management Console (MMC): can import/export certificates in either format.
  • OpenSSL Libraries: developers can encode/decode certificates in various languages.
  • Commercial Tools: various paid tools will encode/decode and convert between formats.

However, the Windows and Linux command line methods outlined above provide the simplest and most accessible options for most users.

Troubleshooting CER/CRT Conversion Issues

Here are some troubleshooting tips for potential issues when converting certificates between CER and CRT formats:

  • Encoding Type: make sure to select the correct encoding type (DER for CER, Base64 for CRT) when exporting/converting.
  • File Extensions: certificate files must use the correct extension to be recognized (“.cer” or “.crt”). Rename if needed.
  • Permission Issues: you may need admin or root privileges to convert certificates on some systems.
  • Corrupted Files: check files open correctly and have not been corrupted, truncated or edited incorrectly. Re-export if needed.
  • Software Compatibility: very old software may not recognize newer certificate formats. Try converting to older certificate versions.
  • Invalid Certificates: cannot convert if the original certificate file is invalid, expired or otherwise unusable. Need to start again with a valid cert.

If you still cannot convert between CER and CRT formats, it is worth double-checking the steps, encodings, and certificate validity to troubleshoot the issue.

Conclusion

Converting between the CER vs CRT files format is straightforward using the built-in tools on Windows and Linux. While the encoding differs, both CER and CRT contain the same core certificate data. Converting between the two allows using digital certificates across various software and systems that may only support one format. With the help of utilities like Certutil, Certificate Manager and OpenSSL, you can easily convert certificates from CER to CRT and vice versa. The ability to interconvert certificates helps make them more portable and usable across different environments. Whether you need CER or CRT format, you can encode your certificates into the required format using the simple command line tools outlined here.

Frequently Asked Questions

What is the difference between CER vs CRT files?

CER uses binary DER encoding while CRT uses Base64 text encoding, but both contain the same certificate data.

When would I need to convert a CER to CRT or vice versa?

When importing/exporting certificates to systems that require a specific format, or to view/edit certificates in text format.

Can I just change a .cer file extension to .crt?

No, the file contents are different and won’t be recognized properly without converting the encoding.

Is there an online tool for CER/CRT conversion?

Yes, various websites provide free online conversion tools to encode/decode between CER and CRT.

How do I convert CER/CRT on Mac or Linux?

OpenSSL provides command line utilities on Mac, Linux and UNIX for conversion between various certificate formats.

Do CER and CRT files contain private keys?

No, they only contain public certificate data, not the private key. To convert a PKCS#12 file containing a private key, use OpenSSL.