How do I change order of RDN elements or control their appearance in X509IssuerName and/or X509SubjectName element?

There is a global variable RDNDescriptorMap in SBXMLSec unit/namespace that controls the order.

For example the original order is:

<ds:X509IssuerName>C=EU, O=EldoS, OU=EldoS 1 EU</ds:X509IssuerName>

But we want to get the same order that .Net framework generates:

<ds:X509IssuerName>OU=EldoS 1 EU, O=EldoS, C=EU</ds:X509IssuerName>

To do this we should add the following line:

C# code

SBXMLSec.Unit.RDNDescriptorMap.CompatibilityMode =
  SBXMLSec.TElXMLRDNCompatibilityMode.DotNET; // default value is TElXMLRDNCompatibilityMode.RFC

Delphi code:

SBXMLSec. RDNDescriptorMap.CompatibilityMode = cmDotNET; // default value is cmRFC

To change descriptor name from “E” to “EMAIL”, use the following code:
RDNDescriptorMap.Add(SB_CERT_OID_EMAIL, "E"); // second value works as an alias for parsing

Ready to get started?

Learn more about SecureBlackbox or download a free trial.

Download Now