Class PasswordUtil
- java.lang.Object
-
- com.ibm.websphere.crypto.PasswordUtil
-
public class PasswordUtil extends java.lang.ObjectPasswordUtilclass 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
Fields Modifier and Type Field and Description static java.lang.StringDEFAULT_CRYPTO_ALGORITHMstatic java.lang.StringSTRING_CONVERSION_CODEstatic java.lang.ClassthisClass
-
Constructor Summary
Constructors Constructor and Description PasswordUtil()
-
Method Summary
Methods Modifier and Type Method and Description static java.lang.Stringdecode(java.lang.String encoded_string)This method decodes the specified encoded data.static java.lang.Stringencode(java.lang.String decoded_string)This method encodes the specified data using defaul encoding algorithm.static java.lang.Stringencode(java.lang.String decoded_string, java.lang.String crypto_algorithm)This method encodes the specified data using the specified encoding algorithm.static java.lang.StringgetCryptoAlgorithm(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.StringgetCryptoAlgorithmTag(java.lang.String encoded_string)This method extracts the encoding algorithm tag embedded in the ecoded data string.static booleanisEncrypted(java.lang.String encoded_string)This method returns true if the input string contains an encoded algorithm tag.static booleanisValidCryptoAlgorithm(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 booleanisValidCryptoAlgorithmTag(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.StringpasswordDecode(java.lang.String encoded_string)This method decodes the specified encoded data.static java.lang.StringpasswordEncode(java.lang.String decoded_string)This method encodes the specified data using default encoding algorithm.static java.lang.StringpasswordEncode(java.lang.String decoded_string, java.lang.String crypto_algorithm)This method encodes the specified data using the specified encoding algorithm.static java.lang.StringremoveCryptoAlgorithmTag(java.lang.String encoded_string)This method removesw the encoding algorithm tag embedded in the input String.
-
-
-
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
-
-
Method Detail
-
decode
public static final java.lang.String decode(java.lang.String encoded_string) throws InvalidPasswordDecodingException, UnsupportedCryptoAlgorithmExceptionThis method decodes the specified encoded data.
- Parameters:
encoded- string Ajava.lang.Stringobject contains encoded data- Returns:
- a
java.lang.Stringobject that contains decoded data. - Throws:
- 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.InvalidPasswordDecodingException- will be thrown if the encoding algorithm specified in the encoded data is not a supported algorithm.UnsupportedCryptoAlgorithmExceptionInvalidPasswordDecodingExceptionUnsupportedCryptoAlgorithmException
-
encode
public static final java.lang.String encode(java.lang.String decoded_string) throws InvalidPasswordEncodingException, UnsupportedCryptoAlgorithmExceptionThis method encodes the specified data using defaul encoding algorithm.
- Parameters:
string- Ajava.lang.Stringobject contains data to be encoded.- Returns:
- a
java.lang.Stringobject that contains encoded data. - Throws:
- will be thrown if the input param is null or if the input data string contains an encoding algorithm tag.InvalidPasswordEncodingException- will be thrown if the default encoding algorithm is not defined properly.UnsupportedCryptoAlgorithmExceptionInvalidPasswordEncodingExceptionUnsupportedCryptoAlgorithmException
-
encode
public static final java.lang.String encode(java.lang.String decoded_string, java.lang.String crypto_algorithm) throws InvalidPasswordEncodingException, UnsupportedCryptoAlgorithmExceptionThis method encodes the specified data using the specified encoding algorithm.
- Parameters:
string- Ajava.lang.Stringobject contains data to be encoded.- Returns:
- a
java.lang.Stringobject that contains encoded data. - Throws:
- will be thrown if the input param is null or if the input data string contains an encoding algorithm tag.InvalidPasswordEncodingException- will be thrown if the specified encoding algorithm is not supported by the implementation.UnsupportedCryptoAlgorithmExceptionInvalidPasswordEncodingExceptionUnsupportedCryptoAlgorithmException
-
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- Ajava.lang.Stringobject contains encoded data.- Returns:
- a
java.lang.Stringobject 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- Ajava.lang.Stringobject contains encoded data.- Returns:
- a
java.lang.Stringobject 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- Ajava.lang.Stringobject 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- Ajava.lang.Stringobject 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- Ajava.lang.Stringobject 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 Ajava.lang.Stringobject contains encoded data- Returns:
- a
java.lang.Stringobject 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- Ajava.lang.Stringobject contains data to be encoded.- Returns:
- a
java.lang.Stringobject 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- Ajava.lang.Stringobject contains data to be encoded.- Returns:
- a
java.lang.Stringobject 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- Ajava.lang.Stringobject contains encoded data.- Returns:
- a
java.lang.Stringobject that contains the encoded data with the encoding algorithm tag removed.
-
-