Note:
Certificatetool.com offers online and free SSL certificate format conversion tool without needing any software installation or running the OpenSSL commands. If you would like to convert your CER file to other formats, check CER Converter page.
Converting CER to P12 online is easy using Certificatetool.com tool
Just follow these steps:
- Upload Certificate File and Private Key (Optional)
- Select the initial file format and the format you want to convert to.
- Click the «Convert» button to begin the file conversion process. Please wait until output file is ready for download.
What is CER format?
A .cer file functions as a Secure Sockets Layer (SSL) certificate file, crucial for securing communication between web servers and web browsers. SSL certificates achieve this by encrypting transmitted data, thwarting eavesdroppers from intercepting and deciphering sensitive information.
SSL certificates are broadly categorized into server certificates and client certificates. Web servers utilize server certificates to authenticate themselves to web browsers, while client certificates enable web browsers to authenticate themselves to web servers. While .cer files are primarily associated with server certificates, they can also be employed for client certificates.
To utilize a .cer file, installation on the respective web server or web browser is necessary, with installation procedures varying depending on the software in use. Once installed, the .cer file becomes instrumental in verifying the identity of the counterpart before establishing a secure connection.
For web browsers, the validity of the .cer file can be confirmed by checking the lock icon in the address bar; a green lock icon signifies a valid certificate and a secure connection. On the other hand, web servers can verify .cer file validity by examining error logs, where the absence of errors indicates a valid certificate, signaling the server’s readiness to accept connections.
What is P12 format?
A file bearing the ‘.p12’ extension is a security key file associated with the Simple Order API. This extension signifies that the file adheres to the PKCS #12 standard, a part of the Public-Key Cryptography Standards (PKCS) established by RSA Laboratories. Functioning as an archive, a P12 file encompasses all essential cryptographic components.
Within a P12 file, one finds the private key, the public certificate from the Certificate Authority, and all intermediate certificates employed for signing. Notably, a P12 file can include a maximum of 10 intermediate certificates. These files play a pivotal role in securing communications between two applications and serve as a repository for digital certificates, including SSL certificates.
Creating a P12 file involves utilizing tools like OpenSSL, an open-source implementation of the SSL and TLS protocols. Once generated, the P12 file can be employed for securing communications or storing digital certificates.
To secure communications, the P12 file must be installed on both client and server machines. The client uses the P12 file to generate private and public keys, while the server verifies the client’s identity using the public key. Alternatively, for storing digital certificates, saving the P12 file to a secure location suffices. Additionally, key management tools can be employed for efficient P12 file management.
P12 files emerge as a secure and practical solution for storing and utilizing digital certificates. They offer a convenient means of ensuring secure communication between applications.
Why Choose Certificatetool.com to Convert Your Certificates?
Certificatetool.com offers the following advantages:
- Effortless online conversion: Our website seamlessly runs code in the backend to convert your certificate files directly online. No need to grapple with OpenSSL commands yourself!
- Expertise at your fingertips: We handle all the complexities of SSL certificate file conversions, saving you time and effort.
- Fast, free, and simple: Upload your file, private key, and press the «Convert» button. It’s that easy!
- Unmatched privacy: We never store any files you upload, ensuring complete confidentiality and peace of mind.
Don’t hesitate to experience the convenience of Certificatetool.com for your certificate conversion needs.

