Class DriveGenerator


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

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

      Constructors 
      Constructor Description
      DriveGenerator()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static byte[] generateAuthId()
      Generate a secure random authorization ID.
      static byte[] generateCombinedKey()
      Generates a secure random combined key (drive key + hash key)
      static byte[] generateDriveId()
      Generate a Drive ID.
      static byte[] generateMasterKeyIV()
      Generates the initial vector that will be used with the master key to encrypt the combined key (drive key + hash key)
      static byte[] generateSalt()
      Generates a salt.
      static int getIterations()
      Returns the iterations used for deriving the combined key from the text password
      static byte[] getMaxNonce()
      Get the default max nonce to be used for drives.
      static byte[] getStartingNonce()
      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 Detail

      • 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:
        Constant Field Values
      • COMBINED_KEY_LENGTH

        public static final int COMBINED_KEY_LENGTH
        combined key is drive key + hash key.
        See Also:
        Constant Field Values
      • DRIVE_ID_LENGTH

        public static final int DRIVE_ID_LENGTH
        Drive ID size.
        See Also:
        Constant Field Values
      • ITERATIONS_LENGTH

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

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

      • DriveGenerator

        public DriveGenerator()
    • Method Detail

      • 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