Package com.mku.salmon.win.sequencer
Class WinFileSequencer
java.lang.Object
com.mku.salmon.sequence.SalmonFileSequencer
com.mku.salmon.win.sequencer.WinFileSequencer
- All Implemented Interfaces:
INonceSequencer
File Sequencer for Windows with tamper protection.
-
Constructor Summary
ConstructorDescriptionWinFileSequencer
(IRealFile sequenceFile, INonceSequenceSerializer serializer, String regCheckSumKey) Instantiate a windows file sequencer. -
Method Summary
Modifier and TypeMethodDescriptionGet the registry key to save the checksum.protected String
Gets the checksum the registry and verifies the contents.void
reset
(boolean clearChecksumOnly) Reset the sequences.protected void
saveContents
(String contents) Save contents to the file and checksum to registry.void
setCheckSumKey
(String key) Set the registry key to save the checksum.Methods inherited from class com.mku.salmon.sequence.SalmonFileSequencer
close, createSequence, getSequence, getSequenceFile, initializeSequence, nextNonce, revokeSequence, saveSequenceFile, setMaxNonce
-
Constructor Details
-
WinFileSequencer
public WinFileSequencer(IRealFile sequenceFile, INonceSequenceSerializer serializer, String regCheckSumKey) throws IOException Instantiate a windows file sequencer.- Parameters:
sequenceFile
- The sequence fileserializer
- The serializerregCheckSumKey
- The registry key to use for the checksum.- Throws:
SequenceException
- Thrown if there is an error with the nonce sequenceIOException
- Thrown if there is an IO error.
-
-
Method Details
-
getCheckSumKey
Get the registry key to save the checksum.- Returns:
- The key
-
setCheckSumKey
Set the registry key to save the checksum.- Parameters:
key
- The key
-
getContents
Gets the checksum the registry and verifies the contents.- Overrides:
getContents
in classSalmonFileSequencer
- Returns:
- The contents
- Throws:
SequenceException
- Thrown if there is an error with the nonce sequence
-
saveContents
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 classSalmonFileSequencer
- 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)
-