Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance CertificateException message when throw due hostname validation #13381

Merged
merged 3 commits into from Jul 19, 2023

Conversation

normanmaurer
Copy link
Member

Motivation:

It is hard for end-user to understand why the hostname validation failed. Let's try to help them by including the SubjectAlternativeNames if there are any.

Modifications:

  • Wrap the X509ExtendedTrustManager and so be able to catch the CertificateException and add more details if needed
  • Add unit test

Result:

Easier to debug hostname validation problems

Copy link
Member

@idelpivnitskiy idelpivnitskiy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at HostnameChecker.matchDNS impl in JDK11 and found a few more things:

Motivation:

It is hard for end-user to understand why the hostname validation failed. Let's try to help them by including the SubjectAlternativeNames if there are any.

Modifications:

- Wrap the X509ExtendedTrustManager and so be able to catch the CertificateException and add more details if needed
- Add unit test

Result:

Easier to debug hostname validation problems
Copy link
Member

@idelpivnitskiy idelpivnitskiy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@normanmaurer normanmaurer merged commit 22378d8 into 4.1 Jul 19, 2023
14 checks passed
@normanmaurer normanmaurer deleted the cert_exception branch July 19, 2023 17:15
normanmaurer added a commit that referenced this pull request Jul 19, 2023
…on (#13381)

Motivation:

It is hard for end-user to understand why the hostname validation
failed. Let's try to help them by including the SubjectAlternativeNames
if there are any.

Modifications:

- Wrap the X509ExtendedTrustManager and so be able to catch the
CertificateException and add more details if needed
- Add unit test

Result:

Easier to debug hostname validation problems
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants