public final class SecurityUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static char[] |
bytesToChars(byte[] bytes)
Converts bytes to chars without using any external functions that might
allocate additional buffers for the potentially sensitive data.
|
static byte[] |
charsToBytes(char[] chars)
Converts chars to bytes without using any external functions that might
allocate additional buffers for the potentially sensitive data.
|
static void |
clear(byte[] bytes)
Clears an array of potentially sensitive bytes
|
static void |
clear(char[] chars)
Clears an array of potentially sensitive chars
|
static String |
computeBase64SHA1Hash(byte[] bytes)
Computes the base 64 encoded SHA1 hash of the input.
|
static String |
computeBase64SHA1Hash(char[] input)
Computes the base 64 encoded SHA1 hash of the input.
|
static byte[] |
decrypt(GuardedByteArray guardedByteArray)
Decrypts the value of a
GuardedByteArray. |
static String |
decrypt(GuardedString guardedString)
Decrypts the value of a
GuardedString. |
static boolean |
verifyBase64SHA1Hash(char[] input,
String hash)
Verifies the base 64-encoded SHA1 hash of the input.
|
public static byte[] charsToBytes(char[] chars)
chars - The charspublic static char[] bytesToChars(byte[] bytes)
bytes - The bytes (to convert into characters).public static void clear(byte[] bytes)
bytes - The bytes. May be null.public static void clear(char[] chars)
chars - The characters. May be null.public static String computeBase64SHA1Hash(char[] input)
input - The input charspublic static String computeBase64SHA1Hash(byte[] bytes)
bytes - The input bytes.public static boolean verifyBase64SHA1Hash(char[] input,
String hash)
input - The input charshash - The expected hashpublic static String decrypt(GuardedString guardedString)
GuardedString.guardedString - the guarded string value.public static byte[] decrypt(GuardedByteArray guardedByteArray)
GuardedByteArray.guardedByteArray - the guarded byte array value.Copyright © 2019. All rights reserved.