While importing a P12 certificate into Internet Explorer today, I got a message saying "The password you entered is incorrect.":
However, I successfully imported this same certificate, using the same password, on Firefox and Safari. But Internet Explorer (both IE7 and IE8) continued to tell me I was using the wrong password. After checking, double-checking, and quadruple-checking the password, I was 1000% sure the private key password that I was using was correct and that Internet Explorer itself was to blame.
After much trial and error, I discovered the problem: Internet Explorer has a maximum private key password length! The password I was using (modified for security purposes, but identical in length) was as follows:
That's 32 characters, the same length as an MD5. However, Internet Explorer appears to have a problem with that! I changed the password to the following 26 character password and the certificate imported with no complaints from IE!
If you're having the same problem, you may be wondering how to change the password on your P12 file. To do this, you'll need access to OpenSSL. If you have a Mac, you might be able to find OpenSSL in
/opt/local/bin/openssl. But more likely you're on Windows and you will need to download and install the OpenSSL binary for Windows.
You can use the OpenSSL program to convert the P12 file to PEM format, and then convert the PEM certificate back into a P12 file, using a shorter 26-character password when prompted. Here's how:
First, convert the original P12 file to PEM format:
openssl pkcs12 -in my-original.p12 -out certkey.pem -nodes -clcerts
This should give you a file called
certkey.pem. This file contains both the certificate and the private key. However, the next command requires that the key be contained in a separate
key.pem file, so you'll want to edit
certkey.pem with a text editor and extract the private key portion (it should be the bottom half of the file). The
key.pem file should look somewhat like this:
localKeyID: EE 35 CB 41 81 23 4C 89 FF 43 42 E0 3C 3B FF 93 9E 0E B7 AA
-----BEGIN RSA PRIVATE KEY-----
-----END RSA PRIVATE KEY-----
With these files in place, you can run the following command to convert the PEM certificate back into a P12 format, providing a new password (maximum 26 characters) when prompted for the Export Password:
$ openssl pkcs12 -export -in certkey.pem -inkey key.pem -out my-new-certificate.p12 -rand /dev/random
2048 semi-random bytes loaded
Enter Export Password:
Verifying - Enter Export Password:
That's it! Now you should be able to install the certificate in Internet Explorer without any "incorrect password" complaints.