Repository navigation
Fix(CertBuildUtils): Keep The RDN Order When Copying Names Into A CertTemplate - #84
Open
misiektoja wants to merge 3 commits into
Open
misiektoja wants to merge 3 commits into
misiektoja wants to merge 3 commits into
Conversation
…ate without a text round trip
This was referenced Oct 28, 2026
…e is not shared with the template
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
prepare_cert_templateandprepare_cert_template_from_csrnow copy the issuer and subjectNameobjects instead of converting them to an OpenSSL-style string and back. ANamepassed by the caller is copied too, so changing the template does not change the source.Motivation and Context
get_openssl_name_notationwrites the RDNs in DER order, butparse_common_name_from_strreads the string as RFC 4514, which starts with the last RDN. The round trip reverses a multi-RDN name such asC=DE,O=Example,CN=Issuing CA, splits multi-valued RDNs and changes the string types. An rr built from such a certificate then names no certificate (RFC 9483 Section 4.2) and the CA answersbadCertId.How Has This Been Tested?
New unit tests compare the name DER for multi-RDN certificates, CSRs and an rr built from such a certificate. Another test changes the template issuer and checks that the
Namepassed in stays unchanged. These fail onmainand pass with this change. A last test checks that changing the template does not change the certificate. It passes onmaintoo, becausemainbuilt new names from the text. Other unit test results matchmain. Python 3.15 with pytest 9.2.