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
Password related utilities.

Field Summary

Modifier and Type Field and Description
  1. static
  2. java.lang.String
PROPERTY_CRYPTO_KEY
  1. static
  2. java.lang.String
PROPERTY_HASH_ALGORITHM
  1. static
  2. java.lang.String
PROPERTY_HASH_ENCODED
  1. static
  2. java.lang.String
PROPERTY_HASH_ITERATION
  1. static
  2. java.lang.String
PROPERTY_HASH_LENGTH
  1. static
  2. java.lang.String
PROPERTY_HASH_SALT

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)
Decode the provided password.
  1. static
  2. java.lang.String
encode(java.lang.String decoded_string)
Encode the provided password.
  1. static
  2. java.lang.String
encode(java.lang.String decoded_string,java.lang.String crypto_algorithm)
Encode the provided password with the input algorithm.
  1. static
  2. java.lang.String
encode(java.lang.String decoded_string,java.lang.String crypto_algorithm,java.util.Map<java.lang.String,java.lang.String> properties)
  1. static
  2. java.lang.String
encode(java.lang.String decoded_string,java.lang.String crypto_algorithm,java.lang.String crypto_key)
Encode the provided password with the input algorithm.
  1. static
  2. java.lang.String
getCryptoAlgorithm(java.lang.String password)
Determine the crypto algorithm inside the provided password, ie {xor}blah returns "xor".
  1. static
  2. java.lang.String
getCryptoAlgorithmTag(java.lang.String password)
Get any algorithm tag found in the input data.
  1. static
  2. java.lang.String
getDefaultEncoding()
  1. static
  2. boolean
isEncrypted(java.lang.String encoded_string)
Check whether the password has a valid crypto algorithm applied.
  1. static
  2. boolean
isHashed(java.lang.String encodedString)
Determine if the provided algorithm tag is a valid supported one or not.
  1. static
  2. boolean
isValidCryptoAlgorithm(java.lang.String crypto_algorithm)
Determine if the provided algorithm string is a valid one.
  1. static
  2. boolean
isValidCryptoAlgorithmTag(java.lang.String tag)
Determine if the provided algorithm tag is a valid supported one or not.
  1. static
  2. java.lang.String
passwordDecode(java.lang.String encoded_string)
Decode the provided password string.
  1. static
  2. java.lang.String
passwordEncode(java.lang.String decoded_string)
Encode the provided password with the default algorithm.
  1. static
  2. java.lang.String
passwordEncode(java.lang.String decoded_string,java.lang.String crypto_algorithm)
Encode the provided password with the input algorithm.
  1. static
  2. java.lang.String
removeCryptoAlgorithmTag(java.lang.String password)
Remove the algorithm tag from the input encoded password.
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

PROPERTY_CRYPTO_KEY

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

PROPERTY_HASH_ALGORITHM

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

PROPERTY_HASH_ITERATION

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

PROPERTY_HASH_SALT

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

PROPERTY_HASH_ENCODED

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

PROPERTY_HASH_LENGTH

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

Constructor Detail

PasswordUtil

  1. public PasswordUtil()

Method Detail

getDefaultEncoding

  1. public static final java.lang.String getDefaultEncoding( )

decode

  1. public static java.lang.String decode( java.lang.String encoded_string)
  2. throws InvalidPasswordDecodingException
  3. com.ibm.ws.crypto.util.UnsupportedCryptoAlgorithmException
Decode the provided password. An empty algorithm "{}" is treated as a no-op; however, a missing algorithm will trigger the InvalidPasswordDecodingException.
Parameters:
encoded_string -
Returns:
String
Throws:
com.ibm.ws.crypto.util.UnsupportedCryptoAlgorithmException

encode

  1. public static java.lang.String encode( java.lang.String decoded_string)
  2. throws InvalidPasswordEncodingException
  3. com.ibm.ws.crypto.util.UnsupportedCryptoAlgorithmException
