Package ise.antelope.tasks
Class PasswordHandler
java.lang.Object
ise.antelope.tasks.PasswordHandler
Simple class to encode and decode passwords. The encrypted password is a
base-64 encoded string, so it's suitable for storage in a properties file or
where ever a string might be stored. This class could be used for larger
strings than passwords, but all I need is an easy way to store passwords in a
file.
- Version:
- $Revision: 125 $
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for PasswordHandler, uses default key.PasswordHandler
(String encryptKey) Constructor for PasswordHandler -
Method Summary
-
Field Details
-
DESEDE
use Triple-DES as algorithm- See Also:
-
DEFAULT_KEY
key to use if none given- See Also:
-
-
Constructor Details
-
PasswordHandler
Constructor for PasswordHandler, uses default key.- Throws:
PasswordHandlerException
- Description of Exception
-
PasswordHandler
Constructor for PasswordHandler- Parameters:
encryptKey
- String to use for a key, must be at least 32 characters long.- Throws:
PasswordHandlerException
- Description of Exception
-
-
Method Details
-
encrypt
Encrypt a password.- Parameters:
password
- the password to encrypt- Returns:
- the encrypted password.
- Throws:
PasswordHandlerException
- Description of Exception
-
decrypt
Decrypt a password.- Parameters:
encryptedPassword
- the encrypted password, needing to be decrypted- Returns:
- the original, plain text password
- Throws:
PasswordHandlerException
- Description of Exception
-
main
for testing only- Parameters:
args
- The command line arguments
-