Repository navigation
Conversation
When BCJSSE's unwrap() fails during handshake (e.g. the trust manager rejects the server cert), the fatal alert is queued for output. unwrap() does not throw: saves the exception (ProvSSLEngine.deferredException) and asks for NEED_WRAP. The next wrap() throws the saved exception and writes nothing. doShutdown() stopped at that first exception, so no alert was sent; a server whose peer kept the TCP socket open then blocked in accept indefinitely. regression since 0.19.2 - reduced shutdown to one doShutdown() call
rejected peer certificate raised a bare "certificate verify failed" on SunJSSE and a synthetic "Socket closed" on BCJSSE - in both cases `SSLSocket#verify_result` stayed 0; while MRI reports the verify error in the message and in verify_result trust manager now throws VerifyCertificateException; which carries the verify error, connect/accept find it in the cause chain of the JSSE exception and set the message and verify_result. BCJSSE holds trust failure back until the next wrap(); when unwrap hits end of stream while the engine still asks for NEED_WRAP, doHandshake now runs that wrap, so real failure is raised instead of "Socket closed".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
expected to address #399
primary fix is the same as in #400 but we have some extra work to e.g. align the reported verify-result (with MRI)