How to Convert and Import PEM Certificates to IIS 7: A Step-by-Step Guide for SSL/TLS Configuration


2 views

When working with IIS 7, you'll often encounter certificate files in PEM format, especially when dealing with certificates issued by Linux-based CAs or third-party providers. Unlike PFX files that IIS natively supports, PEM files require conversion before they can be properly utilized.

Typically, you'll receive two PEM files:

-----BEGIN CERTIFICATE-----
[Base64-encoded certificate data]
-----END CERTIFICATE-----

And:

-----BEGIN RSA PRIVATE KEY-----
[Base64-encoded private key]
-----END RSA PRIVATE KEY-----

The most reliable method is to use OpenSSL to convert PEM to PFX:

openssl pkcs12 -export -out certificate.pfx -inkey privatekey.pem -in certificate.pem

If you have intermediate certificates, include them with the -certfile parameter:

openssl pkcs12 -export -out certificate.pfx -inkey privatekey.pem -in certificate.pem -certfile intermediate.pem

For Windows users without OpenSSL:

  1. Import the certificate into Certificate Manager (certmgr.msc)
  2. Right-click the certificate → All Tasks → Export
  3. Choose "Yes, export the private key" and select PFX format

Once you have the PFX file:

1. Open IIS Manager
2. Select server node → Server Certificates
3. Click "Import" in the Actions pane
4. Browse to your PFX file and enter the password
5. Assign the certificate to your website bindings
  • Password problems: Ensure you're using the correct export password
  • Private key errors: Verify the private key matches the certificate
  • Chain validation: Install intermediate certificates in the "Intermediate Certification Authorities" store

Always:

  • Secure your PFX files with strong passwords
  • Remove temporary PEM files after conversion
  • Set appropriate NTFS permissions on certificate files

For batch processing:

Import-PfxCertificate -FilePath C:\path\to\certificate.pfx -CertStoreLocation Cert:\LocalMachine\My -Password (ConvertTo-SecureString -String "YourPassword" -Force -AsPlainText)

PEM (Privacy Enhanced Mail) files are Base64-encoded certificate containers commonly used in Unix/Linux environments. IIS 7 on Windows Server typically requires certificates in PFX/PKCS#12 format. When you receive two PEM files (usually containing certificate and private key), you'll need to convert them for IIS compatibility.

First, verify your PEM files' content using OpenSSL:

openssl x509 -in certificate.pem -text -noout
openssl rsa -in privatekey.pem -check -noout

Combine certificate and private key into PFX:

openssl pkcs12 -export -out certificate.pfx -inkey privatekey.pem -in certificate.pem -certfile CACert.pem

After conversion, use IIS Manager:

  1. Open IIS Manager and select server node
  2. Double-click "Server Certificates"
  3. Click "Import" in Actions pane
  4. Browse to your PFX file and enter password

For automated deployment:

Import-PfxCertificate -FilePath C:\path\to\certificate.pfx -CertStoreLocation Cert:\LocalMachine\My -Password (ConvertTo-SecureString -String "yourpassword" -Force -AsPlainText)

Error: "The specified network password is not correct" - Usually means wrong PFX password or corrupted file. Recreate PFX with proper password.

Missing intermediate certificates - Include all CA certificates in the conversion command using -certfile parameter.