public class Passphrase extends Object
Constructor and Description |
---|
Passphrase(char[] chars)
Passphrase for keys etc.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Overwrite the char array with spaces and mark the
Passphrase as invalidated. |
static Passphrase |
emptyPassphrase()
Represents a
Passphrase instance that represents no password. |
protected void |
finalize()
Call
clear() to make sure the memory is overwritten. |
char[] |
getChars()
Return a copy of the underlying char array.
|
boolean |
isValid()
Return true if the passphrase has not yet been cleared.
|
public Passphrase(@Nullable char[] chars)
chars
- may be null for empty passwords.public void clear()
Passphrase
as invalidated.protected void finalize() throws Throwable
clear()
to make sure the memory is overwritten.finalize
in class Object
Throwable
- bad things might happen in Object.finalize()
.@Nullable public char[] getChars()
null
represents no password.IllegalStateException
- in case the password has been cleared at this point.public boolean isValid()
public static Passphrase emptyPassphrase()
Passphrase
instance that represents no password.