OpenSSL "ans1parse" - ASN.1 IA5STRING Field Type

Q

What is ASN.1 IA5STRING field type? How to specify IA5STRING field type in OpenSSL "asn1parse" command?

✍: FYIcenter.com

A

ASN.1 IA5STRING field is a primitive field that can be used to store IA5 (ISO 646) character strings. IA5 character set is generally equivalent to ASCII character set. To use ASN.1 IA5STRING field in OpenSSL "asn1parse" command, you need to remember the following rules:

  • ASN.1 IA5STRING type tag is 0x16.
  • ASN.1 IA5STRING type code for "asn1parse" command is IA5STRING.
  • ASN.1 IA5STRING value literal can be an ASCII string quoted or not quoted of any size. Double quote (") is reserved as the string quotation. (\") can be used to include (") inside the string. For example, (Hello), ("Hello World!") and ("I heard \"Help!\"") are all valid IA5STRING values.
  • ASN.1 IA5STRING value is stored with DER encoding in ASCII format. For example, "ABCD", "1234" and "Hello World!" are stored in DER format as 0x41424344, 0x31323334, and 0x48656c6c6f20576f726c6421.

Here are examples of using IA5STRING with the OpenSSL "asn1parse" command:

C:\Users\fyicenter>\local\openssl\openssl.exe

OpenSSL> asn1parse -genstr IA5STRING:"ABCD" -out ABCD.der
    0:d=0  hl=2 l=   4 prim: IA5STRING         :ABCD

OpenSSL> asn1parse -genstr IA5STRING:"1234" -out 1234.der
    0:d=0  hl=2 l=   4 prim: IA5STRING         :1234

OpenSSL> asn1parse -genstr IA5STRING:"Hello World!" -out Hello.der
    0:d=0  hl=2 l=  12 prim: IA5STRING         :Hello World!

OpenSSL> exit

C:\Users\fyicenter>Bin2Hex.pl ABCD.der
160441424344

C:\Users\fyicenter>Bin2Hex.pl 1234.der test.hex
160431323334

C:\Users\fyicenter>Bin2Hex.pl Hello.der test.hex
160c48656c6c6f20576f726c6421

 

OpenSSL "ans1parse" - ASN.1 OBJECT IDENTIFIER Field Type

OpenSSL "ans1parse" - ASN.1 INTEGER Field Type

OpenSSL "ans1parse" Command

⇑⇑ OpenSSL Tutorials

2016-09-30, 5643👍, 0💬