Allow multiple Certificates with the same SubjectDN in the store#198
Merged
headius merged 1 commit intojruby:masterfrom May 15, 2020
Merged
Conversation
headius
approved these changes
Apr 8, 2020
kares
reviewed
Jun 6, 2020
Contributor
Author
|
The insert after the same-named cert is done because of the way getFirstIssuer works. It finds the first certificate with a matching subject. Then it starts from that index to look for a real match. As soon as the subject does not match, it returns. That implies that certificates in the store must be ordered by subject if multiple certificates with the same subject exist. |
kares
added a commit
that referenced
this pull request
Oct 25, 2021
an attempt to have a test for the changes from #198
Member
|
the store updates presented in the PR are reverted in 0.11.0 - there's 2 reasons for that:
the cert check part is staying and as noted in the desc - there's similar code in OpenSSL itself. also tried to add a test for the same-subject in store behavior: 2950531 presented here, however it would have been better to have an explicit test in the PR |
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.
Description
The current implementation of OpenSSL::X509::Store in jruby-openssl does not allow multiple X509Certificates with the same SubjectDN (see Certificate.java#L57). This differs from the C implementation. This may be tested by adding two certificates with the same SubjectDN to a OpenSSL::X509::Store and executing
verifyon certificate signed by one of them. It will work in CRuby and will not work in JRuby depending on the order the certificates are added.Changes
The
matchesmethod of Certificate was updated to compare on hashCode().Because getFirstIssuer() expects a grouping based on SubjectX500Principal of the certificate objects in the store, this was implemented, too.
How this was tested
I tested if this change will allow the usage of multiple certificates with the same subjectdn on windows and linux. More tests are probably necessary.