Class SalmonDriveConfig

java.lang.Object
com.mku.salmon.SalmonDriveConfig

public class SalmonDriveConfig extends Object
Represents 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
    SalmonDriveConfig(byte[] contents)
    Provide a class that hosts the properties of the drive config file
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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[]
    Get the initial vector that was used to encrypt this drive configuration.
    byte[]
    Get the magic bytes from the config file.
    byte[]
    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

    Methods inherited from class java.lang.Object

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

    • SalmonDriveConfig

      public SalmonDriveConfig(byte[] contents) throws IOException
      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 into
      magicBytes - The magic bytes for the header
      version - The version of the file format
      salt - The salt that will be used for encryption of the combined key
      iterations - The iteration that will be used to derive the master key from a text password
      keyIv - The initial vector that was used with the master password to encrypt the combined key
      encryptedData - The encrypted combined key and drive id
      hashSignature - 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