private ConscryptAlpnSslEngine(SSLEngine engine, ByteBufAllocator alloc, List<String> protocols) { super(engine); // Configure the Conscrypt engine to use Netty's buffer allocator. This is a trade-off of memory vs // performance. // // If no allocator is provided, the engine will internally allocate a direct buffer of max packet size in // order to optimize JNI calls (this happens the first time it is provided a non-direct buffer from the // application). // // Alternatively, if an allocator is provided, no internal buffer will be created and direct buffers will be // retrieved from the allocator on-demand. if (USE_BUFFER_ALLOCATOR) { Conscrypt.setBufferAllocator(engine, new BufferAllocatorAdapter(alloc)); } // Set the list of supported ALPN protocols on the engine. Conscrypt.setApplicationProtocols(engine, protocols.toArray(new String[0])); }
@Override public void configureTlsExtensions( SSLSocket sslSocket, String hostname, List<Protocol> protocols) { if (Conscrypt.isConscrypt(sslSocket)) { // Enable SNI and session tickets. if (hostname != null) { Conscrypt.setUseSessionTickets(sslSocket, true); Conscrypt.setHostname(sslSocket, hostname); } // Enable ALPN. List<String> names = Platform.alpnProtocolNames(protocols); Conscrypt.setApplicationProtocols(sslSocket, names.toArray(new String[0])); } else { super.configureTlsExtensions(sslSocket, hostname, protocols); } }
private ConscryptAlpnSslEngine(SSLEngine engine, ByteBufAllocator alloc, List<String> protocols) { super(engine); // Configure the Conscrypt engine to use Netty's buffer allocator. This is a trade-off of memory vs // performance. // // If no allocator is provided, the engine will internally allocate a direct buffer of max packet size in // order to optimize JNI calls (this happens the first time it is provided a non-direct buffer from the // application). // // Alternatively, if an allocator is provided, no internal buffer will be created and direct buffers will be // retrieved from the allocator on-demand. if (USE_BUFFER_ALLOCATOR) { Conscrypt.setBufferAllocator(engine, new BufferAllocatorAdapter(alloc)); } // Set the list of supported ALPN protocols on the engine. Conscrypt.setApplicationProtocols(engine, protocols.toArray(new String[0])); }
@Override public void configureTlsExtensions( SSLSocket sslSocket, String hostname, List<Protocol> protocols) { if (Conscrypt.isConscrypt(sslSocket)) { // Enable SNI and session tickets. if (hostname != null) { Conscrypt.setUseSessionTickets(sslSocket, true); Conscrypt.setHostname(sslSocket, hostname); } // Enable ALPN. List<String> names = Platform.alpnProtocolNames(protocols); Conscrypt.setApplicationProtocols(sslSocket, names.toArray(new String[0])); } else { super.configureTlsExtensions(sslSocket, hostname, protocols); } }
private ConscryptAlpnSslEngine(SSLEngine engine, ByteBufAllocator alloc, List<String> protocols) { super(engine); // Configure the Conscrypt engine to use Netty's buffer allocator. This is a trade-off of memory vs // performance. // // If no allocator is provided, the engine will internally allocate a direct buffer of max packet size in // order to optimize JNI calls (this happens the first time it is provided a non-direct buffer from the // application). // // Alternatively, if an allocator is provided, no internal buffer will be created and direct buffers will be // retrieved from the allocator on-demand. if (USE_BUFFER_ALLOCATOR) { Conscrypt.setBufferAllocator(engine, new BufferAllocatorAdapter(alloc)); } // Set the list of supported ALPN protocols on the engine. Conscrypt.setApplicationProtocols(engine, protocols.toArray(new String[0])); }
private ConscryptAlpnSslEngine(SSLEngine engine, ByteBufAllocator alloc, List<String> protocols) { super(engine); // Configure the Conscrypt engine to use Netty's buffer allocator. This is a trade-off of memory vs // performance. // // If no allocator is provided, the engine will internally allocate a direct buffer of max packet size in // order to optimize JNI calls (this happens the first time it is provided a non-direct buffer from the // application). // // Alternatively, if an allocator is provided, no internal buffer will be created and direct buffers will be // retrieved from the allocator on-demand. if (USE_BUFFER_ALLOCATOR) { Conscrypt.setBufferAllocator(engine, new BufferAllocatorAdapter(alloc)); } // Set the list of supported ALPN protocols on the engine. Conscrypt.setApplicationProtocols(engine, protocols.toArray(new String[protocols.size()])); }
private ConscryptAlpnSslEngine(SSLEngine engine, ByteBufAllocator alloc, List<String> protocols) { super(engine); // Configure the Conscrypt engine to use Netty's buffer allocator. This is a trade-off of memory vs // performance. // // If no allocator is provided, the engine will internally allocate a direct buffer of max packet size in // order to optimize JNI calls (this happens the first time it is provided a non-direct buffer from the // application). // // Alternatively, if an allocator is provided, no internal buffer will be created and direct buffers will be // retrieved from the allocator on-demand. if (USE_BUFFER_ALLOCATOR) { Conscrypt.setBufferAllocator(engine, new BufferAllocatorAdapter(alloc)); } // Set the list of supported ALPN protocols on the engine. Conscrypt.setApplicationProtocols(engine, protocols.toArray(new String[protocols.size()])); }
private ConscryptAlpnSslEngine(SSLEngine engine, ByteBufAllocator alloc, List<String> protocols) { super(engine); // Configure the Conscrypt engine to use Netty's buffer allocator. This is a trade-off of memory vs // performance. // // If no allocator is provided, the engine will internally allocate a direct buffer of max packet size in // order to optimize JNI calls (this happens the first time it is provided a non-direct buffer from the // application). // // Alternatively, if an allocator is provided, no internal buffer will be created and direct buffers will be // retrieved from the allocator on-demand. if (USE_BUFFER_ALLOCATOR) { Conscrypt.setBufferAllocator(engine, new BufferAllocatorAdapter(alloc)); } // Set the list of supported ALPN protocols on the engine. Conscrypt.setApplicationProtocols(engine, protocols.toArray(new String[protocols.size()])); }
private ConscryptAlpnSslEngine(SSLEngine engine, ByteBufAllocator alloc, List<String> protocols) { super(engine); // Configure the Conscrypt engine to use Netty's buffer allocator. This is a trade-off of memory vs // performance. // // If no allocator is provided, the engine will internally allocate a direct buffer of max packet size in // order to optimize JNI calls (this happens the first time it is provided a non-direct buffer from the // application). // // Alternatively, if an allocator is provided, no internal buffer will be created and direct buffers will be // retrieved from the allocator on-demand. if (USE_BUFFER_ALLOCATOR) { Conscrypt.setBufferAllocator(engine, new BufferAllocatorAdapter(alloc)); } // Set the list of supported ALPN protocols on the engine. Conscrypt.setApplicationProtocols(engine, protocols.toArray(new String[protocols.size()])); }
private ConscryptAlpnSslEngine(SSLEngine engine, ByteBufAllocator alloc, List<String> protocols) { super(engine); // Configure the Conscrypt engine to use Netty's buffer allocator. This is a trade-off of memory vs // performance. // // If no allocator is provided, the engine will internally allocate a direct buffer of max packet size in // order to optimize JNI calls (this happens the first time it is provided a non-direct buffer from the // application). // // Alternatively, if an allocator is provided, no internal buffer will be created and direct buffers will be // retrieved from the allocator on-demand. if (USE_BUFFER_ALLOCATOR) { Conscrypt.setBufferAllocator(engine, new BufferAllocatorAdapter(alloc)); } // Set the list of supported ALPN protocols on the engine. Conscrypt.setApplicationProtocols(engine, protocols.toArray(new String[protocols.size()])); }
private ConscryptAlpnSslEngine(SSLEngine engine, ByteBufAllocator alloc, List<String> protocols) { super(engine); // Configure the Conscrypt engine to use Netty's buffer allocator. This is a trade-off of memory vs // performance. // // If no allocator is provided, the engine will internally allocate a direct buffer of max packet size in // order to optimize JNI calls (this happens the first time it is provided a non-direct buffer from the // application). // // Alternatively, if an allocator is provided, no internal buffer will be created and direct buffers will be // retrieved from the allocator on-demand. if (USE_BUFFER_ALLOCATOR) { Conscrypt.setBufferAllocator(engine, new BufferAllocatorAdapter(alloc)); } // Set the list of supported ALPN protocols on the engine. Conscrypt.setApplicationProtocols(engine, protocols.toArray(new String[protocols.size()])); }
private ConscryptAlpnSslEngine(SSLEngine engine, ByteBufAllocator alloc, List<String> protocols) { super(engine); // Configure the Conscrypt engine to use Netty's buffer allocator. This is a trade-off of memory vs // performance. // // If no allocator is provided, the engine will internally allocate a direct buffer of max packet size in // order to optimize JNI calls (this happens the first time it is provided a non-direct buffer from the // application). // // Alternatively, if an allocator is provided, no internal buffer will be created and direct buffers will be // retrieved from the allocator on-demand. if (USE_BUFFER_ALLOCATOR) { Conscrypt.setBufferAllocator(engine, new BufferAllocatorAdapter(alloc)); } // Set the list of supported ALPN protocols on the engine. Conscrypt.setApplicationProtocols(engine, protocols.toArray(new String[0])); }
private ConscryptAlpnSslEngine(SSLEngine engine, ByteBufAllocator alloc, List<String> protocols) { super(engine); // Configure the Conscrypt engine to use Netty's buffer allocator. This is a trade-off of memory vs // performance. // // If no allocator is provided, the engine will internally allocate a direct buffer of max packet size in // order to optimize JNI calls (this happens the first time it is provided a non-direct buffer from the // application). // // Alternatively, if an allocator is provided, no internal buffer will be created and direct buffers will be // retrieved from the allocator on-demand. if (USE_BUFFER_ALLOCATOR) { Conscrypt.setBufferAllocator(engine, new BufferAllocatorAdapter(alloc)); } // Set the list of supported ALPN protocols on the engine. Conscrypt.setApplicationProtocols(engine, protocols.toArray(new String[0])); }
private ConscryptAlpnSslEngine(SSLEngine engine, ByteBufAllocator alloc, List<String> protocols) { super(engine); // Configure the Conscrypt engine to use Netty's buffer allocator. This is a trade-off of memory vs // performance. // // If no allocator is provided, the engine will internally allocate a direct buffer of max packet size in // order to optimize JNI calls (this happens the first time it is provided a non-direct buffer from the // application). // // Alternatively, if an allocator is provided, no internal buffer will be created and direct buffers will be // retrieved from the allocator on-demand. if (USE_BUFFER_ALLOCATOR) { Conscrypt.setBufferAllocator(engine, new BufferAllocatorAdapter(alloc)); } // Set the list of supported ALPN protocols on the engine. Conscrypt.setApplicationProtocols(engine, protocols.toArray(new String[0])); }
private ConscryptAlpnSslEngine(SSLEngine engine, ByteBufAllocator alloc, List<String> protocols) { super(engine); // Configure the Conscrypt engine to use Netty's buffer allocator. This is a trade-off of memory vs // performance. // // If no allocator is provided, the engine will internally allocate a direct buffer of max packet size in // order to optimize JNI calls (this happens the first time it is provided a non-direct buffer from the // application). // // Alternatively, if an allocator is provided, no internal buffer will be created and direct buffers will be // retrieved from the allocator on-demand. if (USE_BUFFER_ALLOCATOR) { Conscrypt.setBufferAllocator(engine, new BufferAllocatorAdapter(alloc)); } // Set the list of supported ALPN protocols on the engine. Conscrypt.setApplicationProtocols(engine, protocols.toArray(new String[0])); }
public ConscryptALPNSelector(SSLEngine sslEngine, List<String> supportedProtocolList) { if (CollectionUtils.isEmpty(supportedProtocolList)) { this.supportedProtocolList = Collections.unmodifiableList(Arrays.asList("h2", "http/1.1")); } else { this.supportedProtocolList = supportedProtocolList; } supportedProtocols = this.supportedProtocolList.toArray(StringUtils.EMPTY_STRING_ARRAY); this.sslEngine = sslEngine; if (sslEngine.getUseClientMode()) { Conscrypt.setApplicationProtocols(sslEngine, supportedProtocols); } else { Conscrypt.setApplicationProtocolSelector(sslEngine, new ConscryptApplicationProtocolSelector()); } }
public ConscryptALPNSelector(SSLEngine sslEngine, List<String> supportedProtocolList) { if (CollectionUtils.isEmpty(supportedProtocolList)) { this.supportedProtocolList = Collections.unmodifiableList(Arrays.asList("h2", "http/1.1")); } else { this.supportedProtocolList = supportedProtocolList; } supportedProtocols = this.supportedProtocolList.toArray(StringUtils.EMPTY_STRING_ARRAY); this.sslEngine = sslEngine; if (sslEngine.getUseClientMode()) { Conscrypt.setApplicationProtocols(sslEngine, supportedProtocols); } else { Conscrypt.setApplicationProtocolSelector(sslEngine, new ConscryptApplicationProtocolSelector()); } }
@Override void applyParameters(final SSLEngine sslEngine, final SSLParameters sslParameters, final String[] appProtocols) { if (Conscrypt.isConscrypt(sslEngine)) { sslEngine.setSSLParameters(sslParameters); Conscrypt.setApplicationProtocols(sslEngine, appProtocols); } else { H2TlsSupport.setApplicationProtocols(sslParameters, appProtocols); sslEngine.setSSLParameters(sslParameters); } }
@Override public void configureTlsExtensions( SSLSocket sslSocket, String hostname, List<Protocol> protocols) { if (Conscrypt.isConscrypt(sslSocket)) { // Enable SNI and session tickets. if (hostname != null) { Conscrypt.setUseSessionTickets(sslSocket, true); Conscrypt.setHostname(sslSocket, hostname); } // Enable ALPN. List<String> names = Platform.alpnProtocolNames(protocols); Conscrypt.setApplicationProtocols(sslSocket, names.toArray(new String[0])); } else { super.configureTlsExtensions(sslSocket, hostname, protocols); } }
@Override public void initialize(final NamedEndpoint endpoint, final SSLEngine sslEngine) { final SSLParameters sslParameters = sslEngine.getSSLParameters(); sslParameters.setProtocols(H2TlsSupport.excludeBlacklistedProtocols(sslParameters.getProtocols())); sslParameters.setCipherSuites(H2TlsSupport.excludeBlacklistedCiphers(sslParameters.getCipherSuites())); H2TlsSupport.setEnableRetransmissions(sslParameters, false); final String[] appProtocols = H2TlsSupport.selectApplicationProtocols(attachment); if (Conscrypt.isConscrypt(sslEngine)) { sslEngine.setSSLParameters(sslParameters); Conscrypt.setApplicationProtocols(sslEngine, appProtocols); } else { H2TlsSupport.setApplicationProtocols(sslParameters, appProtocols); sslEngine.setSSLParameters(sslParameters); } if (initializer != null) { initialize(endpoint, sslEngine); } }