A computer keyboard
Image Credit:
Devonyu/iStock/Getty Images
CER and P12 are both types of digital security certificates created with the OpenSSL program. P12 is a type of encryption within the more well-known PFX family (it shares the extension). To convert a CER certificate to a P12, simply run one command in OpenSSL. The security data will be the same, retaining your access key embedded within the file itself.
Step 2
Copy and paste the following into the command window: openssl pkcs12 -export -out OUTPUTNAME.pfx -inkey KEY.key -in FILENAME.cer -certfile CACert.crt
Step 3
Replace «OUTPUTNAME» with the desired name of your P12 PFX file.
Step 4
Replace KEY with the access key of the CER (which will be transferred to the P12).
Step 5
Replace «FILENAME» with the name of the existing CER file.
Step 6
Hit Enter. This will perform the conversion, saving the P12 in the same folder as the CER.
Table of Contents
- Installing OpenSSL
- OpenSSL on Linux
- OpenSSL on Windows
- From PEM (pem, cer, crt) to PKCS#12 (p12, pfx)
- From PKCS#12 to PEM
- From DER (.der, cer) to PEM
- From PEM to DER
- From PEM to PKCS#7 (.p7b, .p7c)
- From PKCS#7 to PEM
- From PKCS#7 to PFX
- Online SSL Converters
- Conclusions
In this post, part of our «how to manage SSL certificates on Windows and Linux systems» series, we’ll show how to convert an SSL certificate into the most common formats defined on X.509 standards: the PEM format and the PKCS#12 format, also known as PFX. The conversion process will be accomplished through the use of OpenSSL, a free tool available for Linux and Windows platforms.
Before entering the console commands of OpenSSL we recommend taking a look to our overview of X.509 standard and most popular SSL Certificates file formats — CER, CRT, PEM, DER, P7B, PFX, P12 and so on.
Installing OpenSSL
The first thing to do is to make sure your system has OpenSSL installed: this is a tool that provides an open source implementation of SSL and TLS protocols and that can be used to convert the certificate files into the most popular X.509 v3 based formats.
OpenSSL on Linux
If you’re using Linux, you can install OpenSSL with the following YUM console command:
If your distribution is based on APT instead of YUM, you can use the following command instead:
> apt—get install openssl |
OpenSSL on Windows
If you’re using Windows, you can install one of the many OpenSSL open-source implementations: the one we can recommend is Win32 OpenSSL by Shining Light Production, available as a light or full version, both compiled in x86 (32-bit) and x64 (64-bit) modes . You can install any of these versions, as long as your system support them.
OpenSSL is basically a console application, meaning that we’ll use it from the command-line: after the installation process completes, it’s important to check that the installation folder (C:\Program Files\OpenSSL-Win64\bin for the 64-bit version) has been added to the system PATH (Control Panel > System> Advanced > Environment Variables): if it’s not the case, we strongly recommend to manually add it, so that you can avoid typing the complete path of the executable everytime you’ll need to launch the tool.
Once OpenSSL will be installed, we’ll be able to use it to convert our SSL Certificates in various formats.
From PEM (pem, cer, crt) to PKCS#12 (p12, pfx)
This is the console command that we can use to convert a PEM certificate file (.pem, .cer or .crt extensions), together with its private key (.key extension), in a single PKCS#12 file (.p12 and .pfx extensions):
> openssl pkcs12 —export —in certificate.crt —inkey privatekey.key —out certificate.pfx |
If you also have an intermediate certificates file (for example, CAcert.crt) , you can add it to the «bundle» using the -certfile command parameter in the following way:
> openssl pkcs12 —export —in certificate.crt —inkey privatekey.key —out certificate.pfx —certfile CAcert.cr |
From PKCS#12 to PEM
If you need to «extract» a PEM certificate (.pem, .cer or .crt) and/or its private key (.key)from a single PKCS#12 file (.p12 or .pfx), you need to issue two commands.
The first one is to extract the certificate:
> openssl pkcs12 —in certificate.pfx —nokey —out certificate.crt |
And a second one would be to retrieve the private key:
> openssl pkcs12 —in certificate.pfx —out privatekey.key |
IMPORTANT: the private key obtained with the above command will be in encrypted format: to convert it in RSA format, you’ll need to input a third command:
> openssl rsa —in privatekey.key —out privatekey_rsa.key |
Needless to say, since PKCS#12 is a password-protected format, in order to execute all the above commands you’ll be prompted for the password that has been used when creating the .pfx file.
From DER (.der, cer) to PEM
> openssl x509 —inform der —in certificate.cer —out certificate.pem |
From PEM to DER
> openssl x509 —outform der —in certificate.pem —out certificate.der |
From PEM to PKCS#7 (.p7b, .p7c)
> openssl crl2pkcs7 —nocrl —certfile certificate.pem —out certificate.p7b —certfile CAcert.cer |
From PKCS#7 to PEM
> openssl pkcs7 —print_certs —in certificate.p7b —out certificate.pem |
From PKCS#7 to PFX
> openssl pkcs7 —print_certs —in certificatename.p7b —out certificatename.cer > openssl pkcs12 —export —in certificatename.cer —inkey privateKey.key —out certificatename.pfx —certfile cacert.cer |
Online SSL Converters
If you can’t (or don’t want to) install OpenSSL, you can convert your SSL Certificates using one of these web-based online tools:
- SSL Certificates Converter Tool by SSLShopper.com
- SSL Converter by NameCheap
Both of them work really well and can convert most, if not all, the format detailed above: at the same time, you need to seriously think about the security implications that come with uploading your SSL Certificates (and possibly their private keys) to a third-party service. As trustable and secure those two site have been as of today, we still don’t recommend such move.
Conclusions
That’s it, at least for the time being: we hope that these commands will be helpful to those developers and system administrators who need to convert SSL certificates in the various formats required by their applications.
See you next time!
Есть файл с раширением .cer с содержанием:
——BEGIN CERTIFICATE——
<ключ>
——END CERTIFICATE——
Нужно сгенерировать файл с расширением .p12 на основе .cer — файла. Гугл не помог, так как не понятен сам механизм генерации приватных ключей и как их «слепить» с .cer
-
Вопрос задан
-
2749 просмотров
Приватный ключ создается одновременно с открытым. Это самый первый шаг любого сертификата.
Затем создается запрос на сертификат, содержащий только открытый (!) ключ, он отправляется в УЦ, а УЦ выпускает собственно сертификат. Т.е.:
1) одного сертификата CER недостаточно, чтобы создать контейнер PKCS#12 (приватный ключ+сертификат)
2) где-то там, где Вы создавали запрос на сертификат, у Вас есть и приватный ключ — найдите его и выполните инструкции, которые Вы нашли в Гугле.
Пригласить эксперта
Войдите, чтобы написать ответ
-
Показать ещё
Загружается…
Минуточку внимания
Чтобы вы могли без проблем пользоваться SSL-сертификатом на разных платформах и устройствах, иногда требуется изменить его формат. Дело в том, что некоторые форматы лучше подходят для работы с различными видами программного обеспечения. Далее мы расскажем о том, какие форматы бывают, в каких случаях используются и какими способами можно конвертировать один формат сертификата в другой.
Форматы сертификатов
Существует четыре основных формата сертификатов:
PEM — популярный формат используемый Центрами Сертификации для выписки SSL-сертификатов.
Основные расширения этого типа .pem, .crt, .cer, .key. В файлах содержатся строки вида
-----BEGIN CERTIFICATE----- -----END CERTIFICATE----- -----BEGIN PRIVATE KEY----- -----END PRIVATE KEY ------
Сертификаты PEM подходят для установки на веб-серверы nginx, apache2.
DER — это бинарная форма сертификата PEM.
Основные расширения этого типа сертификата .der .cer
Сертификаты DER подходят для установки на серверы Java.
P7B. Файлы P7B кодируются в формате Base64 и имеют расширение .p7b или .p7c.
В файлах содержатся строки вида
-----BEGIN PKCS7----- -----END PKCS7-----
Сертификаты P7B подходят для установки на серверы MS Windows, Java Tomcat
PFX — это сертификат в бинарном формате, выданный для домена, включающий в себя сертификат, цепочку сертификатов (корневые сертификаты) и приватный ключ. Имеют расширение .pfx или .p12.
Сертификаты PFX подходят для установки на серверы Windows, в частности Internet Information Services(IIS).
Способы конвертации
Существует несколько способов конвертации сертификатов, которые отличаются между собой только простотой конвертирования и уровнем безопасности. Мы расскажем о трех из них.
Конвертация SSl сертификатов посредством OpenSSL
OpenSSL — это надежный, коммерческий и полнофункциональный инструментарий для протоколов Transport Layer Security (TLS) и Secure Sockets Layer (SSL). А также библиотека криптографии общего назначения. Конвертация с использованием библиотеки OpenSSL считается одним из самых безопасных способов: все данные будет сохранены непосредственно на устройстве, на котором будут выполняться операции по конвертированию.
Для того чтобы воспользоваться им, вам необходимо перейти в командную строку и выполнить команды.
Предоставленные ниже примеры команд OpenSSL позволяют конвертировать сертификаты и ключи в нужный формат.
Конвертировать PEM в DER можно посредством команды:
openssl x509 -outform der -in site.crt -out site.der
Аналогично, для других типов:
PEM в P7B
openssl crl2pkcs7 -nocrl -certfile site.crt -out site.p7b -certfile site.ca-bundle
PEM в PFX
openssl pkcs12 -export -out site.pfx -inkey site.key -in site.crt -certfile site.ca-bundle
Обращаем ваше внимание, что после выполнения команды, будет запрошена установка пароля ключа.
DER в PEM
openssl x509 -inform der -in site.der -out site.crt
P7B в PEM
openssl pkcs7 -print_certs -in site.p7b -out site.cer
P7B в PFX
openssl pkcs7 -print_certs -in site.p7b -out certificate.ceropenssl pkcs12 -export -in site.cer -inkey site.key -out site.pfx -certfile site.ca-bundle
PFX в PEM
openssl pkcs12 -in site.pfx -out site.crt -nodes
Конвертация при помощи онлайн-сервисов
Для конвертации сертификатов самый удобный способ — использование специальных сайтов. Этот способ считается наименее безопасным методом: никогда не знаешь, сохраняет ли автор сайта ваш приватный ключ при конвертации.
Конвертация с PEM в DER
Для конвертации необходим только файл сертификата .crt, .pem
Конвертация с PEM в P7B
В этом случае существует возможность добавить также цепочку сертификатов.
Что такое цепочка сертификатов и для чего она нужна, можно узнать в статье «Что такое корневой сертификат»
Конвертация с PEM в PFX
В этом случае необходимо обратить внимание на то, что обязателен ключ сертификата, а также необходимо установить пароль ключа.
Конвертация из DER в PEM
Конвертация из P7B в PEM
Конвертация из P7B в PFX
Конвертация из PFX в PEM
Конвертация скриптом openssl-ToolKit
OpenSSL ToolKit — скрипт, который облегчает работу с библиотекой OpenSSL. Работа со скриптом является безопасным решением, т.к сертификаты и ключи сертификата никуда не передаются, а используются непосредственно на вашем сервере.
Для начала работы скрипт необходимо скачать и запустить. Сделать это можно одной командой:
echo https://github.com/tdharris/openssl-toolkit/releases/download/1.1.0/openssl-toolkit-1.1.0.zip \ | xargs wget -qO- -O tmp.zip && unzip -o tmp.zip && rm tmp.zip && ./openssl-toolkit/openssl-toolkit.sh
После выполнения команды откроется следующее окно:
Нас интересует пункт 2. Convert certificates
После перехода в пункт 2. появится следующее меню, с выбором нужного типа конвертирования
После выбора преобразования, в данном случае PEM to FPX, скрипт предложит выбрать директорию с сертификатами на том устройстве, где запускается скрипт.
В нашем случае мы их скачали в директорию /home/ivan/crt/
После корректного ввода директории, скрипт отобразит все файлы в этой директории.
Далее нужно ввести имя сертификата, который будем конвертировать, в нашем случае это site.pem
Обращаю ваше внимание, что для корректной конвертации, с PEM в PFX, необходимо вручную объединить файл сертификата, цепочки и ключа в один файл, иначе будет возникать ошибка конвертации.
Сделать это можно простой командой
cat site.crt site.ca-bundle site.key > site.pem
Данное действие необходимо только для конвертации из PEM в PFX.
Мы рассмотрели пример конвертации PEM в PFX. Этим же путем можно конвертировать сертификаты в другие форматы. Единственное, что вам уже не понадобится шаг с объединением файлов.
Пример конвертации PEM В DER.