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

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

For example if 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 the .NET framework generates, below,

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

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 the descriptor name from “E” to “EMAIL”, use the following code:

RDNDescriptorMap.ClearOID(SB_CERT_OID_EMAIL);
RDNDescriptorMap.Add(SB_CERT_OID_EMAIL, "EMAIL");
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