|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectise.antelope.tasks.PasswordHandler
public class 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.
| Field Summary | |
|---|---|
static java.lang.String |
DEFAULT_KEY
key to use if none given |
static java.lang.String |
DESEDE
use Triple-DES as algorithm |
| Constructor Summary | |
|---|---|
PasswordHandler()
Constructor for PasswordHandler, uses default key. |
|
PasswordHandler(java.lang.String encryptKey)
Constructor for PasswordHandler |
|
| Method Summary | |
|---|---|
java.lang.String |
decrypt(java.lang.String encryptedPassword)
Decrypt a password. |
java.lang.String |
encrypt(java.lang.String password)
Encrypt a password. |
static void |
main(java.lang.String[] args)
for testing only |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String DESEDE
public static final java.lang.String DEFAULT_KEY
| Constructor Detail |
|---|
public PasswordHandler()
throws PasswordHandlerException
PasswordHandlerException - Description of Exception
public PasswordHandler(java.lang.String encryptKey)
throws PasswordHandlerException
encryptKey - String to use for a key, must be at
least 32 characters long.
PasswordHandlerException - Description of Exception| Method Detail |
|---|
public java.lang.String encrypt(java.lang.String password)
throws PasswordHandlerException
password - the password to encrypt
PasswordHandlerException - Description of Exception
public java.lang.String decrypt(java.lang.String encryptedPassword)
throws PasswordHandlerException
encryptedPassword - the encrypted password, needing to
be decrypted
PasswordHandlerException - Description of Exceptionpublic static void main(java.lang.String[] args)
args - The command line arguments
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||