Skip to content

Copy certificate subject names exactly when re-issuing certificates - #8627

Draft
Max (maxtropets) wants to merge 5 commits into
mainfrom
maxtropets-cert-subject-name-der
Draft

Max (maxtropets) wants to merge 5 commits into
mainfrom
maxtropets-cert-subject-name-der

Conversation

@maxtropets

@maxtropets Max (maxtropets) commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Service certificate renewal, recovery and previous-identity endorsements rebuilt the subject name from the existing certificate's printed form, which parse_name() cannot read back once there is more than one RDN (", " separator, escaped / and +, reordering). They now copy the subject's DER bytes instead, as is already done for the issuer name.

Before

service_subject_name = "CN=CCF Service,O=CCF User"
start:    OK
renew:    throws  (" O" is not an attribute type)
recover:  throws

After

start:    OK
renew:    OK, subject byte-identical to the original
recover:  OK, subject byte-identical to the original

Single-RDN subjects such as the default CN=CCF Service already round-tripped, so their certificates are unchanged byte for byte; mixed-version networks are unaffected.

New API: Verifier::subject_der(), DER overloads of ECKeyPair::create_csr() and self_sign() (pure virtuals, so out-of-tree implementers must add them). get_subject_name() is kept.

Tests: unit round trip of O=Last / CN=Smith, John / OU=https://a.b / OU=x+y through self-signed, renewed and endorsed certificates, plus rejection of malformed DER; e2e renewal and three recoveries with a two-RDN subject.

@maxtropets Max (maxtropets) self-assigned this Oct 23, 2026
Max (maxtropets) and others added 4 commits October 23, 2026 16:09
Service certificate renewal, disaster recovery and receipt endorsements
of previous service identities re-issued a certificate from the printed
subject name of the existing certificate, which the subject name parser
cannot read back once it has more than one RDN, or contains characters
that printing escapes. Transport the subject as its DER encoding instead.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…overload

Its only production caller now passes the subject as DER; the two tests
using it move to the valid_from/valid_to overload.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@maxtropets
Max (maxtropets) force-pushed the maxtropets-cert-subject-name-der branch from 9ee053a to e34bcb4 Compare October 23, 2026 15:12
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

1 participant