Skip to content
This repository was archived by the owner on Mar 8, 2024. It is now read-only.

ASN1 decoding of grouped extension with all group components OPTIONAL and component with implicit value #243

@luiscpgh

Description

@luiscpgh

Hi,

I encountered an issue encoding a message containing IEs in the "..." extension (sorry, I am not sure what this extension is actually called)...

Decoding works great. Encoding is the problem.

Here is a minimal example:

from pycrate_asn1dir import RRCNR
from binascii import unhexlify, hexlify

# decode
rrc = RRCNR.NR_RRC_Definitions.UE_MRDC_Capability
hexstr = '''a107c058161601c41000000122200402c2340410b003a030a74ed8e7c310000800040202008008'''
unhex = unhexlify(hexstr)
rrc.from_uper(unhexlify(hexstr))
decoded  = rrc()
decodedMsg = rrc.to_asn1()
print(decodedMsg)

# now encode it
en_rrc = RRCNR.NR_RRC_Definitions.UE_MRDC_Capability
en_rrc.from_asn1(decodedMsg) # error:  unknown extension, 'supportedBandCombinationList-v1540 {\n...
en_unhex = en_rrc.to_uper()
en_hex = bytes.hex(en_unhex)

print('encoded {}'.format(en_hex))

In the example above, I think the issue is that the supportedBandCombinationList-v1540 IE is past the "..." extension in the 3GPP spec:

RF-ParametersMRDC ::=                   SEQUENCE {
    supportedBandCombinationList            BandCombinationList                             OPTIONAL,
    appliedFreqBandListFilter               FreqBandList                                    OPTIONAL,
    ...,
    [[
    srs-SwitchingTimeRequested              ENUMERATED {true}                               OPTIONAL,
    supportedBandCombinationList-v1540      BandCombinationList-v1540                       OPTIONAL
    ]],

Any tips with how to tell the encoder that the IE is past the "..." extension?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions