public class SecurityUtil extends Object
Modifier and Type | Field and Description |
---|---|
static String |
MD5 |
static String |
SHA1 |
static String |
SHA256
There are five (5) FIPS-approved* algorithms for generating a condensed representation of a message (message
digest): SHA-1, SHA-224, SHA-256,SHA-384, and SHA-512.
|
static String |
SHA384 |
static String |
SHA512 |
Constructor and Description |
---|
SecurityUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
byteArrayToHex(byte[] raw) |
static Subject |
createSubjectAndPopulate(User user) |
static String |
decrypt(String pass) |
static String |
decrypt(String message,
String encodedKey) |
static String |
encrypt(String pass) |
static String |
encrypt(String message,
String encodedKey) |
static MgnlKeyPair |
generateKeyPair(int keyLength) |
static String |
getBCrypt(String text) |
static byte[] |
getDigest(byte[] data,
String algorithm)
Message Digesting function.
|
static String |
getDigest(String data,
String algorithm)
Message Digesting function.
|
static DigestInputStream |
getDigestInputStream(InputStream stream) |
static DigestOutputStream |
getDigestOutputStream(OutputStream stream) |
static String |
getMD5Hex(byte[] data)
Gets MD5 encoded -> hex string.
|
static String |
getMD5Hex(DigestInputStream stream) |
static String |
getMD5Hex(DigestOutputStream stream) |
static String |
getMD5Hex(String data) |
static String |
getPrivateKey() |
static String |
getPublicKey() |
static String |
getSHA1Hex(byte[] data)
Gets SHA-1 encoded -> hex string.
|
static String |
getSHA1Hex(String data) |
static byte[] |
hexToByteArray(String s) |
static boolean |
isAnonymous()
Checks if the currently acting user is anonymous.
|
static boolean |
isAuthenticated() |
static boolean |
matchBCrypted(String candidate,
String hash) |
static String |
stripParameterFromCacheLog(String log,
String parameter) |
static String |
stripPasswordFromCacheLog(String log)
Used for removing password parameter from cache key.
|
static String |
stripPasswordFromUrl(String url) |
static void |
updateKeys(MgnlKeyPair keys) |
public static final String SHA1
public static final String MD5
public static final String SHA256
public static final String SHA384
public static final String SHA512
public static boolean isAnonymous()
public static boolean isAuthenticated()
public static String decrypt(String pass) throws SecurityException
SecurityException
public static String decrypt(String message, String encodedKey) throws SecurityException
SecurityException
public static String encrypt(String pass) throws SecurityException
SecurityException
public static String getPrivateKey()
public static void updateKeys(MgnlKeyPair keys) throws IllegalArgumentException
IllegalArgumentException
public static String getPublicKey()
public static String byteArrayToHex(byte[] raw)
public static byte[] hexToByteArray(String s)
public static MgnlKeyPair generateKeyPair(int keyLength) throws NoSuchAlgorithmException
NoSuchAlgorithmException
public static String stripPasswordFromCacheLog(String log)
public static String stripParameterFromCacheLog(String log, String parameter)
public static String getDigest(String data, String algorithm) throws NoSuchAlgorithmException
NoSuchAlgorithmException
public static byte[] getDigest(byte[] data, String algorithm) throws NoSuchAlgorithmException
NoSuchAlgorithmException
public static DigestInputStream getDigestInputStream(InputStream stream)
public static DigestOutputStream getDigestOutputStream(OutputStream stream)
public static String getSHA1Hex(byte[] data)
public static String getMD5Hex(byte[] data)
public static String getMD5Hex(DigestInputStream stream)
public static String getMD5Hex(DigestOutputStream stream)
Copyright © 2003–2020 Magnolia International Ltd.. All rights reserved.