Class OpenSslSessionCache.NativeSslSession

    • Constructor Detail

      • NativeSslSession

        NativeSslSession​(long session,
                         java.lang.String peerHost,
                         int peerPort,
                         long timeout,
                         java.util.Map<java.lang.String,​java.lang.Object> keyValueStorage)
    • Method Detail

      • keyValueStorage

        public java.util.Map<java.lang.String,​java.lang.Object> keyValueStorage()
        Description copied from interface: OpenSslInternalSession
        Return the underlying Map that is used by the following methods:
        • SSLSession.putValue(String, Object)
        • SSLSession.removeValue(String)
        • SSLSession.getValue(String)
        • SSLSession.getValueNames()
        The Map must be thread-safe!
        Specified by:
        keyValueStorage in interface OpenSslInternalSession
        Returns:
        storage
      • setSessionDetails

        public void setSessionDetails​(long creationTime,
                                      long lastAccessedTime,
                                      OpenSslSessionId id,
                                      java.util.Map<java.lang.String,​java.lang.Object> keyValueStorage)
        Description copied from interface: OpenSslInternalSession
        Set the details for the session which might come from a cache.
        Specified by:
        setSessionDetails in interface OpenSslInternalSession
        Parameters:
        creationTime - the time at which the session was created.
        lastAccessedTime - the time at which the session was last accessed via the session infrastructure (cache).
        id - the OpenSslSessionId
        keyValueStorage - the key value store. See OpenSslInternalSession.keyValueStorage().
      • shouldBeSingleUse

        boolean shouldBeSingleUse()
      • session

        long session()
      • upRef

        boolean upRef()
      • free

        void free()
      • close

        void close()
      • isValid

        boolean isValid​(long now)
      • setLocalCertificate

        public void setLocalCertificate​(java.security.cert.Certificate[] localCertificate)
        Description copied from interface: OpenSslInternalSession
        Set the local certificate chain that is used. It is not expected that this array will be changed at all and so its ok to not copy the array.
        Specified by:
        setLocalCertificate in interface OpenSslInternalSession
      • tryExpandApplicationBufferSize

        public void tryExpandApplicationBufferSize​(int packetLengthDataOnly)
        Description copied from interface: OpenSslInternalSession
        Expand (or increase) the value returned by SSLSession.getApplicationBufferSize() if necessary.

        This is only called in a synchronized block, so no need to use atomic operations.

        Specified by:
        tryExpandApplicationBufferSize in interface OpenSslInternalSession
        Parameters:
        packetLengthDataOnly - The packet size which exceeds the current SSLSession.getApplicationBufferSize().
      • handshakeFinished

        public void handshakeFinished​(byte[] id,
                                      java.lang.String cipher,
                                      java.lang.String protocol,
                                      byte[] peerCertificate,
                                      byte[][] peerCertificateChain,
                                      long creationTime,
                                      long timeout)
        Description copied from interface: OpenSslInternalSession
        Called once the handshake has completed.
        Specified by:
        handshakeFinished in interface OpenSslInternalSession
      • getId

        public byte[] getId()
        Specified by:
        getId 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
      • putValue

        public void putValue​(java.lang.String name,
                             java.lang.Object value)
        Specified by:
        putValue 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
      • removeValue

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

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

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

        public boolean hasPeerCertificates()
        Description copied from interface: OpenSslSession
        Returns true if the peer has provided certificates during the handshake.

        This method is similar to SSLSession.getPeerCertificates() but it does not throw a SSLPeerUnverifiedException if no certs are provided, making it more efficient to check if a mTLS connection is used.

        Specified by:
        hasPeerCertificates in interface OpenSslSession
        Returns:
        true if peer certificates are available.
      • getLocalCertificates

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

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

        public java.security.Principal getPeerPrincipal()
        Specified by:
        getPeerPrincipal in interface javax.net.ssl.SSLSession
      • 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
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object