Package org.microproxy
Enum Class ProxyFailure.TlsFailed.Reason
- All Implemented Interfaces:
Serializable,Comparable<ProxyFailure.TlsFailed.Reason>,Constable
- Enclosing class:
ProxyFailure.TlsFailed
Why a TLS handshake failed, read from the exception's cause chain: the certificate checks
first, then an alert from the peer, a timeout, or anything else.
code() is the
snake_case name the access log's %UPSTREAM_TRANSPORT_FAILURE_REASON% starts with.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe peer ended the handshake with an alert (ProxyFailure.TlsFailed.alert()names it).The certificate (or one in its chain) has expired.The certificate (or one in its chain) is not valid yet.The certificate was revoked: a CRL or an OCSP response said so.The chain does not lead to a trusted anchor, or failed another validation check.The connection was reset (or failed otherwise) before the proxy could send its ClientHello: the handshake's first write failed (ClientHelloNotSentExceptionin the cause chain).The peer closed or reset the connection during the handshake, after the proxy's ClientHello, without sending an alert: the JDK's"Remote host terminated the handshake", a"Connection reset", anEOFException.The certificate is trusted, but not valid for the host name it was checked against.Anything else: no common protocol version or cipher suite, ...Revocation checking was required, but no CRL or OCSP response could tell.The handshake did not finish within the handshake timeout. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringThe description of the alert the peer ended a handshake with, as the JDK reports it:"Received fatal alert: unrecognized_name", or"Received handshake warning: ..."for a warning it does not accept during a handshake.code()Returns the reason's name in lower case:certificate_revoked, ....Classifies a failed handshake by its exception's cause chain.Returns the enum constant of this class with the specified name.static ProxyFailure.TlsFailed.Reason[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
CERTIFICATE_EXPIRED
The certificate (or one in its chain) has expired. -
CERTIFICATE_NOT_YET_VALID
The certificate (or one in its chain) is not valid yet. -
CERTIFICATE_REVOKED
The certificate was revoked: a CRL or an OCSP response said so. -
REVOCATION_STATUS_UNKNOWN
Revocation checking was required, but no CRL or OCSP response could tell. -
CERTIFICATE_UNTRUSTED
The chain does not lead to a trusted anchor, or failed another validation check. -
HOSTNAME_MISMATCH
The certificate is trusted, but not valid for the host name it was checked against. -
ALERT_RECEIVED
The peer ended the handshake with an alert (ProxyFailure.TlsFailed.alert()names it). -
TIMEOUT
The handshake did not finish within the handshake timeout. -
CLOSED_BEFORE_CLIENT_HELLO
The connection was reset (or failed otherwise) before the proxy could send its ClientHello: the handshake's first write failed (ClientHelloNotSentExceptionin the cause chain). Through a chained proxy, the proxy (or the server behind it) ended the tunnel right after answering theCONNECT. A connection that was only closed, not reset, still takes the ClientHello, and isCLOSED_DURING_HANDSHAKE. -
CLOSED_DURING_HANDSHAKE
The peer closed or reset the connection during the handshake, after the proxy's ClientHello, without sending an alert: the JDK's"Remote host terminated the handshake", a"Connection reset", anEOFException. Through a chained proxy, the chained proxy and the server behind it cannot be told apart: the proxy relays the server's end of the connection. -
OTHER
Anything else: no common protocol version or cipher suite, ...
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
code
Returns the reason's name in lower case:certificate_revoked, ....- Returns:
- the reason's name in lower case:
certificate_revoked, ...
-
of
Classifies a failed handshake by its exception's cause chain. ACertPathValidatorExceptionwith aCertPathValidatorException.BasicReason, aCertificateExpiredException,CertificateNotYetValidExceptionorCertificateRevokedExceptionanywhere in it says what was wrong with the certificate (the innermost specific one wins); any other certificate path failure means it is not trusted; a host name check that failed says so in its message (the JDK's"No subject alternative ... matching ..."); and the JDK reports an alert from the peer as"Received fatal alert: <description>". A timeout comes next; then a connection the peer ended without an alert: anEOFException, a reset or broken pipe, or the JDK's"Remote host terminated the handshake"(CLOSED_BEFORE_CLIENT_HELLOwhen the ClientHello could not be sent, elseCLOSED_DURING_HANDSHAKE). A socket the proxy closed itself ("Socket closed") is none of these.- Parameters:
failure- the handshake's exception, or null- Returns:
- the reason,
OTHERwhen none is recognized
-
alertOf
The description of the alert the peer ended a handshake with, as the JDK reports it:"Received fatal alert: unrecognized_name", or"Received handshake warning: ..."for a warning it does not accept during a handshake.- Parameters:
failure- the handshake's exception, or null- Returns:
- the alert's description, such as
"unrecognized_name", or null
-