boolean complete() { return sslEngine.getHandshakeStatus() == SSLEngineResult.HandshakeStatus.FINISHED || sslEngine.getHandshakeStatus() == SSLEngineResult.HandshakeStatus.NOT_HANDSHAKING; }
@Override public HandshakeStatus getHandshakeStatus() { return engine.getHandshakeStatus(); }
private boolean isHandShakeComplete() { HandshakeStatus status = sslEngine.getHandshakeStatus(); return status == SSLEngineResult.HandshakeStatus.FINISHED || status == SSLEngineResult.HandshakeStatus.NOT_HANDSHAKING; }
@Override public SSLEngineResult.HandshakeStatus getHandshakeStatus() { return delegate.getHandshakeStatus(); }
@Override public SSLEngineResult.HandshakeStatus getHandshakeStatus() { return delegate.getHandshakeStatus(); }
@Override public HandshakeStatus getHandshakeStatus() { return engine.getHandshakeStatus(); }
public SSLEngineResult.HandshakeStatus getHandshakeStatus() { return delegate.getHandshakeStatus(); }
@Override public HandshakeStatus get() { return engine.getHandshakeStatus(); } });
/** * Returns a printed current state of the SslFilter that could be helpful for troubleshooting. */ private String getDebugState() { return "SslFilter{" + "\napplicationInputBuffer=" + applicationInputBuffer + ",\nnetworkOutputBuffer=" + networkOutputBuffer + ",\nsslEngineStatus=" + sslEngine.getHandshakeStatus() + ",\nsslSession=" + sslEngine.getSession() + ",\nstate=" + state + ",\npendingApplicationWrite=" + pendingApplicationWrite + ",\npendingWritesSize=" + writeQueue + '}'; }
public SSLEngineResult.HandshakeStatus getHandshakeStatus() { return currentRef.get().getHandshakeStatus(); }
public SSLEngineResult.HandshakeStatus getHandshakeStatus() { return currentRef.get().getHandshakeStatus(); }
public SSLEngineResult.HandshakeStatus getHandshakeStatus() { return currentRef.get().getHandshakeStatus(); }
private SSLEngineResult.HandshakeStatus doTasks() { Runnable runnable; /* * We could run this in a separate thread, but do in the current for now. */ while ((runnable = tlsEngine.getDelegatedTask()) != null) { runnable.run(); } return tlsEngine.getHandshakeStatus(); }
private SSLEngineResult.HandshakeStatus doTasks() { Runnable runnable; /* * We could run this in a separate thread, but do in the current for now. */ while ((runnable = tlsEngine.getDelegatedTask()) != null) { runnable.run(); } return tlsEngine.getHandshakeStatus(); }
/** * Executes the SSLEngine tasks needed. * @return HandshakeStatus */ private HandshakeStatus runDelegatedTasks() { for (;;) { Runnable task = delegatedTask(); if (task == null) { break; } task.run(); } return sslEngine.getHandshakeStatus(); }
/** * performs the unwrap operation by unwrapping from {@link #inCrypt} to {@link #inData} **/ private synchronized ByteBuffer unwrap() throws SSLException { int rem; //There are some ssl test suites, which get around the selector.select() call, which cause an infinite unwrap and 100% cpu usage (see #459 and #458) if(readEngineResult.getStatus() == SSLEngineResult.Status.CLOSED && sslEngine.getHandshakeStatus() == HandshakeStatus.NOT_HANDSHAKING){ try { close(); } catch (IOException e) { //Not really interesting } } do { rem = inData.remaining(); readEngineResult = sslEngine.unwrap( inCrypt, inData ); } while ( readEngineResult.getStatus() == SSLEngineResult.Status.OK && ( rem != inData.remaining() || sslEngine.getHandshakeStatus() == HandshakeStatus.NEED_UNWRAP ) ); inData.flip(); return inData; }
protected void startHandshake() throws IOException { if (state != State.NOT_INITALIZED) throw new IllegalStateException("startHandshake() can only be called once, state " + state); this.netReadBuffer = ByteBuffer.allocate(netReadBufferSize()); this.netWriteBuffer = ByteBuffer.allocate(netWriteBufferSize()); this.appReadBuffer = ByteBuffer.allocate(applicationBufferSize()); //clear & set netRead & netWrite buffers netWriteBuffer.position(0); netWriteBuffer.limit(0); netReadBuffer.position(0); netReadBuffer.limit(0); state = State.HANDSHAKE; //initiate handshake sslEngine.beginHandshake(); handshakeStatus = sslEngine.getHandshakeStatus(); }
private SSLEngineResult.HandshakeStatus executeTasks() { Runnable runnable; while ((runnable = engine.getDelegatedTask()) != null) { runnable.run(); } SSLEngineResult.HandshakeStatus hsStatus = engine.getHandshakeStatus(); U.must(hsStatus != SSLEngineResult.HandshakeStatus.NEED_TASK, "handshake shouldn't need additional tasks!"); debug("after tasks: " + hsStatus); return hsStatus; }
public SSLSocketChannel2( SocketChannel channel , SSLEngine sslEngine , ExecutorService exec , SelectionKey key ) throws IOException { if( channel == null || sslEngine == null || exec == null ) throw new IllegalArgumentException( "parameter must not be null" ); this.socketChannel = channel; this.sslEngine = sslEngine; this.exec = exec; readEngineResult = writeEngineResult = new SSLEngineResult( Status.BUFFER_UNDERFLOW, sslEngine.getHandshakeStatus(), 0, 0 ); // init to prevent NPEs tasks = new ArrayList<Future<?>>( 3 ); if( key != null ) { key.interestOps( key.interestOps() | SelectionKey.OP_WRITE ); this.selectionKey = key; } createBuffers( sslEngine.getSession() ); // kick off handshake socketChannel.write( wrap( emptybuffer ) );// initializes res processHandshake(); }
/** * Runs all tasks needed to continue SSL work. * * @return Handshake status after running all tasks. */ private HandshakeStatus runTasks() { Runnable runnable; while ((runnable = sslEngine.getDelegatedTask()) != null) { if (log.isDebugEnabled()) log.debug("Running SSL engine task: " + runnable + '.'); runnable.run(); } if (log.isDebugEnabled()) log.debug("Finished running SSL engine tasks. HandshakeStatus: " + sslEngine.getHandshakeStatus()); return sslEngine.getHandshakeStatus(); }