mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8258915: Temporary buffer cleanup
Reviewed-by: valeriep
This commit is contained in:
parent
31d8a19e47
commit
f834557ae0
79 changed files with 1517 additions and 1039 deletions
|
@ -47,6 +47,7 @@ import javax.crypto.spec.DHParameterSpec;
|
|||
import javax.crypto.spec.DHPublicKeySpec;
|
||||
import java.math.BigInteger;
|
||||
import java.security.spec.NamedParameterSpec;
|
||||
import java.util.Arrays;
|
||||
|
||||
import sun.security.jca.JCAUtil;
|
||||
|
||||
|
@ -82,8 +83,12 @@ public final class KeyUtil {
|
|||
if (key instanceof SecretKey) {
|
||||
SecretKey sk = (SecretKey)key;
|
||||
String format = sk.getFormat();
|
||||
if ("RAW".equals(format) && sk.getEncoded() != null) {
|
||||
size = (sk.getEncoded().length * 8);
|
||||
if ("RAW".equals(format)) {
|
||||
byte[] encoded = sk.getEncoded();
|
||||
if (encoded != null) {
|
||||
size = (encoded.length * 8);
|
||||
Arrays.fill(encoded, (byte)0);
|
||||
}
|
||||
} // Otherwise, it may be a unextractable key of PKCS#11, or
|
||||
// a key we are not able to handle.
|
||||
} else if (key instanceof RSAKey) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue