Technical Tip: How to Convert a PKCS#12 Certificate to Legacy Format for FortiManager/FortiAnalyzer
| Description | This article explains how to convert a PKCS#12 or PFX certificate created with a newer OpenSSL version that FortiManager/FortiAnalyzer to a legacy format using OpenSSL on a Linux system. This is required when importing certain certificates into FortiManager/FortiAnalyzer if the newer format is not supported. |
| Scope | FortiManager/FortiGate v7.x. |
| Solution | When importing a local certificate under System Settings -> Certificates does not work because the certificate was created with a newer OpenSSL version that FortiManager/FortiAnalyzer does not yet support.
Importing certificate Error will be something like 'Importing local certificate failed. It might already exist'.
Here is a step-by-step procedure on a Linux PC using Linux commands to convert and export the certificate so it can be successfully uploaded to FortiManager/FortiAnalyzer.
ubuntu@ubuntu1910:~/Documents$ mkdir legacy_folder
ubuntu@buntu1910:~/Documents$ openssl pkcs12 -in <CERTIFICATE_NAME>.pfx -out legacy_folder/key.pem -nocerts -nodes -legacy
ubuntu@ubuntu1910:~/Documents$ openssl pkcs12 -in <CERTIFICATE_NAME>.pfx -out legacy_folder/cert.pem -nokeys -nodes -legacy
ubuntu@ubuntu1910:~/Documents$ openssl rsa -in legacy_folder/key.pem -out key_legacy_new.pem
ubuntu@ubuntu1910:~/Documents$ openssl pkcs12 -export -out legacy_version.pfx -inkey key_legacy_new.pem -in legacy_folder/cert.pem Once the certificate is converted to the legacy format, it can then be uploaded to FortiManager/FortiAnalyzer under System Settings -> Certificates -> Create New/Import.
Note: When a user receives a certificate in .cer format along with a private key protected by a password, it is necessary to convert it to a .pfx file.
To create a .pfx file (also known as a .p12 file) from a .cer (certificate) file and a private key, OpenSSL can be used. This command combines the certificate and its corresponding private key into a single, password-protected file — often required for server deployments or for importing into other systems.
Example command: [Enter Export Password: xxxxxxx
Explanation of the command:
|
