FileDocCategorySizeDatePackage
SSLAsyncStream.javaAPI DocGlassfish v2 API3962Fri May 04 22:37:10 BST 2007com.sun.enterprise.web.connector.grizzly.ssl

SSLAsyncStream

public class SSLAsyncStream extends com.sun.enterprise.web.connector.grizzly.ByteBufferInputStream
This class add support for TLS|SSL to a ByteBufferInputStream.
author
Jean-Francois Arcand

Fields Summary
private SSLEngine
sslEngine
The SSLEngine to use for unwrapping bytes.
private ByteBuffer
inputBB
The encrypted ByteBuffer
Constructors Summary
Methods Summary
protected intdoRead()
Read and decrypt bytes from the underlying SSL connections. All the SSLEngine operations are delegated to class SSLUtils.

   
        byteBuffer.compact();
        
        int initialPosition = byteBuffer.position();
        int byteRead = 0;
        while (byteBuffer.position() == initialPosition){
            byteRead += SSLUtils.doRead(key,inputBB,sslEngine,readTimeout);
            if (byteRead > 0) {
                try{
                    byteBuffer = SSLUtils.unwrapAll(byteBuffer,inputBB,sslEngine);
                } catch (IOException ex){
                    Logger logger = SSLSelectorThread.logger();
                    if ( logger.isLoggable(Level.FINE) )
                        logger.log(Level.FINE,"SSLUtils.unwrapAll",ex);
                    return -1;
                }
            }  else {
                break;
            }   
        }

        byteBuffer.flip();
        return byteRead;
    
public java.nio.ByteBuffergetInputBB()

        return inputBB;
    
public javax.net.ssl.SSLEnginegetSslEngine()

        return sslEngine;
    
public voidsetInputBB(java.nio.ByteBuffer inputBB)

        this.inputBB = inputBB;
    
public voidsetSslEngine(javax.net.ssl.SSLEngine sslEngine)

        this.sslEngine = sslEngine;