<!DOCTYPE html> <html> <head> </head> <body> <div class="row c-t-title"> <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"> <div> <h2>How to convert a certificate into the appropriate format</h2> </div> </div> </div> <div class="row"> <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"> <div> <div class="syncert-content"> <h4 class="symcert-m-t">Solution</h4> <p>If your server/device requires a different certificate format other than Base64 encoded X.509, a third party tool such as OpenSSL can be used to convert the certificates into the appropriate format.<br /><br />For information on OpenSSL please visit: <a class="targetBlank" href="http://www.openssl.org/" target="_blank" rel="noopener">www.openssl.org</a><br /><br /><strong>Note:</strong> OpenSSL is an open source tool that is not provided or supported by Thawte<br /><br />Some common conversion commands are listed below:</p> <p><strong>Note:</strong> The PEM format is the most common format used for certificates. Extensions used for PEM certificates are cer, crt, and pem. They are Base64 encoded ASCII files. The DER format is the binary form of the certificate. DER formatted certificates do not contain the "BEGIN CERTIFICATE/END CERTIFICATE" statements. DER formatted certificates most often use the '.der' extension.</p> <p><br /><big><strong>Convert x509 to PEM</strong></big></p> <div class="syntaxbox">openssl x509 -in certificatename.cer -outform PEM -out certificatename.pem</div> <p><br /><br /><big><strong>Convert PEM to DER</strong></big></p> <div class="syntaxbox">openssl x509 -outform der -in certificatename.pem -out certificatename.der</div> <p><br /><br /><big><strong>Convert DER to PEM</strong></big></p> <div class="syntaxbox">openssl x509 -inform der -in certificatename.der -out certificatename.pem</div> <p><br /><br /><big><strong>Convert PEM to P7B</strong></big></p> <p><strong>Note:</strong> The PKCS#7 or P7B format is stored in Base64 ASCII format and has a file extension of .p7b or .p7c.<br />A P7B file only contains certificates and chain certificates (Intermediate CAs), not the private key. The most common platforms that support P7B files are Microsoft Windows and Java Tomcat.</p> <div class="syntaxbox">openssl crl2pkcs7 -nocrl -certfile certificatename.pem -out certificatename.p7b -certfile CACert.cer</div> <p><br /><br /><big><strong>Convert PKCS7 to PEM</strong></big></p> <div class="syntaxbox">openssl pkcs7 -print_certs -in certificatename.p7b -out certificatename.pem</div> <p><br /><br /><big><strong>Convert pfx to PEM</strong></big></p> <p><strong>Note:</strong> The PKCS#12 or PFX format is a binary format for storing the server certificate, intermediate certificates, and the private key in one encryptable file. PFX files usually have extensions such as .pfx and .p12. PFX files are typically used on Windows machines to import and export certificates and private keys.</p> <div class="syntaxbox">openssl pkcs12 -in certificatename.pfx -out certificatename.pem</div> <p><br /><br /><big><strong>Convert PFX to PKCS#8</strong></big><br /><strong>Note:</strong> This requires 2 commands<br /><br /><strong>STEP 1:</strong> <strong>Convert PFX to PEM</strong></p> <div class="syntaxbox">openssl pkcs12 -in certificatename.pfx -nocerts -nodes -out certificatename.pem</div> <p><br /><br /><strong>STEP 2:</strong> <strong>Convert PEM to PKCS8</strong></p> <div class="syntaxbox">openSSL pkcs8 -in certificatename.pem -topk8 -nocrypt -out certificatename.pk8</div> <p><br /><br /><big><strong>Convert P7B to PFX</strong></big><br /><strong>Note:</strong> This requires 2 commands<br /><br /><strong>STEP 1: Convert P7B to CER</strong></p> <div class="syntaxbox">openssl pkcs7 -print_certs -in certificatename.p7b -out certificatename.cer</div> <p><br /><br /><strong>STEP 2: Convert CER and Private Key to PFX</strong></p> <div class="syntaxbox">openssl pkcs12 -export -in certificatename.cer -inkey privateKey.key -out certificatename.pfx -certfile cacert.cer</div> <p> </p> <p> </p> </div> </div> </div> </div> </body> </html>
Subscribe
0 Comments
Oldest