com.ibm.websphere.crypto
Class PasswordUtil
- java.lang.Object
com.ibm.websphere.crypto.PasswordUtil
- public class PasswordUtil
- extends java.lang.Object
Field Summary
Modifier and Type | Field and Description |
---|---|
|
PROPERTY_CRYPTO_KEY
|
|
PROPERTY_HASH_ALGORITHM
|
|
PROPERTY_HASH_ENCODED
|
|
PROPERTY_HASH_ITERATION
|
|
PROPERTY_HASH_LENGTH
|
|
PROPERTY_HASH_SALT
|
Constructor Summary
Constructor and Description |
---|
PasswordUtil()
|
Method Summary
Modifier and Type | Method and Description |
---|---|
|
decode(java.lang.String encoded_string)
Decode the provided password.
|
|
encode(java.lang.String decoded_string)
Encode the provided password.
|
|
encode(java.lang.String decoded_string,java.lang.String crypto_algorithm)
Encode the provided password with the input algorithm.
|
|
encode(java.lang.String decoded_string,java.lang.String crypto_algorithm,java.util.Map<java.lang.String,java.lang.String> properties)
|
|
encode(java.lang.String decoded_string,java.lang.String crypto_algorithm,java.lang.String crypto_key)
Encode the provided password with the input algorithm.
|
|
getCryptoAlgorithm(java.lang.String password)
Determine the crypto algorithm inside the provided password, ie {xor}blah
returns "xor".
|
|
getCryptoAlgorithmTag(java.lang.String password)
Get any algorithm tag found in the input data.
|
|
getDefaultEncoding()
|
|
isEncrypted(java.lang.String encoded_string)
Check whether the password has a valid crypto algorithm applied.
|
|
isHashed(java.lang.String encodedString)
Determine if the provided algorithm tag is a valid supported one or not.
|
|
isValidCryptoAlgorithm(java.lang.String crypto_algorithm)
Determine if the provided algorithm string is a valid one.
|
|
isValidCryptoAlgorithmTag(java.lang.String tag)
Determine if the provided algorithm tag is a valid supported one or not.
|
|
passwordDecode(java.lang.String encoded_string)
Decode the provided password string.
|
|
passwordEncode(java.lang.String decoded_string)
Encode the provided password with the default algorithm.
|
|
passwordEncode(java.lang.String decoded_string,java.lang.String crypto_algorithm)
Encode the provided password with the input algorithm.
|
|
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
- public static final java.lang.String PROPERTY_CRYPTO_KEY
See Also:
PROPERTY_HASH_ALGORITHM
- public static final java.lang.String PROPERTY_HASH_ALGORITHM
See Also:
PROPERTY_HASH_ITERATION
- public static final java.lang.String PROPERTY_HASH_ITERATION
See Also:
PROPERTY_HASH_SALT
- public static final java.lang.String PROPERTY_HASH_SALT
See Also:
PROPERTY_HASH_ENCODED
- public static final java.lang.String PROPERTY_HASH_ENCODED
See Also:
PROPERTY_HASH_LENGTH
- public static final java.lang.String PROPERTY_HASH_LENGTH
See Also:
Constructor Detail
PasswordUtil
- public PasswordUtil()
Method Detail
getDefaultEncoding
- public static final java.lang.String getDefaultEncoding( )
decode
- public static java.lang.String decode( java.lang.String encoded_string)
- throws InvalidPasswordDecodingException
- 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
- public static java.lang.String encode( java.lang.String decoded_string)
- throws InvalidPasswordEncodingException
- com.ibm.ws.crypto.util.UnsupportedCryptoAlgorithmException
Encode the provided password.
Parameters:
decoded_string
- Returns:
String
Throws:
com.ibm.ws.crypto.util.UnsupportedCryptoAlgorithmException
encode
- public static java.lang.String encode( java.lang.String decoded_string,
- java.lang.String crypto_algorithm)
- throws InvalidPasswordEncodingException
- 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
- public static java.lang.String encode( java.lang.String decoded_string,
- java.lang.String crypto_algorithm,
- java.lang.String crypto_key)
- throws InvalidPasswordEncodingException
- 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
- public static java.lang.String encode( java.lang.String decoded_string,
- java.lang.String crypto_algorithm,
- java.util.Map<java.lang.String,java.lang.String> properties)
- throws InvalidPasswordEncodingException
- com.ibm.ws.crypto.util.UnsupportedCryptoAlgorithmException
getCryptoAlgorithm
- 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
- 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
- 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
- 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
- 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
- public static boolean isHashed( java.lang.String encodedString)
Determine if the provided algorithm tag is a valid supported one or not.
Returns:
boolean
passwordDecode
- public static java.lang.String passwordDecode( java.lang.String encoded_string)
Decode the provided password string.
Parameters:
encoded_string
- Returns:
String
passwordEncode
- 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
- public static java.lang.String passwordEncode( java.lang.String decoded_string,
- 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
- public static java.lang.String removeCryptoAlgorithmTag( java.lang.String password)
Remove the algorithm tag from the input encoded password.
Parameters:
password
- Returns:
String