Class SalmonDriveGenerator

java.lang.Object
com.mku.salmon.SalmonDriveGenerator

public class SalmonDriveGenerator extends Object
Utility class generates internal secure properties for the drive.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Auth ID size
    static final int
    combined key is drive key + hash key.
    static final int
    Drive ID size.
    static final int
    Length for the iterations that will be stored in the encrypted data header.
    static final int
    Initial vector length that will be used for encryption and master encryption of the combined key
    static final int
    Master key to encrypt the combined key we also use AES256.
    static final int
    Salt length.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static byte[]
    Generate a secure random authorization ID.
    static byte[]
    Generates a secure random combined key (drive key + hash key)
    static byte[]
    Generate a Drive ID.
    static byte[]
    Generates the initial vector that will be used with the master key to encrypt the combined key (drive key + hash key)
    static byte[]
    Generates a salt.
    static int
    Returns the iterations used for deriving the combined key from the text password
    static byte[]
    Get the default max nonce to be used for drives.
    static byte[]
    Get the starting nonce that will be used for encrypt drive files and filenames.
    static void
    setIterations(int iterations)
    Set the default iterations.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • IV_LENGTH

      public static final int IV_LENGTH
      Initial vector length that will be used for encryption and master encryption of the combined key
      See Also:
    • COMBINED_KEY_LENGTH

      public static final int COMBINED_KEY_LENGTH
      combined key is drive key + hash key.
      See Also:
    • SALT_LENGTH

      public static final int SALT_LENGTH
      Salt length.
      See Also:
    • DRIVE_ID_LENGTH

      public static final int DRIVE_ID_LENGTH
      Drive ID size.
      See Also:
    • AUTH_ID_SIZE

      public static final int AUTH_ID_SIZE
      Auth ID size
      See Also:
    • ITERATIONS_LENGTH

      public static final int ITERATIONS_LENGTH
      Length for the iterations that will be stored in the encrypted data header.
      See Also:
    • MASTER_KEY_LENGTH

      public static final int MASTER_KEY_LENGTH
      Master key to encrypt the combined key we also use AES256.
      See Also:
  • Constructor Details

    • SalmonDriveGenerator

      public SalmonDriveGenerator()
  • Method Details

    • generateDriveId

      public static byte[] generateDriveId()
      Generate a Drive ID.
      Returns:
      The Drive ID.
    • generateAuthId

      public static byte[] generateAuthId()
      Generate a secure random authorization ID.
      Returns:
      The authorization Id (16 bytes).
    • generateCombinedKey

      public static byte[] generateCombinedKey()
      Generates a secure random combined key (drive key + hash key)
      Returns:
      The length of the combined key.
    • generateMasterKeyIV

      public static byte[] generateMasterKeyIV()
      Generates the initial vector that will be used with the master key to encrypt the combined key (drive key + hash key)
      Returns:
      The master key initial vector
    • generateSalt

      public static byte[] generateSalt()
      Generates a salt.
      Returns:
      The salt byte array.
    • getStartingNonce

      public static byte[] getStartingNonce()
      Get the starting nonce that will be used for encrypt drive files and filenames.
      Returns:
      A secure random byte array (8 bytes).
    • getMaxNonce

      public static byte[] getMaxNonce()
      Get the default max nonce to be used for drives.
      Returns:
      A secure random byte array (8 bytes).
    • getIterations

      public static int getIterations()
      Returns the iterations used for deriving the combined key from the text password
      Returns:
      The current iterations for the key derivation.
    • setIterations

      public static void setIterations(int iterations)
      Set the default iterations.
      Parameters:
      iterations - The iterations