Java/Eta/Core/src/main/java/com/refinitiv/eta/transport/CryptoHelper.java
void performHandshake() throws IOException
    {
        checkEngine();
        boolean handshakeComplete = false;
        // continue handshaking until we've finished.
        while (!handshakeComplete)
        {
            switch (_engine.getHandshakeStatus())
            {
                case FINISHED:
                case NOT_HANDSHAKING:
                    handshakeComplete = true;
                    break;
                case NEED_TASK:
                    executeDelegatedTasks();
                    try
                    {
                        Thread.sleep(100);
                    }
                    catch (InterruptedException e)
                    {
                    }
                    break;
                case NEED_UNWRAP:
                    decryptNetworkData(false);
                    try
                    {
                        Thread.sleep(100);
                    }
                    catch (InterruptedException e)
                    {
                    }
                    break;
                case NEED_WRAP:
                    encryptApplicationData();
                    try
                    {
                        Thread.sleep(100);
                    }
                    catch (InterruptedException e)
                    {
                    }
                    break;
                default:
                    throw new IOException("Invalid handshake status for CryptoHelper.performHandshake()");
            }
        }

        // check certificate(s) validity (maybe has expired?) after handshake is done(a null value implies "X509" algorithm)
        if (_server == false && (_connectionKeyManagerAlgorithm == null || _connectionKeyManagerAlgorithm.endsWith("X509")))
        {
            try
            {
                X509Certificate[] cert = (X509Certificate[])(_engine.getSession().getPeerCertificates());

                for (int i = 0; i < cert.length; i++)
                {
                    try
                    {
                        cert[i].checkValidity();
                    }
                    catch (CertificateExpiredException e) // certificate has expired
                    {
                        throw new IOException("Invalid certificate (Expired):   " + e.getMessage());
                    }
                    catch (CertificateNotYetValidException e) // certificate not yet valid
                    {
                        throw new IOException("Invalid certificate (Not Yet Valid):   " + e.getMessage());
                    }
                }
            }
            catch (SSLPeerUnverifiedException e)
            {
            	 throw new IOException("Missing certificate:   " + e.getMessage());
            }
        }
    }
// Process the encrypted or decrypted data or process the handshake information
Process the encrypted or decrypted data or process the handshake information
Process the encrypted or decrypted data or process the handshake information
void performHandshake() throws IOException
    {
        checkEngine();
        boolean handshakeComplete = false;
        while (!handshakeComplete)
        {
            switch (_engine.getHandshakeStatus())
            {
                case FINISHED:
                case NOT_HANDSHAKING:
                    handshakeComplete = true;
                    break;
                case NEED_TASK:
                    executeDelegatedTasks();
                    try
                    {
                        Thread.sleep(100);
                    }
                    catch (InterruptedException e)
                    {
                    }
                    break;
                case NEED_UNWRAP:
                    decryptNetworkData(false);
                    try
                    {
                        Thread.sleep(100);
                    }
                    catch (InterruptedException e)
                    {
                    }
                    break;
                case NEED_WRAP:
                    encryptApplicationData();
                    try
                    {
                        Thread.sleep(100);
                    }
                    catch (InterruptedException e)
                    {
                    }
                    break;
                default:
                    throw new IOException("Invalid handshake status for CryptoHelper.performHandshake()");
            }
        }
        if (_server == false && (_connectionKeyManagerAlgorithm == null || _connectionKeyManagerAlgorithm.endsWith("X509")))
        {
            try
            {
                X509Certificate[] cert = (X509Certificate[])(_engine.getSession().getPeerCertificates());
                for (int i = 0; i < cert.length; i++)
                {
                    try
                    {
                        cert[i].checkValidity();
                    }
                    catch (CertificateExpiredException e) 
                    {
                        throw new IOException("Invalid certificate (Expired):   " + e.getMessage());
                    }
                    catch (CertificateNotYetValidException e) 
                    {
                        throw new IOException("Invalid certificate (Not Yet Valid):   " + e.getMessage());
                    }
                }
            }
            catch (SSLPeerUnverifiedException e)
            {
            	 throw new IOException("Missing certificate:   " + e.getMessage());
            }
        }
    }
void performHandshake ( ) throws IOException { checkEngine ( ) ; boolean handshakeComplete = false ; while ( ! handshakeComplete ) { switch ( _engine . getHandshakeStatus ( ) ) { case FINISHED : case NOT_HANDSHAKING : handshakeComplete = true ; break ; case NEED_TASK : executeDelegatedTasks ( ) ; try { Thread . sleep ( 100 ) ; } catch ( InterruptedException e ) { } break ; case NEED_UNWRAP : decryptNetworkData ( false ) ; try { Thread . sleep ( 100 ) ; } catch ( InterruptedException e ) { } break ; case NEED_WRAP : encryptApplicationData ( ) ; try { Thread . sleep ( 100 ) ; } catch ( InterruptedException e ) { } break ; default : throw new IOException ( "Invalid handshake status for CryptoHelper.performHandshake()" ) ; } } if ( _server == false && ( _connectionKeyManagerAlgorithm == null || _connectionKeyManagerAlgorithm . endsWith ( "X509" ) ) ) { try { X509Certificate [ ] cert = ( X509Certificate [ ] ) ( _engine . getSession ( ) . getPeerCertificates ( ) ) ; for ( int i = 0 ; i < cert . length ; i ++ ) { try { cert [ i ] . checkValidity ( ) ; } catch ( CertificateExpiredException e ) { throw new IOException ( "Invalid certificate (Expired):   " + e . getMessage ( ) ) ; } catch ( CertificateNotYetValidException e ) { throw new IOException ( "Invalid certificate (Not Yet Valid):   " + e . getMessage ( ) ) ; } } } catch ( SSLPeerUnverifiedException e ) { throw new IOException ( "Missing certificate:   " + e . getMessage ( ) ) ; } } }
Process the encrypted or decrypted data or process the handshake information
Process the encrypted or decrypted data or process the handshake information
// continue handshaking until we've finished. // check certificate(s) validity (maybe has expired?) after handshake is done(a null value implies "X509" algorithm) // certificate has expired // certificate not yet valid