Class WinFileSequencer

  • All Implemented Interfaces:
    INonceSequencer

    public class WinFileSequencer
    extends FileSequencer
    File Sequencer for Windows with tamper protection.
    • Constructor Detail

      • WinFileSequencer

        public WinFileSequencer​(IFile sequenceFile,
                                INonceSequenceSerializer serializer,
                                java.lang.String regCheckSumKey)
                         throws java.io.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
        java.io.IOException - Thrown if there is an IO error.
    • Method Detail

      • getCheckSumKey

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

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

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

        protected void saveContents​(java.lang.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 FileSequencer
        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)