PrintableString

The ASN.1 PrintableString data type is encoded into a TLV triplet that begins with a Tag byte of 0x13. The following example, from the PKCS #10 Encoded ASN.1 topic, shows how a user common name of TestCN is encoded as a PrintableString type. The object identifier for a common name is 2.5.4.3.


06 03                   ; OBJECT_ID (3 Bytes)
|  55 04 03             ;   2.5.4.3 Common Name (CN)
13 06                   ; PRINTABLE_STRING (6 Bytes)
   54 65 73 74 43 4e    ;   TestCN

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.

Related topics

ASN.1 Type System
DER Encoding of ASN.1 Types

 

 

Show: