Question
Single value constraints in PER encoding
My understanding is that the following statement in X.691 says that INTEGER types with single value constraints will not encode anything.
13.2.1 If PER-visible constraints restrict the integer value to a single value, then there shall be no addition to the field-list, completing these procedures.
I also understand that nothing is encoded in the ASN.1 like below. and I tested it with asn1tools in python.
Num1 ::= INTEGER (40)
Input: Num1 = 40
Output: b'' (Empty bit string)
When using union for single value constraints, there is no guarantee that the value encoded will always be the same. However, with asn1tools in python, nothing is ever encoded.
Num2 ::= INTEGER (40 | 50 | 60)
Encoding:
Input: Num2 = 40
Output: b'' (Empty bit string)
Input: Num2 = 50
Output: b'' (Empty bit string)
Input: Num2 = 60
Output: b'' (Empty bit string)
Decoding:
Input: b'' (Empty bit string)
Output: 40
I had assumed that it would follow the ENUMERATED type encoding, but I didn't find a basis for that in X.691.
I'm wondering if it's correct that nothing is encoded in the above case, and if it's no longer a single value constraints when using a union.
Any help is appreciated.