Package nts

Interface NtsPacket

All Superinterfaces:
NtpV3Packet, NtpV4Packet
All Known Implementing Classes:
NtsImpl

public interface NtsPacket extends NtpV4Packet
  • Method Details

    • buildRequest

      void buildRequest(byte[] cookie, int num_cookies)
      Build an NTS packet
      Parameters:
      cookie - The NTS cookie to use in the packet
      num_cookies - Number of cookies to request
    • addUniqueIdentifierEF

      void addUniqueIdentifierEF(byte[] unique_identifier_body)
      Adds a unique identifier extension field to the NTSv4 packet.
      Parameters:
      unique_identifier_body - the unique identifier byte array, must be at least 32 bytes long.
    • addCookieEF

      void addCookieEF(byte[] cookie_body)
      Adds a cookie extension field to the NTSv4 packet.
      Parameters:
      cookie_body - a cookie received from the NTS KE process or from a server response.
    • addCookiePlaceholderEF

      void addCookiePlaceholderEF(byte[] existing_cookie)
      Adds a cookie placeholder extension filed to the NTSv4 packet
      Parameters:
      existing_cookie - The cookie to be replaced
    • prepareAuthAndEncEF

      void prepareAuthAndEncEF()
      Constructs all the possible variables that will be used for the authentication and encryption extension field. This is done here to avoid unnecessary delays in the time measurement after timestamping of the request packet. This should be called after all the Extension Fields and other parameters have been added to the packet.
    • createAuthAndEncEF

      void createAuthAndEncEF(byte[] nonce)
      Creates the AuthAndEnc EF with the given keys and nonce. This is done after the NTP packet has been timestamped. Must be called after prepareAuthAndEncEF() has been called.
      Parameters:
      nonce - the nonce to be used for encryption
    • createAuthAndEncEF

      void createAuthAndEncEF()
      Creates the AuthAndEnc EF with the given keys and a random nonce. This is done after the NTP packet has been timestamped. Must be called after prepareAuthAndEncEF() has been called.
    • decryptAndVerify

      byte[] decryptAndVerify() throws AuthenticationFailureException
      Decrypt and verify a received NTS packet
      Throws:
      AuthenticationFailureException
    • validate

      Validate a response packet given a request packet
      Parameters:
      req - - The request packet
      Throws:
      IOException - - On failure
      NtsNakException
      AuthenticationFailureException