Class WinFileSequencer

java.lang.Object
com.mku.salmon.sequence.SalmonFileSequencer
com.mku.salmon.win.sequencer.WinFileSequencer
All Implemented Interfaces:
INonceSequencer

public class WinFileSequencer extends SalmonFileSequencer
File Sequencer for Windows with tamper protection.
  • Constructor Details

    • WinFileSequencer

      public WinFileSequencer(IRealFile sequenceFile, INonceSequenceSerializer serializer, String regCheckSumKey) throws IOException
      Instantiate a windows file sequencer.
      Parameters:
      sequenceFile - The sequence file
      serializer - The serializer
      regCheckSumKey - The registry key to use for the checksum.
      Throws:
      SequenceException - Thrown if there is an error with the nonce sequence
      IOException - Thrown if there is an IO error.
  • Method Details

    • getCheckSumKey

      public String getCheckSumKey()
      Get the registry key to save the checksum.
      Returns:
      The key
    • setCheckSumKey

      public void setCheckSumKey(String key)
      Set the registry key to save the checksum.
      Parameters:
      key - The key
    • getContents

      protected String getContents()
      Gets the checksum the registry and verifies the contents.
      Overrides:
      getContents in class SalmonFileSequencer
      Returns:
      The contents
      Throws:
      SequenceException - Thrown if there is an error with the nonce sequence
    • saveContents

      protected void saveContents(String contents)
      Save contents to the file and checksum to registry. The checksum is using SHA256 but to further protected from rainbow attacks we also encrypt it with the User windows credentials using ProtectedData. from rainbow attacks
      Overrides:
      saveContents in class SalmonFileSequencer
      Parameters:
      contents - The contents
      Throws:
      SequenceException - Thrown if there is an error with the nonce sequence
    • reset

      public void reset(boolean clearChecksumOnly)
      Reset the sequences. The device will be de-authorized for all drives.
      Parameters:
      clearChecksumOnly - True to only clear the registry checksum, use only if you know what you're doing. Default value is false)