mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 23:34:52 +02:00
8167371: KeyStoreSpi.engineSetEntry should throw an Exception if password protection alg is specified
Reviewed-by: xuelei, mullan
This commit is contained in:
parent
410b8c8f8f
commit
02ca9985fc
2 changed files with 50 additions and 2 deletions
|
@ -479,6 +479,10 @@ public abstract class KeyStoreSpi {
|
|||
} else if (engineIsKeyEntry(alias)) {
|
||||
KeyStore.PasswordProtection pp =
|
||||
(KeyStore.PasswordProtection)protParam;
|
||||
if (pp.getProtectionAlgorithm() != null) {
|
||||
throw new KeyStoreException(
|
||||
"unsupported password protection algorithm");
|
||||
}
|
||||
char[] password = pp.getPassword();
|
||||
|
||||
Key key = engineGetKey(alias, password);
|
||||
|
@ -524,6 +528,10 @@ public abstract class KeyStoreSpi {
|
|||
KeyStore.PasswordProtection pProtect = null;
|
||||
if (protParam != null) {
|
||||
pProtect = (KeyStore.PasswordProtection)protParam;
|
||||
if (pProtect.getProtectionAlgorithm() != null) {
|
||||
throw new KeyStoreException(
|
||||
"unsupported password protection algorithm");
|
||||
}
|
||||
}
|
||||
|
||||
// set entry
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue