Skip to main content

Windows Server 2016 rejects AES-encrypted PFX files

· 2 min read
CertAutoPilot Team
CloudNativeWorks

A PKCS#12 (.pfx) file exported with today's defaults can fail to import on Windows Server 2016 with "The specified network password is not correct.", although the password is right. Newer Windows accepts the same file. The difference is the encryption inside the file, not the password.

What we measured​

On Windows Server 2016 (build 14393, PowerShell 5.1.14393) we imported the same certificate and key packaged two ways:

PFX encryptionWindows Server 2016Windows Server 2022
AES-256-CBC with PBKDF2 / SHA-256 MAC (OpenSSL 3 default)failsimports
TripleDES with SHA-1 (pbeWithSHA1And3-KeyTripleDES-CBC)importsimports

Both ways of importing fail, each with a password error: loading the file with X509Certificate2 says "The specified network password is not correct.", and Import-PfxCertificate says the file requires either a different password or a different protection. Both messages are misleading: Windows Server 2016 cannot read the AES-based protection and reports it as a password problem.

How to export a PFX that older Windows can read​

With OpenSSL 3 or later, ask for TripleDES and a SHA-1 MAC explicitly:

openssl pkcs12 -export -in cert.pem -inkey key.pem -out legacy.pfx \
-certpbe PBE-SHA1-3DES -keypbe PBE-SHA1-3DES -macalg sha1

Check what you produced:

openssl pkcs12 -in legacy.pfx -info -noout

The output should name pbeWithSHA1And3-KeyTripleDES-CBC for the key and certificate bags and MAC: sha1. A modern file shows PBES2, PBKDF2, AES-256-CBC instead.

TripleDES is the weaker protection, so use it only where an older Windows version needs to read the file, keep the PFX password strong, and delete the file once it is imported.

In CertAutoPilot​

When CertAutoPilot deploys to IIS or Exchange it builds the one-time PFX in the TripleDES form, so Windows Server 2016 hosts work without any setting. Where you take a PFX yourself (a download, a file written by a Linux or Windows target, or an e-mail attachment), you choose between Modern (AES-256), the default, and Legacy (TripleDES) for older systems. See downloading certificates and the IIS target.