public class SecurityUtils extends Object
SymmetricEncryption| Modifier and Type | Field and Description |
|---|---|
static String |
HASH_MD5 |
static String |
HASH_SHA1 |
static String |
HASH_SHA256 |
static String |
HASH_SHA512 |
| Modifier and Type | Method and Description |
|---|---|
static String |
computeSambaLMPassword(String password)
Encrypt a password for samba, LMPassword version.
|
static String |
computeSambaNTPassword(String password)
Encrypt a password for samba, NTPassword version.
|
static String |
decrypt(String value)
Decrypt a base64 value.
|
static String |
encrypt(String value)
Encrypt a value.
|
static String |
hash(String type,
String value)
Hash a value within a supported hash type.
|
public static final String HASH_MD5
public static final String HASH_SHA1
public static final String HASH_SHA256
public static final String HASH_SHA512
public static String decrypt(String value) throws GeneralSecurityException, IOException
value - The valueGeneralSecurityExceptionIOExceptionpublic static String encrypt(String value) throws GeneralSecurityException, IOException
value - The valueGeneralSecurityExceptionIOExceptionpublic static String hash(String type, String value) throws NoSuchAlgorithmException
type - A valid hash type: SecurityUtils.HASH_MD5, SecurityUtils.HASH_SHA1, SecurityUtils.HASH_SHA256 or SecurityUtils.HASH_SHA512value - A value to hashNoSuchAlgorithmExceptionpublic static String computeSambaLMPassword(String password) throws UnsupportedEncodingException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException
password - the password to encryptUnsupportedEncodingExceptionNoSuchPaddingExceptionNoSuchAlgorithmExceptionInvalidKeyExceptionBadPaddingExceptionIllegalBlockSizeExceptionpublic static String computeSambaNTPassword(String password) throws UnsupportedEncodingException, NoSuchAlgorithmException, NoSuchProviderException
password - the password to encryptUnsupportedEncodingExceptionNoSuchProviderExceptionNoSuchAlgorithmExceptionCopyright © 2005-2017 LSC project. All Rights Reserved.