How to convert a PFX certificate to a separate .key/.crt file so it can be used in an Synology Diskstation

How to convert a PFX certificate to a separate .key/.crt file so it can be used in an Synology Diskstation

Install the required programs:

  1. Download one of the win32 light OpenSSL: https://slproweb.com/products/Win32OpenSSL.html
  2. Install it.
  3. Make sure ”Visual C++ 2008 Redistributables” is installed.

This version of OpenSSL requires a “openssl.cnf” configuration file:

  1. Download http://www.tbs-certificats.com/openssl-dem-server-cert-thvs.cnf and rename it to “openssl.cnf” and save it in C:\OpenSSL-Win32\
  2. Start a CMD,  go to c:\OpenSSL-Win32\bin and enter: “set OPENSSL_CONF=c:\OpenSSL-Win32\openssl.cnf”

Convert the file:

  1. Copy the .pxf certificate file to c:\OpenSSL-Win32\bin
  2. In CMD go to c:\OpenSSL-Win32\bin
  3. Type: openssl pkcs12 -in certname.pfx –nodes -nocerts -out key.key
  4. Type: openssl pkcs12 -in certname.pfx -nokeys -out certificate.crt

Clean the files:

  1. Open key.key in Wordpad or Notepad++ (NOT Notepad)
  2. Remove everything before —–BEGIN CERTIFICATE—– and everything after —–END CERTIFICATE—–
  3. Do the same for certificate.crt

You can now import the two files in your Synology Diskstation