P1sec / pycrate

A Python library to ease the development of encoders and decoders for various protocols and file formats; contains ASN.1 and CSN.1 compilers.
GNU Lesser General Public License v2.1
382 stars 132 forks source link

Include space and tilde in visible string range #214

Closed fearless-taco closed 1 year ago

fearless-taco commented 1 year ago

The VisibleString implementation should include the space and tilde characters.

Reference page 74 of the standard: Rec. ITU-T X.680 (02/2021) Here the definition of VisibleString includes the following: "6 + SPACE"

Definition of VisibleString: "The ASN.1 VisibleString type supports a subset of ASCII characters that does not include control characters."

See clause 6.3 and 6.4 of the ISO ASCII standard to see the definition of Control Characters, Character SPACE, and Graphic Characters (which includes ~)

An example is found in the open source asn1c compiler's implementation of VisibleString.c which includes these characters (Line 76):

if(*buf < 0x20 || *buf > 0x7e)

Where Hex20 (space) and Hex7e (~) are included.

p1-bmu commented 1 year ago

Thanks for the fix