IBM WebSphere Application ServerTM
Release 7

com.ibm.websphere.crypto
Class PasswordUtil

java.lang.Object
  extended by com.ibm.websphere.crypto.PasswordUtil

public class PasswordUtil
extends java.lang.Object

PasswordUtil class provides utility functions to encode and decode passwords. This functionality is not new in WebSphere Applicaiton Server, but it is the first time this function becomes available as WebSphere public programming interface.

Version:
7.0
See Also:
InvalidPasswordDecodingException, InvalidPasswordEncodingException, UnsupportedCryptoAlgorithmException

Field Summary
static java.lang.String DEFAULT_CRYPTO_ALGORITHM
           
static java.lang.String STRING_CONVERSION_CODE
           
static java.lang.Class thisClass
           
 
Constructor Summary
PasswordUtil()
           
 
Method Summary
static java.lang.String decode(java.lang.String encoded_string)
          This method decodes the specified encoded data.
static java.lang.String encode(java.lang.String decoded_string)
          This method encodes the specified data using defaul encoding algorithm.
static java.lang.String encode(java.lang.String decoded_string, java.lang.String crypto_algorithm)
          This method encodes the specified data using the specified encoding algorithm.
static java.lang.String getCryptoAlgorithm(java.lang.String encoded_string)
          This method extracts name of the encoding algorithm specified in the encoding algorithm tag in the ecoded data string.
static java.lang.String getCryptoAlgorithmTag(java.lang.String encoded_string)
          This method extracts the encoding algorithm tag embedded in the ecoded data string.
static boolean isEncrypted(java.lang.String encoded_string)
          This method returns true if the input string contains an encoded algorithm tag.
static boolean isValidCryptoAlgorithm(java.lang.String crypto_algorithm)
          This method returns true if the specified encoded algorithm is a supported algorithm or if the input String is null.
static boolean isValidCryptoAlgorithmTag(java.lang.String crypto_algorithm_tag)
          This method returns true if input String represents a valid encoding algorithm tag or if the input String is null.
static java.lang.String passwordDecode(java.lang.String encoded_string)
          This method decodes the specified encoded data.
static java.lang.String passwordEncode(java.lang.String decoded_string)
          This method encodes the specified data using default encoding algorithm.
static java.lang.String passwordEncode(java.lang.String decoded_string, java.lang.String crypto_algorithm)
          This method encodes the specified data using the specified encoding algorithm.
static java.lang.String removeCryptoAlgorithmTag(java.lang.String encoded_string)
          This method removesw the encoding algorithm tag embedded in the input String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CRYPTO_ALGORITHM

public static final java.lang.String DEFAULT_CRYPTO_ALGORITHM

STRING_CONVERSION_CODE

public static final java.lang.String STRING_CONVERSION_CODE
See Also:
Constant Field Values

thisClass

public static final java.lang.Class thisClass
Constructor Detail

PasswordUtil

public PasswordUtil()
Method Detail

decode

public static final java.lang.String decode(java.lang.String encoded_string)
                                     throws InvalidPasswordDecodingException,
                                            UnsupportedCryptoAlgorithmException

This method decodes the specified encoded data.

Parameters:
encoded - string A java.lang.String object contains encoded data
Returns:
a java.lang.String object that contains decoded data.
Throws:
InvalidPasswordDecodingException - will be thrown if the input param is null, if the encoding algorithm tag is missing, or if the inputs data is not a valid encoded string.
UnsupportedCryptoAlgorithmException - will be thrown if the encoding algorithm specified in the encoded data is not a supported algorithm.
InvalidPasswordDecodingException
UnsupportedCryptoAlgorithmException

encode

public static final java.lang.String encode(java.lang.String decoded_string)
                                     throws InvalidPasswordEncodingException,
                                            UnsupportedCryptoAlgorithmException

This method encodes the specified data using defaul encoding algorithm.

