Repository navigation
NPI otherName SAN entries - #77
Merged
Merged
Conversation
Adds an NPI Subject Alternative Name type: an otherName with type-id 2.16.840.1.113883.4.6 and a UTF8String value holding the 10-digit NPI, as the DirectTrust certificate profiles allow for a verified organization or individual covered entity. - SanType.Npi; profiles and SAN lists accept the "NPI" token, the RA API accepts "npi", and the issuance, external-request and CSR dialogs offer it. - Validation: exactly 10 digits with a Luhn check digit computed over the 80840 prefix (NpiNumber), both server-side in ValidateSanValues and in SanExtensionBuilder. - Encoding via BouncyCastle in SanExtensionBuilder. - Read back by CsrGenerationService.ExtractSubjectAltNames, so renewal, re-key, Similar and CSR generation keep the NPI; the explorer parses the stored "Npi:" entries when re-issuing. - Display: SAN extensions containing an otherName are described from the decoded names (e.g. "Npi:1234567893") instead of the platform formatter; other SANs are shown as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
JoeShook
force-pushed
the
feature/64-npi-othername
branch
from
November 22, 2026 14:28
26c6c7e to
7bf2879
Compare
…al CSRs The SAN type dropdowns in issuance, external requests, the CSR builder and the portal request form now read DNS, URI, Email, IP Address and NPI instead of the enum names. Stored tokens are unchanged. The portal's CSR parser read only DNS and IP SANs, so a subscriber had to retype a URI, email or NPI that was already in the uploaded CSR. It now reads every SAN form the portal can request, including an NPI otherName (2.16.840.1.113883.4.6, UTF8String), and keeps URI values verbatim. Other otherNames are skipped. The CA still validates every value at issuance. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Decisions on the open questions:
New tests: |
JoeShook
marked this pull request as ready for review
November 22, 2026 16:11
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.
Closes #64
What changed
Adds an NPI Subject Alternative Name type: an
otherNamewith type-id2.16.840.1.113883.4.6and aUTF8Stringvalue holding the 10-digit NPI, as the DirectTrust certificate profiles allow for a verified organization or individual covered entity.SanType.Npi(appended to the enum, so existing values keep their numbers). Profiles'SubjectAltNameTypesand SAN lists accept theNPItoken; the RA API (MapSan) acceptsnpi; the portal's SAN type list includesNpi.SanType), with a placeholder and client-side check. Certificate Profiles gets an NPI SAN-type checkbox, and the SAN Lists editor offersNPI.NpiNumberhelper: exactly 10 digits, last digit = Luhn check digit computed over the first nine with the80840prefix. Enforced inIssuanceValidator.ValidateSanValues(server side, all issuance paths) and inSanExtensionBuilder.Build.SanExtensionBuilderwritesotherName ::= SEQUENCE { 2.16.840.1.113883.4.6, [0] EXPLICIT UTF8String }via BouncyCastle.CsrGenerationService.ExtractSubjectAltNamesnow returns NPI entries, so renewal/re-key identity checks, CSR generation and external requests keep them. Issued certs store SANs asNpi:<digits>; the explorer parsesNpi:when seeding renew / re-key / Similar.SubjectAltNameText.Describe. When a SAN extension holds anotherName, it is described from the decoded names (Npi:1234567893,Dns:…,OtherName:<oid>=…for other otherNames), because the platform formatter renders otherName as hex /<unsupported>. SANs without an otherName are formatted exactly as before. The folder-import path (CertificateImportService) uses decoded names when an NPI is present (its byte scan would misread the NPI OID bytes).No database migration is needed:
SubjectAltNameTypesandSanList.Itemsare free text.Testing
dotnet build Sigyll.slnx: succeeded.dotnet test _tests/Sigyll.Signing.Tests: 571 passed, 17 skipped (PKCS Bump the microsoft group with 18 updates #11/SoftHSM), 0 failed.NpiSanTests: check-digit accept/reject cases, length and character rules, validator and token parsing, DER encoding (OID, explicit [0], UTF8String), read-back from a certificate, display text, and that SANs without an otherName keep platform formatting.CsrIssuanceTests: issuance with an NPI SAN (encoded as otherName, stored asDns:…;Npi:…) and rejection of a bad check digit.Open questions
Npi, like the existingIpAddress). Should they showNPIinstead?CsrParserstill only picks up DNS/IP SANs from an uploaded CSR, so an NPI there has to be typed in. Worth extending?🤖 Generated with Claude Code