Skip to content

Commit 80575cc

Browse files
martinuyfranferrax
andcommitted
8301553: Support Password-Based Cryptography in SunPKCS11 (iteration #3)
Co-authored-by: Francisco Ferrari <[email protected]> Co-authored-by: Martin Balao <[email protected]>
1 parent 41b1472 commit 80575cc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11SecretKeyFactory.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,12 @@ static P11Key convertKey(Token token, Key key, String svcAlgo,
347347
throw new InvalidKeyException("Encoded format must be RAW");
348348
}
349349
byte[] encoded = key.getEncoded();
350-
p11Key = createKey(token, encoded, svcAlgo, si.keyType, extraAttrs);
350+
try {
351+
p11Key = createKey(token, encoded, svcAlgo, si.keyType,
352+
extraAttrs);
353+
} finally {
354+
Arrays.fill(encoded, (byte) 0);
355+
}
351356
}
352357
token.secretCache.put(key, p11Key);
353358
return p11Key;

0 commit comments

Comments
 (0)