mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8172525: Improve key keying case
Reviewed-by: mullan, valeriep, rhalade, ahgross
This commit is contained in:
parent
2ad7c43b76
commit
bb2e7a3311
4 changed files with 30 additions and 5 deletions
|
@ -25,6 +25,7 @@
|
|||
|
||||
package com.sun.crypto.provider;
|
||||
|
||||
import java.lang.ref.Reference;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.KeyRep;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
|
@ -80,7 +81,11 @@ final class PBEKey implements SecretKey {
|
|||
}
|
||||
|
||||
public byte[] getEncoded() {
|
||||
return this.key.clone();
|
||||
// The key is zeroized by finalize()
|
||||
// The reachability fence ensures finalize() isn't called early
|
||||
byte[] result = key.clone();
|
||||
Reference.reachabilityFence(this);
|
||||
return result;
|
||||
}
|
||||
|
||||
public String getAlgorithm() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue