Package com.mku.salmon
Class SalmonDriveConfig
java.lang.Object
com.mku.salmon.SalmonDriveConfig
Represents a configuration file for a drive. The properties are encrypted in the file
with a master key which is password derived.
-
Constructor Summary
ConstructorDescriptionSalmonDriveConfig
(byte[] contents) Provide a class that hosts the properties of the drive config file -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear properties.byte[]
Get the hash signature that was used to sign this drive configuration.int
Get the iterations to be used for the key derivation.byte[]
getIv()
Get the initial vector that was used to encrypt this drive configuration.byte[]
Get the magic bytes from the config file.byte[]
getSalt()
Get the salt to be used for the password key derivation.static void
writeDriveConfig
(IRealFile configFile, byte[] magicBytes, byte version, byte[] salt, int iterations, byte[] keyIv, byte[] encryptedData, byte[] hashSignature) Write the properties of a drive to a config file
-
Constructor Details
-
SalmonDriveConfig
Provide a class that hosts the properties of the drive config file- Parameters:
contents
- The byte array that contains the contents of the config file- Throws:
IOException
- Thrown if there is an IO error.
-
-
Method Details
-
writeDriveConfig
public static void writeDriveConfig(IRealFile configFile, byte[] magicBytes, byte version, byte[] salt, int iterations, byte[] keyIv, byte[] encryptedData, byte[] hashSignature) throws IOException Write the properties of a drive to a config file- Parameters:
configFile
- The configuration file that will be used to write the content intomagicBytes
- The magic bytes for the headerversion
- The version of the file formatsalt
- The salt that will be used for encryption of the combined keyiterations
- The iteration that will be used to derive the master key from a text passwordkeyIv
- The initial vector that was used with the master password to encrypt the combined keyencryptedData
- The encrypted combined key and drive idhashSignature
- The hash signature of the drive id- Throws:
IOException
- Thrown if there is an IO error.
-
clear
public void clear()Clear properties. -
getMagicBytes
public byte[] getMagicBytes()Get the magic bytes from the config file.- Returns:
- The magic bytes
-
getSalt
public byte[] getSalt()Get the salt to be used for the password key derivation.- Returns:
- The salt
-
getIterations
public int getIterations()Get the iterations to be used for the key derivation.- Returns:
- The iterations
-
getIv
public byte[] getIv()Get the initial vector that was used to encrypt this drive configuration.- Returns:
- The initial vector
-
getHashSignature
public byte[] getHashSignature()Get the hash signature that was used to sign this drive configuration.- Returns:
- The hash signature
-