mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +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.InvalidKeyException;
|
||||
|
@ -86,7 +87,12 @@ final class DESKey implements SecretKey {
|
|||
public byte[] getEncoded() {
|
||||
// Return a copy of the key, rather than a reference,
|
||||
// so that the key data cannot be modified from outside
|
||||
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