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

Restore SSLContextRule tests #573

Merged
merged 1 commit into from
Aug 8, 2022
Merged

Conversation

basil
Copy link
Member

@basil basil commented Aug 7, 2022

When updating this repository to use Java 11 in #495, I took a shortcut and skipped the SSLContextRule tests rather than fixing them. This PR undoes that change, restoring the tests and getting them to work on Java 11.

They had started failing with "Certificate chain is not valid" errors. Looking into this further I found that the first argument to X509v3CertificateBuilder, which is supposed to be the signer/issuer, was actually a subject. This made no sense except for self-signed certificates, but apparently worked on older versions of Java. To fix this I changed the test logic to plumb through the root certificate in any certificate chains. With this object plumbed through, we could call its getSubjectX500Principal() method as recommended in the Bouncy Castle documentation to get the correct first argument to pass when building the X509 certificate. And with that the tests pass again on Java 11.

@basil basil added the test label Aug 7, 2022
Copy link
Contributor

@MarkEWaite MarkEWaite left a comment

Choose a reason for hiding this comment

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

Thanks!

@basil basil merged commit 01dbcfb into jenkinsci:master Aug 8, 2022
@basil basil deleted the SSLContextRule branch August 8, 2022 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants