Package org.conscrypt

Class ExternalSession

  • All Implemented Interfaces:
    javax.net.ssl.SSLSession, ConscryptSession

    final class ExternalSession
    extends java.lang.Object
    implements ConscryptSession
    An externalized view of the underlying SSLSession used within a socket/engine. This class provides the caller with a consistent session handle which will continue to be usable regardless of internal changes to the connection. It does this by delegating calls to the current internal session, which is provided by the session Provider (i.e. the socket or engine that owns the session). This allows the provider to switch implementations (for instance, using a JNI implementation to access live values while the connection is open and a set of final values when the connection is closed), even if the caller stores a reference to the session object.

    This class implements the SSLSession value API itself, rather than delegating to the provided session, to ensure the caller has a consistent value map, regardless of which internal session is currently being used by the socket/engine. This class will never call the value API methods on the underlying sessions, so they need not be implemented.

    • Field Detail

      • values

        private final java.util.HashMap<java.lang.String,​java.lang.Object> values
    • Method Detail

      • getId

        public byte[] getId()
        Specified by:
        getId in interface javax.net.ssl.SSLSession
      • getSessionContext

        public javax.net.ssl.SSLSessionContext getSessionContext()
        Specified by:
        getSessionContext in interface javax.net.ssl.SSLSession
      • getCreationTime

        public long getCreationTime()
        Specified by:
        getCreationTime in interface javax.net.ssl.SSLSession
      • getLastAccessedTime

        public long getLastAccessedTime()
        Specified by:
        getLastAccessedTime in interface javax.net.ssl.SSLSession
      • invalidate

        public void invalidate()
        Specified by:
        invalidate in interface javax.net.ssl.SSLSession
      • isValid

        public boolean isValid()
        Specified by:
        isValid in interface javax.net.ssl.SSLSession
      • getPeerCertificates

        public java.security.cert.X509Certificate[] getPeerCertificates()
                                                                 throws javax.net.ssl.SSLPeerUnverifiedException
        Specified by:
        getPeerCertificates in interface ConscryptSession
        Specified by:
        getPeerCertificates in interface javax.net.ssl.SSLSession
        Throws:
        javax.net.ssl.SSLPeerUnverifiedException
      • getLocalCertificates

        public java.security.cert.Certificate[] getLocalCertificates()
        Specified by:
        getLocalCertificates in interface javax.net.ssl.SSLSession
      • getPeerCertificateChain

        public javax.security.cert.X509Certificate[] getPeerCertificateChain()
                                                                      throws javax.net.ssl.SSLPeerUnverifiedException
        Specified by:
        getPeerCertificateChain in interface javax.net.ssl.SSLSession
        Throws:
        javax.net.ssl.SSLPeerUnverifiedException
      • getPeerPrincipal

        public java.security.Principal getPeerPrincipal()
                                                 throws javax.net.ssl.SSLPeerUnverifiedException
        Specified by:
        getPeerPrincipal in interface javax.net.ssl.SSLSession
        Throws:
        javax.net.ssl.SSLPeerUnverifiedException
      • getLocalPrincipal

        public java.security.Principal getLocalPrincipal()
        Specified by:
        getLocalPrincipal in interface javax.net.ssl.SSLSession
      • getCipherSuite

        public java.lang.String getCipherSuite()
        Specified by:
        getCipherSuite in interface javax.net.ssl.SSLSession
      • getProtocol

        public java.lang.String getProtocol()
        Specified by:
        getProtocol in interface javax.net.ssl.SSLSession
      • getPeerHost

        public java.lang.String getPeerHost()
        Specified by:
        getPeerHost in interface javax.net.ssl.SSLSession
      • getPeerPort

        public int getPeerPort()
        Specified by:
        getPeerPort in interface javax.net.ssl.SSLSession
      • getPacketBufferSize

        public int getPacketBufferSize()
        Specified by:
        getPacketBufferSize in interface javax.net.ssl.SSLSession
      • getApplicationBufferSize

        public int getApplicationBufferSize()
        Specified by:
        getApplicationBufferSize in interface javax.net.ssl.SSLSession
      • getValue

        public java.lang.Object getValue​(java.lang.String name)
        Specified by:
        getValue in interface javax.net.ssl.SSLSession
      • getValueNames

        public java.lang.String[] getValueNames()
        Specified by:
        getValueNames in interface javax.net.ssl.SSLSession
      • putValue

        public void putValue​(java.lang.String name,
                             java.lang.Object value)
        Specified by:
        putValue in interface javax.net.ssl.SSLSession
      • putValue

        void putValue​(javax.net.ssl.SSLSession session,
                      java.lang.String name,
                      java.lang.Object value)
      • removeValue

        public void removeValue​(java.lang.String name)
        Specified by:
        removeValue in interface javax.net.ssl.SSLSession
      • removeValue

        void removeValue​(javax.net.ssl.SSLSession session,
                         java.lang.String name)