|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object info.magnolia.cms.security.SecurityUtil
public class SecurityUtil
Utility functions required in the context of Security.
Field Summary | |
---|---|
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 Summary | |
---|---|
SecurityUtil()
|
Method Summary | |
---|---|
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)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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
Constructor Detail |
---|
public SecurityUtil()
Method Detail |
---|
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 encrypt(String message, String encodedKey)
public static String getPrivateKey()
public static void updateKeys(MgnlKeyPair keys)
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)
cacheKey.toString()
-
public static String stripPasswordFromUrl(String url)
public static String stripParameterFromCacheLog(String log, String parameter)
public static String getBCrypt(String text)
public static boolean matchBCrypted(String candidate, String hash)
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 getSHA1Hex(String data)
public static String getMD5Hex(byte[] data)
public static String getMD5Hex(String data)
public static String getMD5Hex(DigestInputStream stream)
public static String getMD5Hex(DigestOutputStream stream)
public static Subject createSubjectAndPopulate(User user)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |