Package com.mku.salmon
Class SalmonDriveGenerator
java.lang.Object
com.mku.salmon.SalmonDriveGenerator
Utility class generates internal secure properties for the drive.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Auth ID sizestatic 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 keystatic final int
Master key to encrypt the combined key we also use AES256.static final int
Salt length. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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 passwordstatic 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.
-
Field Details
-
IV_LENGTH
public static final int IV_LENGTHInitial 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_LENGTHcombined key is drive key + hash key.- See Also:
-
SALT_LENGTH
public static final int SALT_LENGTHSalt length.- See Also:
-
DRIVE_ID_LENGTH
public static final int DRIVE_ID_LENGTHDrive ID size.- See Also:
-
AUTH_ID_SIZE
public static final int AUTH_ID_SIZEAuth ID size- See Also:
-
ITERATIONS_LENGTH
public static final int ITERATIONS_LENGTHLength for the iterations that will be stored in the encrypted data header.- See Also:
-
MASTER_KEY_LENGTH
public static final int MASTER_KEY_LENGTHMaster 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
-