Encode the provided password.
Parameters:
decoded_string -
Returns:
String
Throws:
com.ibm.ws.crypto.util.UnsupportedCryptoAlgorithmException

encode

  1. public static java.lang.String encode( java.lang.String decoded_string,
  2. java.lang.String crypto_algorithm)
  3. throws InvalidPasswordEncodingException
  4. com.ibm.ws.crypto.util.UnsupportedCryptoAlgorithmException
Encode the provided password with the input algorithm.
Parameters:
decoded_string -
crypto_algorithm -
Returns:
Throws:
com.ibm.ws.crypto.util.UnsupportedCryptoAlgorithmException

encode

  1. public static java.lang.String encode( java.lang.String decoded_string,
  2. java.lang.String crypto_algorithm,
  3. java.lang.String crypto_key)
  4. throws InvalidPasswordEncodingException
  5. com.ibm.ws.crypto.util.UnsupportedCryptoAlgorithmException
Encode the provided password with the input algorithm.
Parameters:
decoded_string -
crypto_algorithm -
crypto_key -
Returns:
Throws:
com.ibm.ws.crypto.util.UnsupportedCryptoAlgorithmException

encode

  1. public static java.lang.String encode( java.lang.String decoded_string,
  2. java.lang.String crypto_algorithm,
  3. java.util.Map<java.lang.String,java.lang.String> properties)
  4. throws InvalidPasswordEncodingException
  5. com.ibm.ws.crypto.util.UnsupportedCryptoAlgorithmException
Throws:
com.ibm.ws.crypto.util.UnsupportedCryptoAlgorithmException

getCryptoAlgorithm

  1. public static java.lang.String getCryptoAlgorithm( java.lang.String password)
Determine the crypto algorithm inside the provided password, ie {xor}blah returns "xor".
Parameters:
password -
Returns:
String - null if not present

getCryptoAlgorithmTag

  1. public static java.lang.String getCryptoAlgorithmTag( java.lang.String password)
Get any algorithm tag found in the input data. "{xor}blah" returns "{xor}". This returns null if no algorithm is found.
Parameters:
password -
Returns:
String

isEncrypted

  1. public static boolean isEncrypted( java.lang.String encoded_string)
Check whether the password has a valid crypto algorithm applied. "{xor}blah" would return true while "blah" would not.
Parameters:
encoded_string -
Returns:
boolean

isValidCryptoAlgorithm

  1. public static boolean isValidCryptoAlgorithm( java.lang.String crypto_algorithm)
Determine if the provided algorithm string is a valid one.
Parameters:
crypto_algorithm -
Returns:
boolean

isValidCryptoAlgorithmTag

  1. public static boolean isValidCryptoAlgorithmTag( java.lang.String tag)
Determine if the provided algorithm tag is a valid supported one or not.
Parameters:
tag -
Returns:
boolean

isHashed

  1. public static boolean isHashed( java.lang.String encodedString)
Determine if the provided algorithm tag is a valid supported one or not.
Returns:
boolean

passwordDecode

  1. public static java.lang.String passwordDecode( java.lang.String encoded_string)
Decode the provided password string.
Parameters:
encoded_string -
Returns:
String

passwordEncode

  1. public static java.lang.String passwordEncode( java.lang.String decoded_string)
Encode the provided password with the default algorithm.
Parameters:
decoded_string -
Returns:
String

passwordEncode

  1. public static java.lang.String passwordEncode( java.lang.String decoded_string,
  2. java.lang.String crypto_algorithm)
Encode the provided password with the input algorithm. If another algorithm is already applied, it will be removed and replaced with the new one.
Parameters:
decoded_string -
crypto_algorithm -
Returns:
String

removeCryptoAlgorithmTag

  1. public static java.lang.String removeCryptoAlgorithmTag( java.lang.String password)
Remove the algorithm tag from the input encoded password.
Parameters:
password -
Returns:
String