public final class IAIKPasswordStore
extends java.lang.Object
implements java.io.Externalizable
AES
and CMAC/AES
in combination with
PBKDF2
to securely store the password data.PBKDF2
,
Rijndael
,
CMacAES
,
PasswordGenerator
,
PasswordStrengthChecker
,
Serialized FormConstructor and Description |
---|
IAIKPasswordStore()
Constructs a new instance.
|
IAIKPasswordStore(java.security.SecureRandom random)
Constructs a new instance using a specific secure PRNG.
|
Modifier and Type | Method and Description |
---|---|
java.util.Enumeration |
aliases()
Returns an enumeration of the aliases.
|
void |
clear()
Clears the password store.
|
boolean |
containsAlias(java.lang.String alias)
Returns true, if the password store contains an entry for some alias.
|
void |
deleteEntry(java.lang.String alias)
Returns the password entry for the given alias.
|
protected void |
finalize()
Destroy critical data.
|
char[] |
generatePasswordEntry(java.lang.String alias,
int length,
int usedSymbolMask)
Creates a new password entry consisting of an alias and a generated
password.
|
char[] |
getPassword(java.lang.String alias)
Returns the stored password for some alias.
|
void |
load(java.io.File file,
char[] password)
Loads a key store from a file.
|
void |
load(java.io.InputStream in,
char[] password)
Loads a key store from an input stream.
|
void |
load(java.lang.String filename,
char[] password)
Loads a key store from a file.
|
void |
readExternal(java.io.ObjectInput in)
Responsible for reading the encrypted input and restoring it.
|
void |
setPasswordEntry(java.lang.String alias,
char[] password)
Creates a new password entry consisting of an alias and the password.
|
int |
size()
Returns the size of the password store.
|
void |
store(java.io.File file,
char[] password)
Encrypts the current state of this key store and stores it to a file.
|
void |
store(java.io.OutputStream out,
char[] password)
Encrypts the current state of this key store and stores it to an output
stream.
|
void |
store(java.lang.String filename,
char[] password)
Encrypts the current state of this key store and stores it to a file.
|
void |
writeExternal(java.io.ObjectOutput out)
Responsible for creating the encrypted output of
this . |
public IAIKPasswordStore()
public IAIKPasswordStore(java.security.SecureRandom random) throws java.security.ProviderException
random
- the random generator to be used for the iv and salt generationjava.security.ProviderException
- if the IAIK provider is not installedprotected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public void load(java.lang.String filename, char[] password) throws java.io.IOException
filename
- the file namepassword
- the password to decrypt this key storejava.io.IOException
- thrown, if a file format error occurredpublic void load(java.io.File file, char[] password) throws java.io.IOException
file
- the filepassword
- the password to decrypt this key storejava.io.IOException
- thrown, if the file could not be read or if a file format error
occurredpublic void load(java.io.InputStream in, char[] password) throws java.io.IOException
in
- the input streampassword
- the password to decrypt this key storejava.io.IOException
- thrown, if the file could not be read or if a file format error
occurredpublic void store(java.lang.String filename, char[] password) throws java.io.IOException
filename
- the file namepassword
- the password to be used to encrypt the key storejava.io.IOException
- thrown, if the file could not be writtenpublic void store(java.io.File file, char[] password) throws java.io.IOException
file
- the filepassword
- the password to be used to encrypt the key storejava.io.IOException
- thrown, if the file could not be writtenpublic void store(java.io.OutputStream out, char[] password) throws java.io.IOException
out
- the output streampassword
- the password to be used to encrypt the key storejava.io.IOException
- thrown, if the file could not be writtenpublic void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
this
.writeExternal
in interface java.io.Externalizable
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException
public char[] getPassword(java.lang.String alias)
alias
- the aliaspublic void setPasswordEntry(java.lang.String alias, char[] password)
alias
- the alias for identifying this entrypassword
- the password as character arraypublic char[] generatePasswordEntry(java.lang.String alias, int length, int usedSymbolMask)
alias
- the alias for identifying this entrylength
- the password lengthusedSymbolMask
- the symbol mask for determining the character set, which is an
OR-combination of the values USE_CHARS_LOWER, USE_CHARS_UPPER,
USE_NUMBERS, USE_SPECIAL_BASIC, and USE_SPECIAL_EXTENDED from
PasswordGenerator
PasswordGenerator
public boolean containsAlias(java.lang.String alias)
alias
- the aliaspublic void deleteEntry(java.lang.String alias)
alias
- the aliaspublic int size()
public java.util.Enumeration aliases()
public void clear()