org.lsc.utils
Class SecurityUtils
java.lang.Object
org.lsc.utils.SecurityUtils
public class SecurityUtils
- extends Object
Provides some methods to encrypt, decrypt or hash data.
- See Also:
SymmetricEncryption
HASH_MD5
public static final String HASH_MD5
- See Also:
- Constant Field Values
HASH_SHA1
public static final String HASH_SHA1
- See Also:
- Constant Field Values
SecurityUtils
public SecurityUtils()
decrypt
public static String decrypt(String value)
throws GeneralSecurityException,
IOException
- Decrypt a base64 value.
- Parameters:
value - The value
- Returns:
- The decrypted String
- Throws:
GeneralSecurityException
IOException
encrypt
public static String encrypt(String value)
throws GeneralSecurityException,
IOException
- Encrypt a value.
- Parameters:
value - The value
- Returns:
- The encrypted String, base64 encoded
- Throws:
GeneralSecurityException
IOException
hash
public static String hash(String type,
String value)
throws NoSuchAlgorithmException
- Hash a value within a supported hash type.
- Parameters:
type - A valid hash type: SecurityUtils.HASH_MD5 or SecurityUtils.HASH_SHA1value - A value to hash
- Returns:
- A valid base64 encoded hash
- Throws:
NoSuchAlgorithmException
Copyright © 2005-2010 LSC project. All Rights Reserved.