Package com.mku.salmonfs.drive
Class DriveConfig
- java.lang.Object
-
- com.mku.salmonfs.drive.DriveConfig
-
public class DriveConfig extends java.lang.ObjectRepresents a configuration file for a drive. The properties are encrypted in the file with a master key which is password derived.
-
-
Constructor Summary
Constructors Constructor Description DriveConfig(byte[] contents)Provide a class that hosts the properties of the drive config file
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear properties.byte[]getHashSignature()Get the hash signature that was used to sign this drive configuration.intgetIterations()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[]getMagicBytes()Get the magic bytes from the config file.byte[]getSalt()Get the salt to be used for the password key derivation.static voidwriteDriveConfig(IFile 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 Detail
-
DriveConfig
public DriveConfig(byte[] contents) throws java.io.IOExceptionProvide 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:
java.io.IOException- Thrown if there is an IO error.
-
-
Method Detail
-
writeDriveConfig
public static void writeDriveConfig(IFile configFile, byte[] magicBytes, byte version, byte[] salt, int iterations, byte[] keyIv, byte[] encryptedData, byte[] hashSignature) throws java.io.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:
java.io.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
-
-