How to recognize the problem
- When installing the certificate (VPN & app user certificate or Wi-Fi certificate), Android reports “Incorrect password” or “Couldn’t extract certificate”.
- The password works on the PC, e.g. when opening the file with OpenSSL or on Windows.
- The file was created with OpenSSL 3, directly or through a program that uses it: current Linux distributions, XCA, Easy-RSA, OPNsense or pfSense, VPN server scripts.
Typically affected are client certificates for OpenVPN and strongSwan, and for company Wi-Fi with EAP-TLS.
The cause
Up to OpenSSL 1.1, PKCS#12 files were protected with older methods (3DES or RC2, checksum with SHA-1). Since OpenSSL 3.0 the default is AES-256-CBC with PBKDF2 and SHA-256. That is more secure, but many Android versions, older macOS and Windows versions and some appliances don’t understand the format. Instead of “format not supported” they report “incorrect password”.
Check the file
openssl pkcs12 -info -in client.p12 -noout
If it shows PBES2, PBKDF2, AES-256-CBC, it is the new format. With pbeWithSHA1And3-KeyTripleDES-CBC the file is in the old, compatible format and the problem is elsewhere, see below.
Fix 1: export again with -legacy
openssl pkcs12 -export -legacy -in client.crt -inkey client.key -certfile ca.crt -out client-android.p12
If OpenSSL reports unsupported, the legacy provider is missing. Then use 3DES, which OpenSSL 3 supports by default:
openssl pkcs12 -export -in client.crt -inkey client.key -certfile ca.crt \ -keypbe PBE-SHA1-3DES -certpbe PBE-SHA1-3DES -macalg sha1 -out client-android.p12
Fix 2: convert an existing .p12
If you only have the finished file, unpack it and pack it again:
openssl pkcs12 -in client.p12 -nodes -out temp.pem openssl pkcs12 -export -legacy -in temp.pem -out client-android.p12 rm temp.pem # contains the key unencrypted
Fix 3: in the browser, without OpenSSL
The certificate converter always creates .p12 files in the compatible format (3DES, SHA-1). You can give it an existing .p12 and output a new .p12, or paste certificate, key and chain separately. If the intermediate is missing, it completes the chain on request. The files never leave your computer.
Install on Android
Since Android 11 this only works via Settings, no longer by tapping the file: Settings → Security → More security settings → Encryption & credentials → Install a certificate. Choose “VPN & app user certificate” for VPN apps or “Wi-Fi certificate” for company Wi-Fi. On Samsung and other brands the menus are named slightly differently; searching Settings for “certificate” helps.
If it still doesn’t work
- Special characters in the password: umlauts and some special characters are encoded differently by different programs. For a test, create the file again with a simple password of letters and digits.
- No key in the file: a .p12 with certificates only cannot be installed as a user certificate.
openssl pkcs12 -infomust show aShrouded Keybag. - Installing only a CA certificate: for that you don’t need a .p12 but the CA’s .crt file (PEM or DER) as “CA certificate”. The converter converts it if needed.
- For company Wi-Fi there has been an extra hurdle with the CA certificate and the Domain field since Android 11, see Wi-Fi with certificates on Android.
FAQ
Is the old format insecure?
3DES with SHA-1 is weaker than AES-256, but still protects the file decently, especially with a long password. What matters is deleting the .p12 from the device after import and not sending it unencrypted.
Does this affect iPhone and Mac too?
Yes, older macOS and iOS versions also report a wrong password for AES-protected files, often as “MAC verification failed”. The fix is the same.
Which Android versions are affected?
There are reports from Android 10 to 13, depending on vendor and update level. A file in the old format works on all versions, which makes it the safe choice for Android.