@NotThreadSafe public abstract class SafePbeParameters<S extends KeyStrength,P extends SafePbeParameters<S,P>> extends Object implements SafeKey<P>
Sub classes do not need to be thread-safe.
Constructor and Description |
---|
SafePbeParameters() |
Modifier and Type | Method and Description |
---|---|
P |
clone()
Returns a deep clone of this safe key.
|
S |
getKeyStrength()
Returns the cipher key strength.
|
abstract S[] |
getKeyStrengthValues()
Returns a new non-empty array of all available key strength values.
|
char[] |
getPassword()
Returns a protective copy of the stored password char array.
|
void |
reset()
Wipes any key data from the heap and resets this safe key to it's
initial state.
|
void |
setKeyFileBytes(byte[] bytes)
Decodes the given byte array to a password char array for subsequent use.
|
void |
setKeyStrength(S keyStrength)
Sets the cipher key strength.
|
void |
setPassword(char[] newPW)
Copies and stores the given password char array for deriving the cipher
key.
|
public P clone()
SafeKey
@Nullable public S getKeyStrength()
public abstract S[] getKeyStrengthValues()
@Nullable public char[] getPassword()
public void reset()
SafeKey
public void setKeyFileBytes(@CheckForNull byte[] bytes)
This method makes a protective copy of the given key file byte array. It's highly recommended to overwrite this array with any non-password data after calling this method.
bytes
- the byte array to decode.public void setKeyStrength(@CheckForNull S keyStrength)
keyStrength
- the cipher key strength.public void setPassword(@CheckForNull char[] newPW)
newPW
- the password char array for deriving the cipher key.Copyright © 2005–2018 Schlichtherle IT Services. All rights reserved.