Class SM2Client

All Implemented Interfaces:
KeyExchange, NamedResource, SessionContextHolder, SessionHolder<Session>

public class SM2Client extends AbstractLoggingBean implements KeyExchange
  • Field Details

    • session

      private AbstractClientSession session
    • v_s

      protected byte[] v_s
    • v_c

      protected byte[] v_c
    • i_s

      protected byte[] i_s
    • i_c

      protected byte[] i_c
    • hash

      protected Digest hash
    • k

      protected byte[] k
    • h

      protected byte[] h
    • expected

      protected byte expected
    • RANDLONLEN

      private int RANDLONLEN
    • KLEN

      private int KLEN
    • randomc

      protected byte[] randomc
  • Constructor Details

    • SM2Client

      public SM2Client()
    • SM2Client

      public SM2Client(Session session)
  • Method Details

    • setSession

      public void setSession(Session session)
    • init

      public void init(byte[] v_s, byte[] v_c, byte[] i_s, byte[] i_c) throws Exception
      Description copied from interface: KeyExchange
      Initialize the key exchange algorithm.
      Specified by:
      init in interface KeyExchange
      Parameters:
      v_s - the server identification string
      v_c - the client identification string
      i_s - the server key initialization packet
      i_c - the client key initialization packet
      Throws:
      Exception - if an error occurs
    • next

      public boolean next(int cmd, Buffer buffer) throws Exception
      Description copied from interface: KeyExchange
      Process the next packet
      Specified by:
      next in interface KeyExchange
      Parameters:
      cmd - the command
      buffer - the packet contents positioned after the command
      Returns:
      a boolean indicating if the processing is complete or if more packets are to be received
      Throws:
      Exception - if an error occurs
    • getSession

      public Session getSession()
      Specified by:
      getSession in interface SessionHolder<Session>
    • getHash

      public Digest getHash()
      Description copied from interface: KeyExchange
      The message digest used by this key exchange algorithm.
      Specified by:
      getHash in interface KeyExchange
      Returns:
      the message digest
    • getH

      public byte[] getH()
      Description copied from interface: KeyExchange
      Retrieves the computed h parameter
      Specified by:
      getH in interface KeyExchange
      Returns:
      The h parameter
    • getK

      public byte[] getK()
      Description copied from interface: KeyExchange
      Retrieves the computed k parameter
      Specified by:
      getK in interface KeyExchange
      Returns:
      The k parameter
    • getName

      public String getName()
      Specified by:
      getName in interface NamedResource
      Returns:
      The resource name