Parameters:
string - A java.lang.String object contains data to be encoded.
Returns:
a java.lang.String object that contains encoded data.
Throws:
InvalidPasswordEncodingException - will be thrown if the input param is null or if the input data string contains an encoding algorithm tag.
UnsupportedCryptoAlgorithmException - will be thrown if the default encoding algorithm is not defined properly.
InvalidPasswordEncodingException
UnsupportedCryptoAlgorithmException

encode

public static final java.lang.String encode(java.lang.String decoded_string,
                                            java.lang.String crypto_algorithm)
                                     throws InvalidPasswordEncodingException,
                                            UnsupportedCryptoAlgorithmException

This method encodes the specified data using the specified encoding algorithm.

Parameters:
string - A java.lang.String object contains data to be encoded.
Returns:
a java.lang.String object that contains encoded data.
Throws:
InvalidPasswordEncodingException - will be thrown if the input param is null or if the input data string contains an encoding algorithm tag.
UnsupportedCryptoAlgorithmException - will be thrown if the specified encoding algorithm is not supported by the implementation.
InvalidPasswordEncodingException
UnsupportedCryptoAlgorithmException

getCryptoAlgorithm

public static final java.lang.String getCryptoAlgorithm(java.lang.String encoded_string)

This method extracts name of the encoding algorithm specified in the encoding algorithm tag in the ecoded data string.

Parameters:
string - A java.lang.String object contains encoded data.
Returns:
a java.lang.String object that contains the extracted encoding algorithm name.

getCryptoAlgorithmTag

public static final java.lang.String getCryptoAlgorithmTag(java.lang.String encoded_string)

This method extracts the encoding algorithm tag embedded in the ecoded data string.

Parameters:
string - A java.lang.String object contains encoded data.
Returns:
a java.lang.String object that contains the extracted encoding algorithm tag.

isEncrypted

public static final boolean isEncrypted(java.lang.String encoded_string)

This method returns true if the input string contains an encoded algorithm tag.

Parameters:
string - A java.lang.String object contains encoded data.
Returns:
boolean value.

isValidCryptoAlgorithm

public static final boolean isValidCryptoAlgorithm(java.lang.String crypto_algorithm)

This method returns true if the specified encoded algorithm is a supported algorithm or if the input String is null.

Parameters:
string - A java.lang.String object contains name of an encoding algorithm.
Returns:
boolean value.

isValidCryptoAlgorithmTag

public static final boolean isValidCryptoAlgorithmTag(java.lang.String crypto_algorithm_tag)

This method returns true if input String represents a valid encoding algorithm tag or if the input String is null.

Parameters:
string - A java.lang.String object contains an encoding algorithm tag.
Returns:
boolean value.

passwordDecode

public static final java.lang.String passwordDecode(java.lang.String encoded_string)

This method decodes the specified encoded data. This method returns the input String if it is not encoded.

Parameters:
encoded - string A java.lang.String object contains encoded data
Returns:
a java.lang.String object that contains decoded data.

passwordEncode

public static final java.lang.String passwordEncode(java.lang.String decoded_string)

This method encodes the specified data using default encoding algorithm. If the input String is already encoded, this method first decodes it and then encodes it using the default encoding algorithm.

Parameters:
string - A java.lang.String object contains data to be encoded.
Returns:
a java.lang.String object that contains encoded data.

passwordEncode

public static final java.lang.String passwordEncode(java.lang.String decoded_string,
                                                    java.lang.String crypto_algorithm)

This method encodes the specified data using the specified encoding algorithm. If the input String is already encoded, this method first decodes it and then encodes it using the specified encoding algorithm. This methodd returns a null String if the specified encoding algorithm is not a supported algorithm.

Parameters:
string - A java.lang.String object contains data to be encoded.
Returns:
a java.lang.String object that contains encoded data.

removeCryptoAlgorithmTag

public static final java.lang.String removeCryptoAlgorithmTag(java.lang.String encoded_string)

This method removesw the encoding algorithm tag embedded in the input String.

Parameters:
string - A java.lang.String object contains encoded data.
Returns:
a java.lang.String object that contains the encoded data with the encoding algorithm tag removed.

IBM WebSphere Application ServerTM
Release 7