com.ibm.websphere.crypto

Class PasswordUtil

  1. java.lang.Object
  2. extended bycom.ibm.websphere.crypto.PasswordUtil

  1. public class PasswordUtil
  2. 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

Modifier and Type Field and Description
  1. static
  2. java.lang.String
DEFAULT_CRYPTO_ALGORITHM
  1. static
  2. java.lang.String
STRING_CONVERSION_CODE
  1. static
  2. java.lang.Class
thisClass

Constructor Summary

Constructor and Description
PasswordUtil()

Method Summary

Modifier and Type Method and Description
  1. static
  2. java.lang.String
decode(java.lang.String encoded_string)
This method decodes the specified encoded data.
  1. static
  2. java.lang.String
encode(java.lang.String decoded_string)
This method encodes the specified data using defaul encoding algorithm.
  1. static
  2. 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.
  1. static
  2. 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.
  1. static
  2. java.lang.String
getCryptoAlgorithmTag(java.lang.String encoded_string)
This method extracts the encoding algorithm tag embedded in the ecoded data string.
  1. static
  2. boolean
isEncrypted(java.lang.String encoded_string)
This method returns true if the input string contains an encoded algorithm tag.
  1. static
  2. 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.
  1. static
  2. 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.
  1. static
  2. java.lang.String
passwordDecode(java.lang.String encoded_string)
This method decodes the specified encoded data.
  1. static
  2. java.lang.String
passwordEncode(java.lang.String decoded_string)
This method encodes the specified data using default encoding algorithm.
  1. static
  2. 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.
  1. static
  2. 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

  1. public static final java.lang.String DEFAULT_CRYPTO_ALGORITHM

STRING_CONVERSION_CODE

  1. public static final java.lang.String STRING_CONVERSION_CODE
See Also:

thisClass

  1. public static final java.lang.Class thisClass

Constructor Detail

PasswordUtil

  1. public PasswordUtil()

Method Detail

decode

  1. public static final java.lang.String decode( java.lang.String encoded_string)
  2. throws InvalidPasswordDecodingException
  3. UnsupportedCryptoAlgorithmException

This method decodes the specified 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.

encode

  1. public static final java.lang.String encode( java.lang.String decoded_string)
  2. throws InvalidPasswordEncodingException
  3. UnsupportedCryptoAlgorithmException

This method encodes the specified data using defaul encoding algorithm.

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.

encode

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

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

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.

getCryptoAlgorithm

  1. 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.

Returns:
a java.lang.String object that contains the extracted encoding algorithm name.

getCryptoAlgorithmTag

  1. 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.

Returns:
a java.lang.String object that contains the extracted encoding algorithm tag.

isEncrypted

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

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

Returns:
boolean value.

isValidCryptoAlgorithm

  1. 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.

Returns:
boolean value.

isValidCryptoAlgorithmTag

  1. 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.

Returns:
boolean value.

passwordDecode

  1. 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.

Returns:
a java.lang.String object that contains decoded data.

passwordEncode

  1. 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.

Returns:
a java.lang.String object that contains encoded data.

passwordEncode

  1. public static final java.lang.String passwordEncode( java.lang.String decoded_string,
  2. 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.

Returns:
a java.lang.String object that contains encoded data.

removeCryptoAlgorithmTag

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

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

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