During the Import from Keystore operation in Salesforce Certificate and Key Management, Salesforce throws the following error if the private key password and the keystore password are different:
"Error: The Keystore contains a certificate 'certName' whose per key password is not the same as the keystore password."
This error occurs because Salesforce only requests the keystore password during import. In order to decrypt the certificates, Salesforce requires the key password and the keystore password to be identical.
This article explains the cause of the keystore per-key password mismatch error during Salesforce certificate import and how to resolve it.
When creating or exporting a Java Keystore, a separate password can be set for the keystore itself and for each individual key entry within the keystore. Salesforce requires these two passwords to match.
Example:
For the below code sample, let's say that our password for the "key password" was set to 1234567 initially. Salesforce only requests the "keystore password" be set, so Salesforce needs to be able to decrypt the certificates with this alone by having the passwords match. Thus, when we run the below;
keytool -importkeystore -srckeystore keystore.jks -destkeystore keystore-in-pkcs12.p12 -deststoretype PKCS12 Enter destination keystore password: <123456> Re-enter new password: <123456> Enter source keystore password: <123456> Enter key password for <salesforce> <123456> keytool error: java.security.UnrecoverableKeyException: Cannot recover key
The "keystore" and "key" passwords do not match, so it will throw an 'UnrecoverableKeyException' error.
To resolve this error, ensure that the private key password and the keystore password are set to the same value when creating or re-exporting the keystore.
000387714

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.