org.rhq.core.util.obfuscation
Class Obfuscator

java.lang.Object
  extended by org.rhq.core.util.obfuscation.Obfuscator

public final class Obfuscator
extends Object

This class makes available methods for obfuscating a string in the very same way as the 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.

Author:
Lukas Krejci

Method Summary
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".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

encode

public static String encode(String secret)
                     throws NoSuchPaddingException,
                            NoSuchAlgorithmException,
                            InvalidKeyException,
                            BadPaddingException,
                            IllegalBlockSizeException
Encodes the secret string so that the value is not immediately readable by a "casual viewer".

Parameters:
secret - the string to encode
Returns:
encoded string
Throws:
NoSuchPaddingException
NoSuchAlgorithmException
InvalidKeyException
BadPaddingException
IllegalBlockSizeException

decode

public static String decode(String secret)
                     throws NoSuchPaddingException,
                            NoSuchAlgorithmException,
                            InvalidKeyException,
                            BadPaddingException,
                            IllegalBlockSizeException
Decodes the string obfuscated using the 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[].

Parameters:
secret - the encoded (obfuscated) string
Returns:
the decoded string
Throws:
NoSuchPaddingException
NoSuchAlgorithmException
InvalidKeyException
BadPaddingException
IllegalBlockSizeException


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.