Skip to content

Conversation

@danegsta
Copy link
Member

@danegsta danegsta commented Nov 6, 2025

Add Subject Key Identifier and Authority Key Identifier extensions to the generated dev cert

Add Subject Key Identifier and Authority Key Identifier extensions to the dev cert

Description

Adds the Subject Key Identifier (SKID) and Authority Key Identifier (AKID) extensions to the dev cert to resolve issues with OpenSSL. Additionally increases the certificate version from 4 to 5 to ensure the certificate will be refreshed after a user updates.

OpenSSL uses the SKID and AKID extensions to identify the correct trust chain for a private key (even for a single trusted root certificate like the dev cert). If multiple certificates have the same SKID (or don't have an SKID value) and share the same subject, then the incorrect public certificate may be selected to verify the key, resulting in OpenSSL verification failures.

Fixes #64261

@github-actions github-actions bot added the needs-area-label Used by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically label Nov 6, 2025
@danegsta
Copy link
Member Author

danegsta commented Nov 6, 2025

Example certificate extensions with this change:

X509v3 extensions:
    X509v3 Basic Constraints: critical
        CA:FALSE
    X509v3 Key Usage: critical
        Digital Signature, Key Encipherment
    X509v3 Extended Key Usage: critical
        TLS Web Server Authentication
    X509v3 Subject Alternative Name: critical
        DNS:localhost, DNS:*.dev.localhost, DNS:*.dev.internal, DNS:host.docker.internal, DNS:host.containers.internal
    1.3.6.1.4.1.311.84.1.1:
        .
    X509v3 Subject Key Identifier:
        DC:33:2D:DE:22:DF:46:46:9C:B4:8B:98:73:44:55:44:57:AA:2D:22
    X509v3 Authority Key Identifier:
        DC:33:2D:DE:22:DF:46:46:9C:B4:8B:98:73:44:55:44:57:AA:2D:22

Comment on lines +23 to +24
internal const int CurrentAspNetCoreCertificateVersion = 5;
internal const int CurrentMinimumAspNetCoreCertificateVersion = 5;
Copy link
Member

Choose a reason for hiding this comment

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

Just to state this out loud so we're all clear, I believe this means that after getting this change in a patch on a dev machine, ASP.NET Core apps will now require version 5 of the cert to be present. However it won't be created/installed until something forces the SDK first-run experience to run (e.g. running a dotnet command) or dotnet dev-certs https is run explicitly. I think this is what we want TBC, but want to ensure we're all on the same page.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances ASP.NET Core's HTTPS development certificate generation by adding Subject Key Identifier (SKI) and Authority Key Identifier (AKI) extensions to self-signed certificates, bringing them into compliance with RFC 5280 recommendations. The certificate version is bumped from 4 to 5 to reflect this structural change.

Key changes:

  • Adds SKI and AKI extensions to generated self-signed certificates per RFC 5280 sections 4.2.1.2 and 4.2.1.1
  • Increments certificate version constants from 4 to 5
  • Minor whitespace cleanup

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@DamianEdwards DamianEdwards added feature-devcerts area-commandlinetools Includes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI and removed needs-area-label Used by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically labels Nov 6, 2025
Copy link
Member

@bartonjs bartonjs left a comment

Choose a reason for hiding this comment

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

Tests are always welcome, but the technical change LGTM.

@danegsta danegsta merged commit 90b3332 into dotnet:main Nov 7, 2025
30 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the 11.0-preview1 milestone Nov 7, 2025
@danegsta
Copy link
Member Author

danegsta commented Nov 7, 2025

/backport to release/10.0

@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

Started backporting to release/10.0 (link to workflow run)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-commandlinetools Includes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI feature-devcerts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ASP.NET Core HTTPS dev cert should set the SKI and AKI extensions to avoid issues with OpenSSL

4 participants