|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList
com.sshtools.ui.swing.PasswordPairList
public class PasswordPairList
A password together with a key (PasswordKey) that makes it
unique makes up a PasswordPair. This object holds a list of
these pairs and also is responsible for saving the list to disk, possibly
encrypted if an Encrypter instance has been registered.
| Field Summary | |
|---|---|
protected static java.lang.String |
ENC
|
protected static java.lang.String |
ENCRYPTED_FORMAT
|
protected static java.lang.String |
FORMAT_KEY
|
protected static java.lang.String |
PLAIN_FORMAT
|
protected static PasswordKey |
PWMGR
|
| Fields inherited from class java.util.AbstractList |
|---|
modCount |
| Constructor Summary | |
|---|---|
PasswordPairList(java.io.File passwordFile)
Creates a new PasswordPairList object. |
|
| Method Summary | |
|---|---|
void |
addKey(PasswordKey key,
java.lang.String userPassword,
boolean persistant,
boolean encrypted)
Add a new password key with a new password. |
void |
addPair(PasswordPair pair)
Add a new password pair to the list. |
void |
changeMasterPassword(char[] newMasterPassword,
char[] oldMasterPassword)
Change the master password and rewrite the password list. |
boolean |
checkMasterPassword(char[] p)
Test if the password file can be decrypted given the master password. |
char[] |
getMasterPassword()
Get the master password |
PasswordPair |
getPair(PasswordKey key)
Get a password pair given its key. |
java.io.File |
getPasswordFile()
Return the password list file |
PasswordPair |
getPasswordPairAt(int r)
Get a PasswordPair at a given index in the list |
boolean |
isLoaded()
Get if the list is loaded. |
void |
loadPasswordFile()
Load the password list from disk. |
void |
newPasswordFile(char[] password)
New password list. |
void |
removeKey(PasswordKey key)
Remove a password pair from the list given its key. |
void |
reset()
|
void |
savePasswordFile()
Save all of the passwords to disk. |
void |
setKey(PasswordKey key,
java.lang.String userPassword,
boolean persistant,
boolean encrypted)
Set the supplied PasswordPair and update the password. |
void |
setMasterPassword(char[] masterPassword)
Set the master password. |
void |
setPair(PasswordPair pair)
Set the supplied PasswordPair. |
| Methods inherited from class java.util.ArrayList |
|---|
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize |
| Methods inherited from class java.util.AbstractList |
|---|
equals, hashCode, iterator, listIterator, listIterator, subList |
| Methods inherited from class java.util.AbstractCollection |
|---|
containsAll, removeAll, retainAll, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.List |
|---|
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList |
| Field Detail |
|---|
protected static final java.lang.String ENC
protected static final java.lang.String FORMAT_KEY
protected static final java.lang.String ENCRYPTED_FORMAT
protected static final java.lang.String PLAIN_FORMAT
protected static final PasswordKey PWMGR
| Constructor Detail |
|---|
public PasswordPairList(java.io.File passwordFile)
throws java.io.IOException
passwordFile - file to store passwords in
java.io.IOException| Method Detail |
|---|
public boolean checkMasterPassword(char[] p)
p - master password
java.io.IOException - if password file cannot be read
public void changeMasterPassword(char[] newMasterPassword,
char[] oldMasterPassword)
throws java.lang.Exception
newMasterPassword - new master password
java.io.IOException - if the password file cannot be written
java.lang.Exceptionpublic void setPair(PasswordPair pair)
PasswordPair. If the pairs key already
exists it will be overwritten, if not it will be created. The list will
not be saved.
pair - password pair
public void setKey(PasswordKey key,
java.lang.String userPassword,
boolean persistant,
boolean encrypted)
PasswordPair and update the password. If
the pairs key already exists it will be overwritten, if not it will be
created. The list will not be saved.
key - keyuserPassword - new password
public void addKey(PasswordKey key,
java.lang.String userPassword,
boolean persistant,
boolean encrypted)
PasswordPair
will be created and added to the list.
key - keyuserPassword - keypersistant - persistantencrypted - encryptedpublic void addPair(PasswordPair pair)
pair - pairpublic PasswordPair getPasswordPairAt(int r)
PasswordPair at a given index in the list
r - index in list
public void removeKey(PasswordKey key)
key - key to removepublic PasswordPair getPair(PasswordKey key)
null will be returned
if no password with the supplied key can be found
key - key
public char[] getMasterPassword()
public void setMasterPassword(char[] masterPassword)
masterPassword - master password
public void savePasswordFile()
throws java.lang.Exception
java.io.IOException - if the password file cannot be written
java.lang.Exceptionpublic boolean isLoaded()
public void newPasswordFile(char[] password)
throws java.lang.Exception
password -
java.lang.Exception - if password file cannot be read
public void loadPasswordFile()
throws java.io.IOException
java.io.IOException - if password file cannot be readpublic java.io.File getPasswordFile()
public void reset()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||