8202837: PBES2 AlgorithmId encoding error in PKCS12 KeyStore

Reviewed-by: xuelei
This commit is contained in:
Weijun Wang 2018-07-19 00:14:40 +08:00
parent a825fe0a2d
commit bde972d645
3 changed files with 170 additions and 49 deletions

View file

@ -2098,7 +2098,8 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
RetryWithZero.run(pass -> {
// Use JCE
SecretKey skey = getPBEKey(pass);
Cipher cipher = Cipher.getInstance(algOid.toString());
Cipher cipher = Cipher.getInstance(
mapPBEParamsToAlgorithm(algOid, algParams));
cipher.init(Cipher.DECRYPT_MODE, skey, algParams);
loadSafeContents(new DerInputStream(cipher.doFinal(rawData)));
return null;