Class SecretKeySafe
java.lang.Object
de.wuespace.telestion.extension.mavlink.security.SecretKeySafe
A
It's key must be deleted manually after using with
Each
SecretKeySafe
for the MAVLink-Signature-Keys. To ensure security the key will be stored in a final byte
array which can be overwritten. It can only be accessed by getSecretKey()
.It's key must be deleted manually after using with
deleteKey()
!Each
SecretKeySafe
has a unique ID to identify it in the logs.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears the password from memory and runs theGarbage-Collector
.
This ensures security for passwords when deleting passwords.
Will only work if the secretKey is not alreadynull
.long
getId()
Returns the id of thisSecretKeySafe
.byte[]
Returns the secretKey saved in thisSecretKeySafe
.
Will return null afterdeleteKey()
has been called.boolean
Returns ifdeleteKey()
has already been called on this object and secretKey has already been deleted.
-
Constructor Details
-
SecretKeySafe
public SecretKeySafe(byte[] secretKey)Creates a newSecretKeySafe
with a newsecretKey
.
Keys are final and cannot be changed. This however means after callingdeleteKey()
thisSecretKeySafe
is no longer usable which is a security feature.- Parameters:
secretKey
- the secret key
-
-
Method Details
-
getSecretKey
public byte[] getSecretKey()Returns the secretKey saved in thisSecretKeySafe
.
Will return null afterdeleteKey()
has been called.- Returns:
- the stored secret key
-
getId
public long getId()Returns the id of thisSecretKeySafe
.- Returns:
id
-
isDeleted
public boolean isDeleted()Returns ifdeleteKey()
has already been called on this object and secretKey has already been deleted.- Returns:
- if secretKey has already been deleted
-
deleteKey
public void deleteKey()Clears the password from memory and runs theGarbage-Collector
.
This ensures security for passwords when deleting passwords.
Will only work if the secretKey is not alreadynull
.
-