Use international characters in certificates
You should take extra care when generating certificates with fields that contain international characters. This is not only a matter of correct character encoding. You should provide the correct ASN.1 tag ID to the component to ensure that the fields are encoded properly.
Suppose you want the Locality field of your certificate's Subject to be localized to your state language which implies use of international characters (let's say, you want to set it to 'A Coruna'). In this case you need to explicitly use UTF8 encoding throughout:
The same applies to any other Subject or Issuer field.
cert.SubjectRDN.Add( SB_CERT_OID_LOCALITY, SBStrUtils.Unit.StrToUTF8("A Coruna"), // encoding the string in UTF8 SBASN1Tree.Unit.SB_ASN1_UTF8STRING // specifying the relevant ASN.1 tag );
If a particular entry does not contain international characters, it is safe to use SBASN1Tree.Unit.SB_ASN1_PRINTABLESTRING tag for it. However, SBASN1Tree.Unit.SB_ASN1_UTF8STRING will also work.