Skip to content

Conversation

NickCraver
Copy link
Collaborator

Further hardening following #2665. This is an additional check to match the .NET implementation for TLS cert checks so that we don't treat a cert flagged as non-TLS-server effectively. This ensures that a certificate either doesn't have OIDs here (valid, backwards compatible) or has the server-certificate OID indicating it's valid for consumption over TLS for us.

Cheers @bartonjs for the report and info here.

This is an additional check to match the .NET implementation for TLS cert checks so that we don't treat a cert flagged as non-TLS-server effectively. This ensures that a certificate either doesn't have OIDs here (valid, backwards compatible) or has the server-certificate OID indicating it's valid for consumption over TLS for us.
@NickCraver NickCraver requested a review from philon-msft March 12, 2024 14:47
Copy link
Collaborator

@philon-msft philon-msft left a comment

Choose a reason for hiding this comment

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

Tests successfully on Azure Redis cache

@NickCraver NickCraver merged commit 2f69707 into main Mar 12, 2024
@NickCraver NickCraver deleted the craver/tls-trusted-issuer-eku branch March 12, 2024 21:54
};
}

private static readonly Oid _serverAuthOid = new Oid("1.3.6.1.5.5.7.3.1", "1.3.6.1.5.5.7.3.1");
Copy link
Contributor

Choose a reason for hiding this comment

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

Just wondering why not the friendly name parameter is something like serverAuth..? Or else using the single parameter constructor?

Copy link
Collaborator

@mgravell mgravell Jul 29, 2025

Choose a reason for hiding this comment

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

Good question; in my local testing, the single .ctor usage gives the FriendlyName of "TLS Web Server Authentication" which is perhaps a little confusing since we're not really connection to a "web server", so perhaps new Oid("1.3.6.1.5.5.7.3.1", "TLS Server Authentication"); might be more sensible. Thoughts? @NickCraver also?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I...didn't know that was a thing... Either sounds good here - cheers for the TIL!

Choose a reason for hiding this comment

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

Mainly "because no one will look at the friendly name". The single param ctor causes the friendly name to be looked up, and Windows XP through Win 8.1 sometimes caused that to kick off a lookup over to the domain controller... so in the libraries we always use the two parameter version when the Oid instance won't be seen outside the library.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Excellent context, thanks. I don't know if there's anything to actually "fix" here, but that's some great learnin'

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.

6 participants