See: Description
| Interface | Description |
|---|---|
| Password |
A safe password, stored obfuscate.
|
| Password.Clear |
This class helps keeping low the period where a password appear in clear
in the memory, in order to make it difficult to find when a memory dump
is performed.
|
| PasswordManager |
A concrete implementation should supply obfuscate Passwords according to the
level of security expected.
|
| Class | Description |
|---|---|
| EmptyPassword |
The empty password (use it as a placeholder for
a password when no password is supplied.
|
| PasswordManagerFactory |
A factory that can supply different flavors of PasswordManager.
|
| Enum | Description |
|---|---|
| PasswordState |
Indicates whether a password is empty, valid, or invalid.
|
| Annotation Type | Description |
|---|---|
| SensitiveData |
Mark a data as sensitive data, that is to say
should be destroyed after use and not remain too much
time in memory.
|
PasswordManager, that
exist in several flavors. To pick one, use the PasswordManagerFactory
or supply your own implementation (your own implementation can
override the default one with the discovery service).
// pick one of the available password manager // (replace XXX with the one you prefer) PasswordManager manager = PasswordManagerFactory.getXXXPasswordManager(); Password pwd = manager.newPassword(pwdChars); // from this point, // pwd is safe for staying in memory as long as necessary, // pwdChars has been unset after the creation of the password.
try (Password.Clear clear = pwd.getClearCopy()) {
char[] clearPwd = clear.get();
// use clearPwd in the block
}
// at this point clearPwd has been unset
// before being eligible by the garbage collector
The user has to ensure to keep the try-with-resource
block as short as possible, and to not make copies of
the char array if possible.
Copyright © 2018 Alternet. All rights reserved.