You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The text was updated successfully, but these errors were encountered:
andpopov
changed the title
emi-constrained integer encoding is incorrectly works
Semi-constrained integer encoding is incorrectly working
Jan 14, 2022
andpopov
changed the title
Semi-constrained integer encoding is incorrectly working
PER-encoding issue: Semi-constrained integer encoding is incorrectly working
Jan 14, 2022
Hi,
I seem that semi-constrained integer PER-encoding is working incorrectly:
asn.1 description is:
HelloWorld DEFINITIONS ::= BEGIN
Message ::= SEQUENCE {
n1 INTEGER(5..MAX)
}
END
Input is: {'n1': 8}
Encoding result is: 0x0108
But expected value is: 0x0103
I understand that value should be encoded as: (8 - 5)
It means: (value - lower boundary)
Code snipped is here:
from future import print_function
from binascii import hexlify
import asn1tools
SPECIFICATION = '''
HelloWorld DEFINITIONS ::= BEGIN
Message ::= SEQUENCE {
n1 INTEGER(5..MAX)
}
END'''
hello_world = asn1tools.compile_string(SPECIFICATION, 'per')
message = {'n1': 8}
encoded = hello_world.encode('Message', message)
decoded = hello_world.decode('Message', encoded)
print('Encoded:', hexlify(encoded).decode('ascii'))
The text was updated successfully, but these errors were encountered: