Class NegotiationState

java.lang.Object
org.simpleframework.transport.NegotiationState
All Implemented Interfaces:
Certificate

class NegotiationState extends Object implements Certificate
The NegotiationState represents the certificate that is sent by a client during a secure HTTPS conversation. This may or may not contain an X509 certificate chain from the client. If it does not a CertificateChallenge may be used to issue a renegotiation of the connection. One completion of the renegotiation the challenge executes a completion operation.
  • Field Details

    • future

      private final RunnableFuture<Certificate> future
      This is used to hold the completion task for the challenge.
    • negotiation

      private final Negotiation negotiation
      This is the handshake used to acquire the certificate details.
    • challenge

      private final NegotiationState.Challenge challenge
      This is the challenge used to request the client certificate.
    • delegate

      private final NegotiationState.Delegate delegate
      This is the runnable task that is executed on task completion.
    • socket

      private final Socket socket
      This is the socket representing the underlying TCP connection.
  • Constructor Details

    • NegotiationState

      public NegotiationState(Negotiation negotiation, Socket socket)
      Constructor for the NegotiationCertificate object. This creates an object used to provide certificate details and a means to challenge for certificate details for the connected client if required.
      Parameters:
      negotiation - the negotiation associated with this
      socket - the underlying TCP connection to the client
  • Method Details

    • isChallenge

      public boolean isChallenge()
      This is used to determine if the state is in challenge mode. In challenge mode a challenge future will be executed on completion of the challenge. This will the completion task.
      Returns:
      this returns true if the state is in challenge mode
    • getFuture

      public RunnableFuture<Certificate> getFuture()
      This returns the completion task associated with any challenge made for the client certificate. If this returns null then no challenge has been made for the client certificate.
      Returns:
      this returns the challenge completion task if any
    • getChallenge

      public CertificateChallenge getChallenge() throws Exception
      This returns a challenge for the certificate. A challenge is issued by providing a Runnable task which is to be executed when the challenge has completed. Typically this task should be used to drive completion of an HTTPS request.
      Specified by:
      getChallenge in interface Certificate
      Returns:
      this returns a challenge for the client certificate
      Throws:
      Exception
    • getChain

      public X509Certificate[] getChain() throws Exception
      This will return the X509 certificate chain, if any, that has been sent by the client. A certificate chain is typically only send when the server explicitly requests the certificate on the initial connection or when it is challenged for.
      Specified by:
      getChain in interface Certificate
      Returns:
      this returns the clients X509 certificate chain
      Throws:
      Exception
    • getSession

      public SSLSession getSession() throws Exception
      This is used to acquire the SSL session associated with the handshake. The session makes all of the details associated with the handshake available, including the cipher suites used and the SSL context used to create the session.
      Returns:
      the SSL session associated with the connection
      Throws:
      Exception
    • isChainPresent

      public boolean isChainPresent()
      This is used to determine if the X509 certificate chain is present for the request. If it is not present then a challenge can be used to request the certificate.
      Specified by:
      isChainPresent in interface Certificate
      Returns:
      true if the certificate chain is present