Class KeyringPassword
java.lang.Object
zeroecho.core.storage.KeyringPassword
- All Implemented Interfaces:
AutoCloseable, Destroyable
Destroyable owner of a keyring password.
The constructor and copy() use defensive copies. Callers retain
ownership of the array supplied to the constructor and must clear it. The
returned copy belongs to the receiver and must be cleared immediately after
key derivation. This object never creates an immutable password
String.
Instances are thread-safe. Destruction is idempotent and makes subsequent access fail deterministically.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
KeyringPassword
public KeyringPassword(char[] password) Creates a password owner.- Parameters:
password- password characters, which are defensively copied- Throws:
NullPointerException- ifpasswordisnullIllegalArgumentException- ifpasswordis empty
-
-
Method Details
-
copy
public char[] copy()Returns a receiver-owned password copy.- Returns:
- a new mutable array that the receiver must clear
- Throws:
IllegalStateException- if this object has been destroyed
-
destroy
Clears the owned password characters.- Specified by:
destroyin interfaceDestroyable- Throws:
DestroyFailedException- never thrown by this implementation
-
isDestroyed
public boolean isDestroyed()Reports whether the password has been destroyed.- Specified by:
isDestroyedin interfaceDestroyable- Returns:
trueafter destruction
-
close
-
toString
-