{"id":26075,"date":"2023-02-20T07:34:45","date_gmt":"2023-02-20T07:34:45","guid":{"rendered":"http:\/\/localhost\/helpold\/?p=26075"},"modified":"2024-12-19T00:20:22","modified_gmt":"2024-12-18T20:50:22","slug":"creating-a-pem-file-for-ssl-tls-certification-installation","status":"publish","type":"post","link":"https:\/\/www.arvancloud.ir\/help\/en\/creating-a-pem-file-for-ssl-tls-certification-installation\/","title":{"rendered":"Creating a .PEM File for SSL\/TLS Certification Installation"},"content":{"rendered":"<p style=\"text-align: left;\">Privacy Enhanced Mail, or as it is commonly known PEM, is a file format widely used for storing and transferring encrypted data, especially certificates and cryptographic keys. A file with .PEM extension acts as a container of encrypted data placed within.<br \/>\nPEM is the most common format to issue certificates. It encodes data using Base64, which makes it easier to be translated and understood by web servers. They actually can be opened and checked using a simple text editor like Notepad or VIM.<br \/>\nIn an open-source system, a PEM file containing private keys can usually be recognized with its .key extension, whereas a PEM file containing certificates has a .cer, .crt, or .pem format.<\/p>\n<h2 style=\"text-align: left;\">What does a PEM file look like?<\/h2>\n<p style=\"text-align: left;\">A private key within a PEM file will look like this:<\/p>\n<pre><code>-----BEGIN PRIVATE KEY-----\r\nMIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCuaGs3MHEOUMvO\r\nv7QLx1cAgx7BDMHE0eq70\/A+JZlYjDL7IAcoubgibfRWyEPombDF\/TtnOzuYXuNT\r\ntkGVK+iOI3HbTgVANOrhIhTO91Vh3MDBftlNdzsYg4Ct\/dZfvwGixgVfOza5nYcP\r\nSFJ5r89fre1EV\/3QA3m+oPYimejcTCwEcByxxP7unmoxR9wJMYCmF3IOtRKGMhCn\r\nIbmIRwvaQ0yeCk9vh4WoZBbqJx4pVXmqz5D4IfDt2E41NiecWVoNHMTEF9xE2Few\r\n3tPyfMMtqQH713DiVNmLBjHkJLK8a\/ev2NjFMg8KTZ0hlVyaeBZDPz0iNk3iaeXf\r\npspZ42kPAgMBAAECggEANcqEzufE5spqoaCksk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ngx+V5D3wqT6iUARZ1GiROm61f0QGEW\/AatWg9dMCgYAAnR\/QIVTUV+LuINT9lBUs\r\nv7lqQzo8wUC2Itn6nD3zmKiJb\/lvA\/jSZAXMGc3oqBS+ocznKrABp39MONj6Bp7l\r\nzvrNHuO8L5v7kK24snyyBfyizu03IbkHUOiIs5rXuD1N6fVG2XKQv9QsUm6NZp0o\r\n1uGia9hksHK00QOXRhsGdA==\r\n-----END PRIVATE KEY-----<\/code><\/pre>\n<p style=\"text-align: left;\">And a certificate within a PEM file will have a structure like:<\/p>\n<pre><code>-----BEGIN CERTIFICATE-----\r\nMIICLDCCAdKgAwIBAgIBADAKBggqhkjOPQQDAjB9MQswCQYDVQQGEwJCRTEPMA0G\r\nA1UEChMGR251VExTMSUwIwYDVQQLExxHbnVUTFMgY2VydGlmaWNhdGUgYXV0aG9y\r\naXR5MQ8wDQYDVQQIEwZMZXV2ZW4xJTAjBgNVBAMTHEdudVRMUyBjZXJ0aWZpY2F0\r\nZSBhdXRob3JpdHkwHhcNMTEwNTIzMjAzODIxWhcNMTIxMjIyMDc0MTUxWjB9MQsw\r\nCQYDVQQGEwJCRTEPMA0GA1UEChMGR251VExTMSUwIwYDVQQLExxHbnVUTFMgY2Vy\r\ndGlmaWNhdGUgYXV0aG9yaXR5MQ8wDQYDVQQIEwZMZXV2ZW4xJTAjBgNVBAMTHEdu\r\ndVRMUyBjZXJ0aWZpY2F0ZSBhdXRob3JpdHkwWTATBgcqhkjOPQIBBggqhkjOPQMB\r\nBwNCAARS2I0jiuNn14Y2sSALCX3IybqiIJUvxUpj+oNfzngvj\/Niyv2394BWnW4X\r\nuQ4RTEiywK87WRcWMGgJB5kX\/t2no0MwQTAPBgNVHRMBAf8EBTADAQH\/MA8GA1Ud\r\nDwEB\/wQFAwMHBgAwHQYDVR0OBBYEFPC0gf6YEr+1KLlkQAPLzB9mTigDMAoGCCqG\r\nM49BAMCA0gAMEUCIDGuwD1KPyG+hRf88MeyMQcqOFZD0TbVleF+UsAGQ4enAiEA\r\nl4wOuDwKQa+upc8GftXE2C\/\/4mKANBC6It01gUaTIpo=\r\n-----END CERTIFICATE-----<\/code><\/pre>\n<h2 style=\"text-align: left;\">How to convert other certificate formats to PEM<\/h2>\n<p style=\"text-align: left;\">The default format of the certificate you own differs depending on its provider or the way it was created. Most of the time, the certificate is a PEM file that can be used easily.<br \/>\nThere will be cases where the certificate will be a file with a different format, such as P7B-PKCS#7, PFX-PKCS#12, or DER. In these cases, you need to convert the certificate into a PEM file. To do this, there are two options:<\/p>\n<ul style=\"text-align: left;\">\n<li>To convert the file using an online tool, like SSL Converter from SSL Shopper<\/li>\n<li>To convert the certificate using OpenSSL commands<\/li>\n<\/ul>\n<p style=\"text-align: left;\">For the first path, you need to upload the file and let the website convert it automatically, while the second path needs special commands to be performed. Here are the commands to convert DER, P7B, and PFX files to PEM.<\/p>\n<h3 style=\"text-align: left;\">DER to PEM:<\/h3>\n<pre><code>openssl x509 -inform der -in certificate.cer -out certificate.pem<\/code><\/pre>\n<h3 style=\"text-align: left;\">P7B to PEM:<\/h3>\n<pre><code>openssl pkcs7 -print_certs -in certificate.p7b -out certificate.pem<\/code><\/pre>\n<h3 style=\"text-align: left;\">PFX to PEM:<\/h3>\n<pre><code>openssl pkcs12 -in certname.pfx -nokeys -out certificate.pem openssl pkcs12 -in certname.pfx -nocerts -out private.key -nodes<\/code><\/pre>\n<h2 style=\"text-align: left;\">Create a Trust Chain<\/h2>\n<p style=\"text-align: left;\">For the SSL\/TLS certificate to work properly, you need an SSL Certificate Trust Chain to be uploaded, instead of a simple certificate. This will let your website to be opened flawlessly in different browsers, under HTTPS protocol.<br \/>\nFor more information, read ArvanCloud\u2019s guide on creating a certificate trust chain.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Privacy Enhanced Mail, or as it is commonly known PEM, is a file format widely used for storing and transferring encrypted data, especially certificates and cryptographic keys. A file with .PEM extension acts as a container of encrypted data placed within. PEM is the most common format to issue certificates. It encodes data using Base64, [&hellip;]<\/p>\n","protected":false},"author":79,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"r1_post_views_count":"947","feedback_yes":"0","feedback_no":"0","ads_id_sidebar":"","ads_id_content":"","footnotes":""},"categories":[249,255],"tags":[],"class_list":["post-26075","post","type-post","status-publish","format-standard","hentry","category-cdn","category-cdn-setting"],"lang":"en","translations":{"en":26075},"pll_sync_post":[],"_links":{"self":[{"href":"https:\/\/www.arvancloud.ir\/help\/wp-json\/wp\/v2\/posts\/26075","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.arvancloud.ir\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.arvancloud.ir\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.arvancloud.ir\/help\/wp-json\/wp\/v2\/users\/79"}],"replies":[{"embeddable":true,"href":"https:\/\/www.arvancloud.ir\/help\/wp-json\/wp\/v2\/comments?post=26075"}],"version-history":[{"count":2,"href":"https:\/\/www.arvancloud.ir\/help\/wp-json\/wp\/v2\/posts\/26075\/revisions"}],"predecessor-version":[{"id":28029,"href":"https:\/\/www.arvancloud.ir\/help\/wp-json\/wp\/v2\/posts\/26075\/revisions\/28029"}],"wp:attachment":[{"href":"https:\/\/www.arvancloud.ir\/help\/wp-json\/wp\/v2\/media?parent=26075"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.arvancloud.ir\/help\/wp-json\/wp\/v2\/categories?post=26075"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.arvancloud.ir\/help\/wp-json\/wp\/v2\/tags?post=26075"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}