BMPString

The ASN.1 BMPString data type, called a UNICODE_STRING in the Certificate Enrollment API, is encoded into a TLV triplet that begins with a Tag byte of 0x1E. The following example, adapted from the CMC Encoded ASN.1 topic, shows the encoding for a TemplateName extension. The name can be specified by using the IX509ExtensionTemplateName interface. The object identifier for the extension is 1.3.6.1.4.1.311.13.2.1.

06 0a                              ; OBJECT_ID (a Bytes)
|  2b 06 01 04 01 82 37 0d  02 01  ;   1.3.6.1.4.1.311.13.2.1 
31 34                              ; SET (34 Bytes)
   30 32                           ; SEQUENCE (32 Bytes)
      1e 26                        ; UNICODE_STRING (26 Bytes)
      |  00 43 00 65 00 72 00 74   ;   .C.e.r.t
      |  00 69 00 66 00 69 00 63   ;   .i.f.i.c
      |  00 61 00 74 00 65 00 54   ;   .a.t.e.T
      |  00 65 00 6d 00 70 00 6c   ;   .e.m.p.l
      |  00 61 00 74 00 65         ;   .a.t.e
      1e 08                        ; UNICODE_STRING (8 Bytes)
         00 55 00 73 00 65 00 72   ;   .U.s.e.r

If the string contains fewer than 128 bytes, the Length field of the TLV triplet requires only one byte to specify the content length. If the string is more than 127 bytes, bit 7 of the Length field is set to 1 and bits 6 through 0 specify the number of additional bytes used to identify the content length. For more information, see Encoded Length and Value Bytes.

ASN.1 Type System

DER Encoding of ASN.1 Types