Package com.mku.win.salmon.sequencer
Class WinClientSequencer
java.lang.Object
com.mku.win.salmon.sequencer.WinClientSequencer
- All Implemented Interfaces:
INonceSequencer,Closeable,AutoCloseable
Nonce sequencer for use with the salmon windows service.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the sequencer.voidcreateSequence(String driveId, String authId) Create a sequence.getSequence(String driveId) Get a sequence by drive ID.voidinitializeSequence(String driveId, String authId, byte[] startNonce, byte[] maxNonce) Initialize the sequence.static booleanisServiceAdmin(String pipeName) Check if this is a service running as local admin.byte[]Get the next noncevoidrevokeSequence(String driveId) Revoke a sequence by drive ID.voidsetMaxNonce(String driveId, String authId, byte[] maxNonce) Set the max nonce this sequence can produce.
-
Constructor Details
-
WinClientSequencer
Instanticate a sequencer.- Parameters:
pipeName- The name of the pipe to use see Salmon WinService.- Throws:
Exception- If there is a problem with accessing the pipe.
-
-
Method Details
-
isServiceAdmin
Check if this is a service running as local admin.- Parameters:
pipeName- The pipe name.- Returns:
- True if running as local admin.
-
createSequence
Create a sequence.- Specified by:
createSequencein interfaceINonceSequencer- Parameters:
driveId- The drive ID.authId- The authorization ID of the drive.
-
getSequence
Get a sequence by drive ID.- Specified by:
getSequencein interfaceINonceSequencer- Parameters:
driveId- The drive ID.- Returns:
- The sequence.
-
initializeSequence
Initialize the sequence.- Specified by:
initializeSequencein interfaceINonceSequencer- Parameters:
driveId- The drive ID.authId- The auth ID of the device for the drive.startNonce- The starting nonce.maxNonce- The maximum nonce.
-
nextNonce
Get the next nonce- Specified by:
nextNoncein interfaceINonceSequencer- Parameters:
driveId- The drive ID.- Returns:
- The byte array with the next nonce.
-
revokeSequence
Revoke a sequence by drive ID.- Specified by:
revokeSequencein interfaceINonceSequencer- Parameters:
driveId- The drive Id
-
setMaxNonce
Set the max nonce this sequence can produce.- Specified by:
setMaxNoncein interfaceINonceSequencer- Parameters:
driveId- The drive ID.authId- The auth ID of the device for the drive.maxNonce- The maximum nonce.- Throws:
IOException- If there was a problem with the sequencer.
-
close
public void close()Close the sequencer.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceINonceSequencer
-