Class AbstractClientTlsStrategy
java.lang.Object
org.apache.hc.client5.http.ssl.AbstractClientTlsStrategy
- All Implemented Interfaces:
TlsSocketStrategy, org.apache.hc.core5.http.nio.ssl.TlsStrategy
- Direct Known Subclasses:
DefaultClientTlsStrategy
@Contract(threading=STATELESS)
abstract class AbstractClientTlsStrategy
extends Object
implements org.apache.hc.core5.http.nio.ssl.TlsStrategy, TlsSocketStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final HostnameVerificationPolicyprivate final HostnameVerifierprivate static final org.slf4j.Loggerprivate final org.apache.hc.core5.reactor.ssl.SSLBufferModeprivate final SSLContextprivate final String[]private final String[] -
Constructor Summary
ConstructorsConstructorDescriptionAbstractClientTlsStrategy(SSLContext sslContext, String[] supportedProtocols, String[] supportedCipherSuites, org.apache.hc.core5.reactor.ssl.SSLBufferMode sslBufferManagement, HostnameVerificationPolicy hostnameVerificationPolicy, HostnameVerifier hostnameVerifier) -
Method Summary
Modifier and TypeMethodDescription(package private) abstract voidapplyParameters(SSLEngine sslEngine, SSLParameters sslParameters, String[] appProtocols) (package private) abstract org.apache.hc.core5.reactor.ssl.TlsDetailscreateTlsDetails(SSLEngine sslEngine) private voidexecuteHandshake(SSLSocket upgradedSocket, String target, Object attachment) protected voidinitializeEngine(SSLEngine sslEngine) protected voidinitializeSocket(SSLSocket socket) (package private) StringtoEscapedString(X500Principal principal) Converts an X500Principal to a cleaned string by escaping control characters.upgrade(Socket socket, String target, int port, Object attachment, org.apache.hc.core5.http.protocol.HttpContext context) Upgrades the given plain socket and executes the TLS handshake over it.booleanupgrade(org.apache.hc.core5.reactor.ssl.TransportSecurityLayer tlsSession, org.apache.hc.core5.http.HttpHost host, SocketAddress localAddress, SocketAddress remoteAddress, Object attachment, org.apache.hc.core5.util.Timeout handshakeTimeout) Deprecated.voidupgrade(org.apache.hc.core5.reactor.ssl.TransportSecurityLayer tlsSession, org.apache.hc.core5.net.NamedEndpoint endpoint, Object attachment, org.apache.hc.core5.util.Timeout handshakeTimeout, org.apache.hc.core5.concurrent.FutureCallback<org.apache.hc.core5.reactor.ssl.TransportSecurityLayer> callback) protected voidverifySession(String hostname, SSLSession sslsession) (package private) voidverifySession(String hostname, SSLSession sslsession, HostnameVerifier hostnameVerifier)
-
Field Details
-
LOG
private static final org.slf4j.Logger LOG -
sslContext
-
supportedProtocols
-
supportedCipherSuites
-
sslBufferManagement
private final org.apache.hc.core5.reactor.ssl.SSLBufferMode sslBufferManagement -
hostnameVerificationPolicy
-
hostnameVerifier
-
-
Constructor Details
-
AbstractClientTlsStrategy
AbstractClientTlsStrategy(SSLContext sslContext, String[] supportedProtocols, String[] supportedCipherSuites, org.apache.hc.core5.reactor.ssl.SSLBufferMode sslBufferManagement, HostnameVerificationPolicy hostnameVerificationPolicy, HostnameVerifier hostnameVerifier)
-
-
Method Details
-
upgrade
@Deprecated public boolean upgrade(org.apache.hc.core5.reactor.ssl.TransportSecurityLayer tlsSession, org.apache.hc.core5.http.HttpHost host, SocketAddress localAddress, SocketAddress remoteAddress, Object attachment, org.apache.hc.core5.util.Timeout handshakeTimeout) - Specified by:
upgradein interfaceorg.apache.hc.core5.http.nio.ssl.TlsStrategy
-
upgrade
public void upgrade(org.apache.hc.core5.reactor.ssl.TransportSecurityLayer tlsSession, org.apache.hc.core5.net.NamedEndpoint endpoint, Object attachment, org.apache.hc.core5.util.Timeout handshakeTimeout, org.apache.hc.core5.concurrent.FutureCallback<org.apache.hc.core5.reactor.ssl.TransportSecurityLayer> callback) - Specified by:
upgradein interfaceorg.apache.hc.core5.http.nio.ssl.TlsStrategy
-
applyParameters
abstract void applyParameters(SSLEngine sslEngine, SSLParameters sslParameters, String[] appProtocols) -
createTlsDetails
-
initializeEngine
-
initializeSocket
-
verifySession
- Throws:
SSLException
-
upgrade
public SSLSocket upgrade(Socket socket, String target, int port, Object attachment, org.apache.hc.core5.http.protocol.HttpContext context) throws IOException Description copied from interface:TlsSocketStrategyUpgrades the given plain socket and executes the TLS handshake over it.- Specified by:
upgradein interfaceTlsSocketStrategy- Parameters:
socket- the existing plain sockettarget- the name of the target host.port- the port to connect to on the target host.attachment- connect request attachment.context- the actual HTTP context.- Returns:
- socket upgraded to TLS.
- Throws:
IOException
-
executeHandshake
private void executeHandshake(SSLSocket upgradedSocket, String target, Object attachment) throws IOException - Throws:
IOException
-
verifySession
void verifySession(String hostname, SSLSession sslsession, HostnameVerifier hostnameVerifier) throws SSLException - Throws:
SSLException
-
toEscapedString
Converts an X500Principal to a cleaned string by escaping control characters.This method processes the RFC2253 format of the X500Principal and escapes any ISO control characters to avoid issues in logging or other outputs. Control characters are replaced with their escaped hexadecimal representation.
Note: For testing purposes, this method is package-private to allow access within the same package. This allows tests to verify the correct behavior of the escaping process.
- Parameters:
principal- the X500Principal to escape- Returns:
- the escaped string representation of the X500Principal
-
upgrade(TransportSecurityLayer, NamedEndpoint, Object, Timeout, FutureCallback)