Package com.mku.win.salmon.sequencer
Class WinClientSequencer
- java.lang.Object
-
- com.mku.win.salmon.sequencer.WinClientSequencer
-
- All Implemented Interfaces:
INonceSequencer
,java.io.Closeable
,java.lang.AutoCloseable
public class WinClientSequencer extends java.lang.Object implements INonceSequencer, java.io.Closeable
Nonce sequencer for use with the salmon windows service.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WinClientSequencer.RequestType
Request type.
-
Constructor Summary
Constructors Constructor Description WinClientSequencer(java.lang.String pipeName)
Instanticate a sequencer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close the sequencer.void
createSequence(java.lang.String driveId, java.lang.String authId)
Create a sequence.NonceSequence
getSequence(java.lang.String driveId)
Get a sequence by drive ID.void
initializeSequence(java.lang.String driveId, java.lang.String authId, byte[] startNonce, byte[] maxNonce)
Initialize the sequence.static boolean
isServiceAdmin(java.lang.String pipeName)
Check if this is a service running as local admin.byte[]
nextNonce(java.lang.String driveId)
Get the next noncevoid
revokeSequence(java.lang.String driveId)
Revoke a sequence by drive ID.void
setMaxNonce(java.lang.String driveId, java.lang.String authId, byte[] maxNonce)
Set the max nonce this sequence can produce.
-
-
-
Method Detail
-
isServiceAdmin
public static boolean isServiceAdmin(java.lang.String pipeName)
Check if this is a service running as local admin.- Parameters:
pipeName
- The pipe name.- Returns:
- True if running as local admin.
-
createSequence
public void createSequence(java.lang.String driveId, java.lang.String authId)
Create a sequence.- Specified by:
createSequence
in interfaceINonceSequencer
- Parameters:
driveId
- The drive ID.authId
- The authorization ID of the drive.
-
getSequence
public NonceSequence getSequence(java.lang.String driveId)
Get a sequence by drive ID.- Specified by:
getSequence
in interfaceINonceSequencer
- Parameters:
driveId
- The drive ID.- Returns:
- The sequence.
-
initializeSequence
public void initializeSequence(java.lang.String driveId, java.lang.String authId, byte[] startNonce, byte[] maxNonce)
Initialize the sequence.- Specified by:
initializeSequence
in 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
public byte[] nextNonce(java.lang.String driveId)
Get the next nonce- Specified by:
nextNonce
in interfaceINonceSequencer
- Parameters:
driveId
- The drive ID.- Returns:
- The byte array with the next nonce.
-
revokeSequence
public void revokeSequence(java.lang.String driveId)
Revoke a sequence by drive ID.- Specified by:
revokeSequence
in interfaceINonceSequencer
- Parameters:
driveId
- The drive Id
-
setMaxNonce
public void setMaxNonce(java.lang.String driveId, java.lang.String authId, byte[] maxNonce) throws java.io.IOException
Set the max nonce this sequence can produce.- Specified by:
setMaxNonce
in interfaceINonceSequencer
- Parameters:
driveId
- The drive ID.authId
- The auth ID of the device for the drive.maxNonce
- The maximum nonce.- Throws:
java.io.IOException
- If there was a problem with the sequencer.
-
close
public void close()
Close the sequencer.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceINonceSequencer
-
-