info.magnolia.cms.security
Class SecurityUtil

java.lang.Object
  extended by info.magnolia.cms.security.SecurityUtil

public class SecurityUtil
extends Object

Utility functions required in the context of Security.

Version:
$Id: SecurityUtil.java 56096 2012-03-15 14:02:20Z fgrilli $

Constructor Summary
SecurityUtil()
           
 
Method Summary
static String byteArrayToHex(byte[] raw)
           
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 getPrivateKey()
           
static String getPublicKey()
           
static byte[] hexToByteArray(String s)
           
static boolean isAnonymous()
          Checks if the currently acting user is anonymous.
static boolean isAuthenticated()
           
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
 

Constructor Detail

SecurityUtil

public SecurityUtil()
Method Detail

isAnonymous

public static boolean isAnonymous()
Checks if the currently acting user is anonymous.


isAuthenticated

public static boolean isAuthenticated()

decrypt

public static String decrypt(String pass)
                      throws SecurityException
Throws:
SecurityException

decrypt

public static String decrypt(String message,
                             String encodedKey)
                      throws SecurityException
Throws:
SecurityException

encrypt

public static String encrypt(String pass)
                      throws SecurityException
Throws:
SecurityException

encrypt

public static String encrypt(String message,
                             String encodedKey)

getPrivateKey

public static String getPrivateKey()

updateKeys

public static void updateKeys(MgnlKeyPair keys)

getPublicKey

public static String getPublicKey()

byteArrayToHex

public static String byteArrayToHex(byte[] raw)

hexToByteArray

public static byte[] hexToByteArray(String s)

generateKeyPair

public static MgnlKeyPair generateKeyPair(int keyLength)
                                   throws NoSuchAlgorithmException
Throws:
NoSuchAlgorithmException

stripPasswordFromCacheLog

public static String stripPasswordFromCacheLog(String log)
Used for removing password parameter from cache key.

Parameters:
cacheKey.toString() -
Returns:

stripPasswordFromUrl

public static String stripPasswordFromUrl(String url)

stripParameterFromCacheLog

public static String stripParameterFromCacheLog(String log,
                                                String parameter)


Copyright © 2003-2012 Magnolia International Ltd.. All Rights Reserved.