K - the type of this safe key.public abstract class AbstractSecretKey<K extends AbstractSecretKey<K>> extends AbstractKey<K> implements SecretKey<K>
Subclasses need to be serializable with Object(Out|In)putStream and
XML(En|De)coder.
Subclasses do not need to be safe for multi-threading.
| Constructor and Description |
|---|
AbstractSecretKey() |
| Modifier and Type | Method and Description |
|---|---|
K |
clone()
Returns a deep clone of this safe key.
|
boolean |
equals(Object obj)
Returns
true if and only if this safe key deeply equals the
given object. |
protected void |
finalize() |
ByteBuffer |
getSecret()
Returns a protective copy of the secret data.
|
int |
hashCode()
Returns a hash code which is consistent with
Key.equals(Object). |
boolean |
isSecretSet()
Returns
true if and only if the secret data is not null. |
void |
reset()
Wipes the secret data from memory and resets all properties to their
initial state.
|
void |
setSecret(ByteBuffer secret)
Clears the current secret data and sets it to a protective copy of the
given secret data.
|
String |
toString()
Returns a string representation of this object for logging and debugging
purposes.
|
public K clone()
Keyclone in interface Key<K extends AbstractSecretKey<K>>clone in class AbstractKey<K extends AbstractSecretKey<K>>public boolean equals(@Nullable Object obj)
Keytrue if and only if this safe key deeply equals the
given object.
A safe key equals another object if and only if the other object
has the same runtime class and all its properties compare deeply equal.equals in interface Key<K extends AbstractSecretKey<K>>equals in class AbstractKey<K extends AbstractSecretKey<K>>protected void finalize()
throws Throwable
@Nullable public final ByteBuffer getSecret()
SecretKeygetSecret in interface SecretKey<K extends AbstractSecretKey<K>>public int hashCode()
KeyKey.equals(Object).
This method is provided for completeness only - you should actually
never use secret keys as hash map keys because of their mutable
properties!hashCode in interface Key<K extends AbstractSecretKey<K>>hashCode in class AbstractKey<K extends AbstractSecretKey<K>>public final boolean isSecretSet()
true if and only if the secret data is not null.public void reset()
Keyreset in interface Key<K extends AbstractSecretKey<K>>public final void setSecret(@Nullable ByteBuffer secret)
SecretKeysetSecret in interface SecretKey<K extends AbstractSecretKey<K>>secret - the secret data to copy and set.Copyright © 2012–2015 Schlichtherle IT Services. All rights reserved.