pipeline.addFirst("ssl", new SslHandler(sslEngine));
private SslHandler newHandler(SSLEngine engine) { SslHandler handler = new SslHandler(engine, bufferPool()); if (isClient()) { handler.setIssueHandshake(true); } handler.setCloseOnSSLException(true); return handler; } }
@Override public SocketChannel newChannel(ChannelPipeline pipeline) { try { SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(null, new TrustManager[]{new BogusTrustManager()}, null); SSLEngine sslEngine = sslContext.createSSLEngine(); sslEngine.setUseClientMode(true); pipeline.addFirst("ssl", new SslHandler(sslEngine)); return super.newChannel(pipeline); } catch (Exception ex) { throw new RuntimeException("Cannot create SSL channel", ex); } } }
@Override public ChannelPipeline getPipeline() { syslogTcpHandler handler = new syslogTcpHandler(); handler.setEventSize(eventSize); handler.setFormater(formaterProp); handler.setKeepFields(keepFields); handler.setClientIPHeader(clientIPHeader); handler.setClientHostnameHeader(clientHostnameHeader); ChannelPipeline pipeline = Channels.pipeline(handler); sslEngineSupplier.get().ifPresent(sslEngine -> { pipeline.addFirst("ssl", new SslHandler(sslEngine)); }); return pipeline; } }
@Override public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = Channels.pipeline(); SSLEngine sslEngine = createServerSSLContext().createSSLEngine(); sslEngine.setUseClientMode(false); pipeline.addLast("ssl", new SslHandler(sslEngine)); return pipeline; } }
@Override public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = Channels.pipeline(); if (enableCompression) { ZlibEncoder encoder = new ZlibEncoder(6); pipeline.addFirst("deflater", encoder); pipeline.addFirst("inflater", new ZlibDecoder()); } sslEngineSupplier.get().ifPresent(sslEngine -> { logger.info("SSLEngine protocols enabled: " + Arrays.asList(sslEngine.getEnabledProtocols())); // addFirst() will make SSL handling the first stage of decoding // and the last stage of encoding this must be added after // adding compression handling above pipeline.addFirst("ssl", new SslHandler(sslEngine)); }); if (enableIpFilter) { logger.info("Setting up ipFilter with the following rule definition: " + patternRuleConfigDefinition); IpFilterRuleHandler ipFilterHandler = new IpFilterRuleHandler(); ipFilterHandler.addAll(rules); logger.info("Adding ipFilter with " + ipFilterHandler.size() + " rules"); pipeline.addFirst("ipFilter", ipFilterHandler); } return pipeline; } }
sslEngine.setSSLParameters(sslParameters); sslEngine.setUseClientMode(true); final SslHandler sslHandler = new SslHandler( sslEngine, SslHandler.getDefaultBufferPool(),
SslHandler sslHandler = new SslHandler(engine); realChannel.getPipeline().addFirst("ssl", sslHandler); sslHandshakeFuture = sslHandler.handshake();
@Override public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = Channels.pipeline(); if (sslFactory != null) { pipeline.addLast("ssl", new SslHandler(sslFactory.createSSLEngine())); } pipeline.addLast("decoder", new HttpRequestDecoder()); pipeline.addLast("aggregator", new HttpChunkAggregator(1 << 16)); pipeline.addLast("encoder", new HttpResponseEncoder()); pipeline.addLast("chunking", new ChunkedWriteHandler()); pipeline.addLast("shuffle", SHUFFLE); pipeline.addLast("idle", idleStateHandler); pipeline.addLast(TIMEOUT_HANDLER, new TimeoutHandler()); return pipeline; // TODO factor security manager into pipeline // TODO factor out encode/decode to permit binary shuffle // TODO factor out decode of index to permit alt. models }
@Override public ChannelPipeline getPipeline() throws Exception { ChannelPipeline cp = super.getPipeline(); SSLEngine engine = context.createSSLEngine(); engine.setUseClientMode(false); cp.addFirst("sslHandler", new SslHandler(engine)); return cp; }
public SslHandler createSslHandler(String peerHost, int peerPort) throws GeneralSecurityException, IOException { SSLEngine sslEngine = sslEngineFactory.newSSLEngine(peerHost, peerPort); SslHandler sslHandler = handshakeTimeout > 0 ? new SslHandler(sslEngine, getDefaultBufferPool(), false, nettyTimer, handshakeTimeout) : new SslHandler(sslEngine); sslHandler.setCloseOnSSLException(true); return sslHandler; }
@Override protected ChannelPipelineFactory getPipelineFactory(OftpletFactory oftpletFactory, Timer timer) { SslHandler sslHandler = null; if (sslEngine != null) { sslHandler = new SslHandler(sslEngine); } OdetteFtpPipelineFactory pipelineFactory = new OdetteFtpPipelineFactory(EntityType.INITIATOR, oftpletFactory, timer, TransportType.TCPIP, sslHandler, null); return pipelineFactory; }
@Override public ChannelHandler call() throws Exception { try { return new SslHandler(createSslEngine()); } catch (SSLException e) { LOG.error("Error creating SSL context. Make sure the certificate and key are in the correct format: cert=X.509 key=PKCS#8"); throw e; } }
private static SslHandler getSSLHandler(URL target, Map<String, Object> callProps) throws IOException { SslHandler handler = null; if ("https".equalsIgnoreCase(target.getProtocol())) { SSLContextFactory sslContextFactory = new SSLContextFactory(callProps); SSLEngine engine = sslContextFactory.getSSLContext().createSSLEngine(); engine.setUseClientMode(true); handler = new SslHandler(engine); } return handler; }
public SslHandler sslHandler() { final SSLContext context = sslContext.get(); if (context == null) { return null; } final SSLEngine engine = context.createSSLEngine(); engine.setUseClientMode(true); final SslHandler handler = new SslHandler(engine); handler.setEnableRenegotiation(false); handler.setIssueHandshake(true); return handler; }
@Override public ChannelPipeline getPipeline() throws Exception { ChannelPipeline cp = super.getPipeline(); SSLEngine engine = context.createSSLEngine(); engine.setUseClientMode(false); cp.addFirst("sslHandler", new SslHandler(engine)); return cp; }
private SslHandler createSslHandler(String peerHost, int peerPort) throws GeneralSecurityException { SSLEngine sslEngine = sslEngineFactory.newSSLEngine(peerHost, peerPort); SslHandler sslHandler = handshakeTimeout > 0 ? new SslHandler(sslEngine, getDefaultBufferPool(), false, nettyTimer, handshakeTimeout) : new SslHandler(sslEngine); sslHandler.setCloseOnSSLException(true); return sslHandler; }
/** * Add the {@link SslHandler} to the pipeline and start encrypting after the next written message */ private void prepareStartTLS() { SslHandler filter = new SslHandler(engine, true); filter.getEngine().setUseClientMode(false); channel.getPipeline().addFirst(HandlerConstants.SSL_HANDLER, filter); }
/** * Add the {@link SslHandler} to the pipeline and start encrypting after the next written message */ private void prepareStartTLS() { SslHandler filter = new SslHandler(engine, true); filter.getEngine().setUseClientMode(false); channel.getPipeline().addFirst(HandlerConstants.SSL_HANDLER, filter); }
@Override public boolean startTLS() { if (supportStartTLS() == false) return false; // enable buffering of the stream ((StartTLSOutputStream)getAttachment(ctx).get(BUFFERED_OUT)).bufferTillCRLF(); SslHandler filter = new SslHandler(engine, true); filter.getEngine().setUseClientMode(false); ctx.getPipeline().addFirst("sslHandler", filter); return true; }