Package com.webmethods.caf.common
Class OldCipherUtil
java.lang.Object
com.webmethods.caf.common.OldCipherUtil
Provides simple encrypt/decrypt functionality for the portal. Used to encrypt
database passwords
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
Decrypts simple valuestatic String
Encrypts simple string valuestatic String
Calculates SHA1 algorithm hash valuestatic String
Calculates SHA1 algorithm hash valuestatic boolean
hashEquals
(String hash, String value) Checks if specified value hash is the same as passed in hash.static boolean
isEncrypted
(String value) Returns true if passed value is encryptedstatic boolean
Returns true if the passed hash value does represent a valid SHA hash valuestatic boolean
isOldCipher
(String value) Is the encryption from the previous version of MWS.static boolean
Is the hash from the previous version of MWS.static void
main method used to encrypt an input at runtime.
-
Constructor Details
-
OldCipherUtil
public OldCipherUtil()
-
-
Method Details
-
hash
Calculates SHA1 algorithm hash value- Parameters:
value
- input to be encrypted- Returns:
- hashed value of input
- Throws:
UnsupportedEncodingException
- error if the character encoding is not supported.
-
hash
Calculates SHA1 algorithm hash value- Parameters:
value
- input to be encryptedforceHash
- encrypts value if true- Throws:
UnsupportedEncodingException
-
hashEquals
Checks if specified value hash is the same as passed in hash. If passed in hash is a plain text String, then it simply compares value and hash.- Parameters:
hash
- input being compared to valuevalue
- input checked if it exists in hash- Throws:
UnsupportedEncodingException
-
isHash
Returns true if the passed hash value does represent a valid SHA hash value- Parameters:
hash
- input being being checked if it is a valid SHA hash value
-
encrypt
Encrypts simple string value- Parameters:
value
- input to be encypted- Returns:
- encrypted value of input
- Throws:
Exception
-
isEncrypted
Returns true if passed value is encrypted- Parameters:
value
- String to be checked if it is currently encrypted- Returns:
- true if value is encrypted
-
decrypt
Decrypts simple value- Parameters:
value
- decrypts if value is valid SHA hash- Returns:
- uncrypted value of input
- Throws:
Exception
-
main
main method used to encrypt an input at runtime.- Parameters:
argv
- value to encrypt- Throws:
Exception
-
isOldCipher
Is the encryption from the previous version of MWS.- Parameters:
value
- encryped value.- Returns:
- boolean true if previous version, otherwise false.
-
isOldHash
Is the hash from the previous version of MWS.- Parameters:
hash
- hash value.- Returns:
- boolean true if previous version, otherwise false.
-