SecureString
SecureString copied to clipboard
Avoid allocating array just to fill secure buffer
private static void populateBufferWithSecureKeyData(ByteBuffer key) {
final Random random = new SecureRandom();
final byte bytes[] = new byte[key.capacity()];
random.nextBytes(bytes);
key.put(bytes);
Arrays.fill(bytes, (byte) 0);
}