Skip to content

SSLStream AuthenticateAsServerAsync with skipped intermediate certificates on Linux #114876

Closed Answered by bartonjs
pg94au asked this question in Q&A
Discussion options

You must be logged in to vote

On Linux, at least, you can force the longer path to be involved by bypassing your system trust entirely:

SslCertificateTrust trust = SslCertificateTrust.CreateForX509Collection(
    new X509Certificate2Collection() { aaaCertificateServicesRoot });

SslStreamCertificateContext certContext = SslStreamCertificateContext.Create(
    serverCert,
    collectionThatIncludesYourIntermediates,
    trust: trust);

// and then use certContext instead of serverCert when doing AuthenticateAsServer

By controlling the list of trusted roots via the optional SslCertificateTrust parameter you prevent the shorter chain from counting as trusted, and a longer trusted chain will be preferred over a shorter un…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by pg94au
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants