dotnet / dotnet-api-docs

.NET API reference documentation (.NET 5+, .NET Core, .NET Framework)
https://docs.microsoft.com/dotnet/api/
Other
735 stars 1.57k forks source link

X509Certificate2 constructor remarks on acceptable data formats are incorrect #10436

Closed atykhyy closed 2 weeks ago

atykhyy commented 1 month ago

Type of issue

Missing information

Description

[Enter feedback here] Constructors which take byte arrays or byte spans accept base64-encoded data on Windows, but not on Linux. This is a known issue in dotnet: https://github.com/dotnet/runtime/issues/47005 Documentation ought to reflect this, so people don't waste their time chasing down long closed issues when their code throws an exception.

Page URL

https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.x509certificates.x509certificate2.-ctor?view=net-8.0

Content source URL

https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System.Security.Cryptography.X509Certificates/X509Certificate2.xml

Document Version Independent Id

b788c84c-ff5b-eb91-fee1-c09098d58696

Article author

@dotnet-bot

dotnet-policy-service[bot] commented 1 month ago

Tagging subscribers to this area: @dotnet/area-system-security, @vcsjones

bartonjs commented 1 month ago

Unless I'm missing something, the documentation doesn't say that base64 will work, which means there's not an obvious place to say that it sometimes won't.

FWIW, these constructors are all [Obsolte] in .NET 9 and beyond, and the replacement methods do not accept base64 on any OS.

bartonjs commented 1 month ago

Ah, I see, some of the overloads mention it, some don't. And when they say base64 they clearly meant PEM.

So, OK, the docs do need a bit of cleanup here.