mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8266400: importkeystore fails to a password less pkcs12 keystore
Reviewed-by: weijun
This commit is contained in:
parent
f5562f1214
commit
f2d880c11a
2 changed files with 92 additions and 3 deletions
|
@ -2429,8 +2429,15 @@ public final class Main {
|
|||
newPass = destKeyPass;
|
||||
pp = new PasswordProtection(destKeyPass);
|
||||
} else if (objs.snd != null) {
|
||||
newPass = P12KEYSTORE.equalsIgnoreCase(storetype) ?
|
||||
storePass : objs.snd;
|
||||
if (P12KEYSTORE.equalsIgnoreCase(storetype)) {
|
||||
if (isPasswordlessKeyStore) {
|
||||
newPass = objs.snd;
|
||||
} else {
|
||||
newPass = storePass;
|
||||
}
|
||||
} else {
|
||||
newPass = objs.snd;
|
||||
}
|
||||
pp = new PasswordProtection(newPass);
|
||||
}
|
||||
|
||||
|
@ -2442,7 +2449,7 @@ public final class Main {
|
|||
keyStore.setEntry(newAlias, entry, pp);
|
||||
// Place the check so that only successful imports are blocked.
|
||||
// For example, we don't block a failed SecretEntry import.
|
||||
if (P12KEYSTORE.equalsIgnoreCase(storetype)) {
|
||||
if (P12KEYSTORE.equalsIgnoreCase(storetype) && !isPasswordlessKeyStore) {
|
||||
if (newPass != null && !Arrays.equals(newPass, storePass)) {
|
||||
throw new Exception(rb.getString(
|
||||
"The.destination.pkcs12.keystore.has.different.storepass.and.keypass.Please.retry.with.destkeypass.specified."));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue