To write a value in a distinguished name that includes the
semicolon (';' U+003B) or equals sign ('=' U+003D),
enclose the string in single quotes (apostrophe "'" U+0027)
and use the backslash ('\' U+005C) to escape the special characters
";", "=", "'" and "\".
| Input | Output |
|---|---|
\; | ; |
\= | = |
\' | ' (single quote) |
\\ | \ (backslash) |
As an extreme example, to form a DN with organizationalUnit value
This=\E'asy;
i.e. the 12-byte string beginning with "T" and ending with ";"
(0x)54 68 69 73 3D 5C 45 27 61 73 79 3B
Specify this in the DN string as OU='This\=\\E\'asy\;'.
In VB,
strDN = "CN=My User;O=Test Org;OU='This\=\\E\'asy\;';C=AU"
In C, you need to double-escape the backslash character:
strDN = "CN=My User;O=Test Org;OU='This\\=\\\\E\\'asy\\;';C=AU";
In C#, use a verbatim string literal:
strDN = @"CN=My User;O=Test Org;OU='This\=\\E\'asy\;';C=AU";