You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
X509Certificate2Collection.ImportFromPem silently drops a certificate preceded by -----BEGIN #135845
Since 10.0.13 and 11.0 RC 2, X509Certificate2Collection.ImportFromPem leaves out a certificate when the text -----BEGIN comes directly before it on the same line. The other certificates are imported and no exception is thrown. Earlier versions of .NET imported every certificate from the same input.
All of the PEM tests have "-----BEGIN" either as the first characters in the payload, or preceded by a newline. I just scoured RFC 7468 looking for that being a requirement, but it isn't (it's a bit implied by Textual encoding begins with a line comprising "-----BEGIN ", a label, and "-----", suggesting that's the entirety of the line, but the rest of the prose is then a bit more loosey-goosey).
Activity
dotnet-policy-service commentedon Oct 15, 2026
Tagging subscribers to this area: @bartonjs, @vcsjones, @dotnet/area-system-security
See info in area-owners.md if you want to be subscribed.
bartonjs commentedon Oct 15, 2026
All of the PEM tests have "-----BEGIN" either as the first characters in the payload, or preceded by a newline. I just scoured RFC 7468 looking for that being a requirement, but it isn't (it's a bit implied by
Textual encoding begins with a line comprising "-----BEGIN ", a label, and "-----", suggesting that's the entirety of the line, but the rest of the prose is then a bit more loosey-goosey).I'm guessing the fix is just
if (!pemData.Slice(nextHyphen).StartsWith(PostEBPrefix)) { - preebEndIndex = nextHyphen; + preebEndIndex = nextHyphen - 1; goto NextAfterLabel; }(and a test), but I'm not currently in a place where I can try that.