public class PasswordPairList extends ArrayList
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.| Modifier and Type | Field and Description |
|---|---|
protected static String |
ENC |
protected static String |
ENCRYPTED_FORMAT |
protected static String |
FORMAT_KEY |
protected static String |
PLAIN_FORMAT |
protected static PasswordKey |
PWMGR |
modCount| Constructor and Description |
|---|
PasswordPairList(File passwordFile)
Creates a new PasswordPairList object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addKey(PasswordKey key,
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.
|
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,
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. |
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeequals, hashCodecontainsAll, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitcontainsAll, equals, hashCodeparallelStream, streamprotected static final String ENC
protected static final String FORMAT_KEY
protected static final String ENCRYPTED_FORMAT
protected static final String PLAIN_FORMAT
protected static final PasswordKey PWMGR
public PasswordPairList(File passwordFile) throws IOException
passwordFile - file to store passwords inIOExceptionpublic boolean checkMasterPassword(char[] p)
p - master passwordIOException - if password file cannot be readpublic void changeMasterPassword(char[] newMasterPassword,
char[] oldMasterPassword)
throws Exception
newMasterPassword - new master passwordIOException - if the password file cannot be writtenExceptionpublic 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 pairpublic void setKey(PasswordKey key, 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 passwordpublic void addKey(PasswordKey key, 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 listr - index in listpublic 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 foundkey - keypublic char[] getMasterPassword()
public void setMasterPassword(char[] masterPassword)
masterPassword - master passwordpublic void savePasswordFile()
throws Exception
IOException - if the password file cannot be writtenExceptionpublic boolean isLoaded()
public void newPasswordFile(char[] password)
throws Exception
password - Exception - if password file cannot be readpublic void loadPasswordFile()
throws IOException
IOException - if password file cannot be readpublic File getPasswordFile()
public void reset()
Copyright © 2021. All rights reserved.