public final class SecretKeySafe extends Object
A 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 Details

    • SecretKeySafe

      public SecretKeySafe(byte[] secretKey)
      Creates a new SecretKeySafe with a new secretKey.

      Keys are final and cannot be changed. This however means after calling deleteKey() this SecretKeySafe is no longer usable which is a security feature.
      secretKey - the secret key
  • Method Details

    • getSecretKey

      public byte[] getSecretKey()
      Returns the secretKey saved in this SecretKeySafe.

      Will return null after deleteKey() has been called.
      the stored secret key
    • getId

      public long getId()
      Returns the id of this SecretKeySafe.
    • isDeleted

      public boolean isDeleted()
      Returns if deleteKey() has already been called on this object and secretKey has already been deleted.
      if secretKey has already been deleted
    • deleteKey

      public void deleteKey()
      Clears the password from memory and runs the Garbage-Collector.
      This ensures security for passwords when deleting passwords.

      Will only work if the secretKey is not already null.