/** * Returns a new server-side {@link SSLEngine} with the current configuration. */ @Override public SSLEngine newEngine() { if (nextProtocols.isEmpty()) { return new OpenSslEngine(ctx, bufferPool(), null); } else { return new OpenSslEngine( ctx, bufferPool(), nextProtocols.get(nextProtocols.size() - 1)); } }
@Override public synchronized void closeInbound() throws SSLException { if (isInboundDone) { return; } isInboundDone = true; engineClosed = true; if (accepted != 0) { if (!receivedShutdown) { shutdown(); throw new SSLException("close_notify has not been received"); } } else { // engine closing before initial handshake shutdown(); } }
beginHandshakeImplicitly(); SSLEngineResult.HandshakeStatus handshakeStatus = getHandshakeStatus(); if ((!handshakeFinished || engineClosed) && handshakeStatus == NEED_WRAP) { return new SSLEngineResult(getEngineStatus(), NEED_WRAP, 0, 0); isOutboundDone = true; engineClosed = true; shutdown(); throw ENCRYPTED_PACKET_OVERSIZED; lastPrimingReadResult = 0; try { bytesConsumed += writeEncryptedData(src); } catch (Exception e) { throw new SSLException(e); shutdown(); throw new SSLException(error); return new SSLEngineResult(BUFFER_OVERFLOW, getHandshakeStatus(), bytesConsumed, 0); bytesRead = readPlaintextData(dst); } catch (Exception e) { throw new SSLException(e); closeOutbound(); closeInbound();
beginHandshakeImplicitly(); SSLEngineResult.HandshakeStatus handshakeStatus = getHandshakeStatus(); if ((!handshakeFinished || engineClosed) && handshakeStatus == NEED_UNWRAP) { return new SSLEngineResult(getEngineStatus(), NEED_UNWRAP, 0, 0); bytesProduced += readEncryptedData(dst, pendingNet); } catch (Exception e) { throw new SSLException(e); shutdown(); return new SSLEngineResult(getEngineStatus(), getHandshakeStatus(), 0, bytesProduced); bytesConsumed += writePlaintextData(src); } catch (Exception e) { throw new SSLException(e); return new SSLEngineResult(BUFFER_OVERFLOW, getHandshakeStatus(), bytesConsumed, bytesProduced); bytesProduced += readEncryptedData(dst, pendingNet); } catch (Exception e) { throw new SSLException(e); return new SSLEngineResult(getEngineStatus(), getHandshakeStatus(), bytesConsumed, bytesProduced); return new SSLEngineResult(getEngineStatus(), getHandshakeStatus(), bytesConsumed, bytesProduced);
@Override public synchronized void closeOutbound() { if (isOutboundDone) { return; } isOutboundDone = true; engineClosed = true; if (accepted != 0 && destroyed == 0) { int mode = SSL.getShutdown(ssl); if ((mode & SSL.SSL_SENT_SHUTDOWN) != SSL.SSL_SENT_SHUTDOWN) { SSL.shutdownSSL(ssl); } } else { // engine closing before initial handshake shutdown(); } }
/** * Returns a new server-side {@link SSLEngine} with the current configuration. */ public SSLEngine newEngine() { if (nextProtocols.isEmpty()) { return new OpenSslEngine(ctx, bufferPool, null); } else { return new OpenSslEngine( ctx, bufferPool, nextProtocols.get(nextProtocols.size() - 1)); } }
@Override protected void finalize() throws Throwable { sslEngine.shutdown(); super.finalize(); } };