Class WinClientSequencer

java.lang.Object
com.mku.win.salmon.sequencer.WinClientSequencer
All Implemented Interfaces:
INonceSequencer, Closeable, AutoCloseable

public class WinClientSequencer extends Object implements INonceSequencer, Closeable
Nonce sequencer for use with the salmon windows service.
  • Constructor Details

    • WinClientSequencer

      public WinClientSequencer(String pipeName) throws Exception
      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

      public static boolean isServiceAdmin(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(String driveId, String authId)
      Create a sequence.
      Specified by:
      createSequence in interface INonceSequencer
      Parameters:
      driveId - The drive ID.
      authId - The authorization ID of the drive.
    • getSequence

      public NonceSequence getSequence(String driveId)
      Get a sequence by drive ID.
      Specified by:
      getSequence in interface INonceSequencer
      Parameters:
      driveId - The drive ID.
      Returns:
      The sequence.
    • initializeSequence

      public void initializeSequence(String driveId, String authId, byte[] startNonce, byte[] maxNonce)
      Initialize the sequence.
      Specified by:
      initializeSequence in interface INonceSequencer
      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(String driveId)
      Get the next nonce
      Specified by:
      nextNonce in interface INonceSequencer
      Parameters:
      driveId - The drive ID.
      Returns:
      The byte array with the next nonce.
    • revokeSequence

      public void revokeSequence(String driveId)
      Revoke a sequence by drive ID.
      Specified by:
      revokeSequence in interface INonceSequencer
      Parameters:
      driveId - The drive Id
    • setMaxNonce

      public void setMaxNonce(String driveId, String authId, byte[] maxNonce) throws IOException
      Set the max nonce this sequence can produce.
      Specified by:
      setMaxNonce in interface INonceSequencer
      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:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface INonceSequencer