mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8233884: Avoid looking up standard charsets in security libraries
Reviewed-by: coffeys
This commit is contained in:
parent
301e068935
commit
8e859259bc
48 changed files with 317 additions and 391 deletions
|
@ -29,7 +29,6 @@ import java.io.ObjectStreamException;
|
|||
import java.lang.ref.Reference;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
import java.security.MessageDigest;
|
||||
|
@ -41,6 +40,8 @@ import javax.crypto.Mac;
|
|||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.spec.PBEKeySpec;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
import jdk.internal.ref.CleanerFactory;
|
||||
|
||||
/**
|
||||
|
@ -66,9 +67,8 @@ final class PBKDF2KeyImpl implements javax.crypto.interfaces.PBEKey {
|
|||
private Mac prf;
|
||||
|
||||
private static byte[] getPasswordBytes(char[] passwd) {
|
||||
Charset utf8 = Charset.forName("UTF-8");
|
||||
CharBuffer cb = CharBuffer.wrap(passwd);
|
||||
ByteBuffer bb = utf8.encode(cb);
|
||||
ByteBuffer bb = UTF_8.encode(cb);
|
||||
|
||||
int len = bb.limit();
|
||||
byte[] passwdBytes = new byte[len];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue