Class NegotiationState

  • All Implemented Interfaces:
    Certificate

    class NegotiationState
    extends java.lang.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.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private class  NegotiationState.Challenge
      The Challenge object is used to enable the server to challenge for the client X509 certificate if desired.
      private class  NegotiationState.Delegate
      The Delegate is basically a settable runnable object.
    • Constructor Summary

      Constructors 
      Constructor Description
      NegotiationState​(Negotiation negotiation, Socket socket)
      Constructor for the NegotiationCertificate object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      javax.security.cert.X509Certificate[] getChain()
      This will return the X509 certificate chain, if any, that has been sent by the client.
      CertificateChallenge getChallenge()
      This returns a challenge for the certificate.
      java.util.concurrent.RunnableFuture<Certificate> getFuture()
      This returns the completion task associated with any challenge made for the client certificate.
      javax.net.ssl.SSLSession getSession()
      This is used to acquire the SSL session associated with the handshake.
      boolean isChainPresent()
      This is used to determine if the X509 certificate chain is present for the request.
      boolean isChallenge()
      This is used to determine if the state is in challenge mode.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • future

        private final java.util.concurrent.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.
      • socket

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

      • 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 Detail

      • 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 java.util.concurrent.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 java.lang.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:
        java.lang.Exception
      • getChain

        public javax.security.cert.X509Certificate[] getChain()
                                                       throws java.lang.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:
        java.lang.Exception
      • getSession

        public javax.net.ssl.SSLSession getSession()
                                            throws java.lang.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:
        java.lang.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