-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support displaying AttributeValue in binary form #88144
Conversation
Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones Issue DetailsIf an This changes the managed decoding to match the behavior of Windows. If an attribute is a binary value, then it is displayed in a hex encoded value, prefixed with a hash. There is special handling if the binary value is an OCTET STRING. If the binary content is an octet string, the hex value displayed is the inner content. The outer OCTET STRING bytes are not displayed.
|
....Cryptography/src/System/Security/Cryptography/X509Certificates/X500DirectoryStringHelper.cs
Show resolved
Hide resolved
src/libraries/System.Security.Cryptography/tests/X509Certificates/X500DistinguishedNameTests.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Security.Cryptography/tests/X509Certificates/X500DistinguishedNameTests.cs
Outdated
Show resolved
Hide resolved
Test failure is being tracked by #88172. Merging. |
If an
X500DistinguishedName
contains an AttributeValue that is not a DirectoryString, the managed decoder will currently throw, catch the error, and return an empty string.This changes the managed decoding to match the behavior of Windows. If an attribute is a binary value, then it is displayed in a hex encoded value, prefixed with a hash.
There is special handling if the binary value is an OCTET STRING. If the binary content is an octet string, the hex value displayed is the inner content. The outer OCTET STRING bytes are not displayed.
Fixes #88037.
Note: This only changes displaying binary content. Handling the reverse, parsing the strings like
new X500DistinguishedName("CN=#1234")
will be a separate pull request. That will be a breaking change on non-Windows, and we may decide not to take it. This pull request is not a breaking change and simply unblocks a scenario.