public final class Obfuscator extends Object
org.jboss.resource.security.SecureIdentityLoginModule in JBossAS 4.2.3.
This is to ensure backwards compatibility in case we switch containers that would start obfuscating the password in a different way and also to make those methods available to other code. The original methods in the SecureIdentityLoginModule are marked private.
| Modifier and Type | Method and Description |
|---|---|
static String |
decode(String secret)
Decodes the string obfuscated using the
encode(String) method back to the
original value. |
static String |
encode(String secret)
Encodes the secret string so that the value is not immediately readable by
a "casual viewer".
|
static String |
generateString(Random random,
String validCharacters,
int length)
Adapted from http://stackoverflow.com/questions/2863852/how-to-generate-a-random-string-in-java.
|
public static final String ALGORITHM
public static String encode(String secret) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException
secret - the string to encodeNoSuchPaddingExceptionNoSuchAlgorithmExceptionInvalidKeyExceptionBadPaddingExceptionIllegalBlockSizeExceptionpublic static String decode(String secret) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException
encode(String) method back to the
original value.
This method differs from its original org.jboss.resource.security.SecureIdentityLoginModule#decode
private method in that it returns a String whereas the original method returns a char[].
secret - the encoded (obfuscated) stringNoSuchPaddingExceptionNoSuchAlgorithmExceptionInvalidKeyExceptionBadPaddingExceptionIllegalBlockSizeExceptionpublic static String generateString(Random random, String validCharacters, int length)
random - validCharacters - length - Copyright © 2008-2014 Red Hat, Inc.. All Rights Reserved.