public static interface Password.Clear extends AutoCloseable
try (Password.Clear clear = password.getClearCopy()) {
char[] clearPwd = clear.get();
// use clearPwd in the block
}
// at this point clearPwd has been cleaned
// 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.
Once closed, a Password.Clear can't be reused.| Modifier and Type | Method and Description |
|---|---|
void |
close()
Unset the clear password after usage.
|
char[] |
get()
Get a clear copy of the password ; the password remains obfuscated
until this method is invoked.
|
char[] get()
IllegalStateException - If this password has been invalidated.void close()
close in interface AutoCloseableCopyright © 2018 Alternet. All rights reserved.