8000 pycrate 0.7.8 asn1rt.err.ASN1BERDecodeErr: RetrieveNotificationsListResponse.notificationList._item_.otherSignedNotification: missing mandatory component, tbsOtherNotification · Issue #39 · pycrate-org/pycrate · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
pycrate 0.7.8 asn1rt.err.ASN1BERDecodeErr: RetrieveNotificationsListResponse.notificationList._item_.otherSignedNotification: missing mandatory component, tbsOtherNotification #39
Open
@mtb04313

Description

@mtb04313

Hello,
I encountered a ASN1BERDecodeErr error while parsing RetrieveNotificationsListResponse in GSMA SGP.22 v3. The error can also be reproduced in asn1_play (https://amenitypj.in/asn1Play) with other releases of SGP.22

Steps to reproduce:
git clone https://github.com/pycrate-org/pycrate
cd pycrate

tools\pycrate_asn1compile.py -i c:\test\SGP.22-v3.0-1\RSPDefinition.asn c:\test\SGP.22-v3.0-1\PKIX1Implicit88.asn c:\test\SGP.22-v3.0-1\PKIX1Explicit88.asn c:\test\SGP.22-v3.0-1\PEDefinitions.asn -o c:\test\SGP.22-v3.0-1\gsma_sgp22_v3

[proc] [c:\test\SGP.22-v3.0-1\RSPDefinition.asn] module RSPDefinitions (oid: [2, 23, 146, 1, 1, 3]): 210 ASN.1 assignments found
[proc] [c:\test\SGP.22-v3.0-1\PKIX1Implicit88.asn] module PKIX1Implicit88 (oid: [1, 3, 6, 1, 5, 5, 7, 0, 19]): 86 ASN.1 assignments found
[proc] [c:\test\SGP.22-v3.0-1\PKIX1Explicit88.asn] module PKIX1Explicit88 (oid: [1, 3, 6, 1, 5, 5, 7, 0, 18]): 170 ASN.1 assignments found
[proc] [c:\test\SGP.22-v3.0-1\PEDefinitions.asn] module PEDefinitions (oid: [2, 23, 143, 1, 1, 3]): 65 ASN.1 assignments found
--- compilation cycle ---
WNG: PKIX1Explicit88.AlgorithmIdentifier, untagged OPEN / ANY in SEQUENCE with parameters
--- compilation cycle ---
--- compilation cycle ---
--- verifications ---
[proc] ASN.1 modules processed: ['RSPDefinitions', 'PKIX1Implicit88', 'PKIX1Explicit88', 'PEDefinitions']
[proc] ASN.1 objects compiled: 371 types, 0 sets, 156 values
[proc] done

cd c:\test\SGP.22-v3.0-1
bug_pycrate.py

Traceback (most recent call last):
  File "C:\test\SGP.22-v3.0-1\bug_pycrate.py", line 46, in <module>
    main()
  File "C:\test\SGP.22-v3.0-1\bug_pycrate.py", line 43, in main
    decode_retrieveNotificationsList(rsp)     # failed
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\test\SGP.22-v3.0-1\bug_pycrate.py", line 32, in decode_retrieveNotificationsList
    rspObj.from_ber(encodedBytes)
  File "C:\Python312-64\Lib\site-packages\pycrate_asn1rt\asnobj.py", line 1637, in from_ber
    self._from_ber(char, TLV)
  File "C:\Python312-64\Lib\site-packages\pycrate_asn1rt\asnobj.py", line 1621, in _from_ber
    self._decode_ber_cont(char, tlv)
  File "C:\Python312-64\Lib\site-packages\pycrate_asn1rt\asnobj_construct.py", line 507, in _decode_ber_cont
    Cho._from_ber(char, [tlv])
  File "C:\Python312-64\Lib\site-packages\pycrate_asn1rt\asnobj.py", line 1621, in _from_ber
    self._decode_ber_cont(char, tlv)
  File "C:\Python312-64\Lib\site-packages\pycrate_asn1rt\asnobj_construct.py", line 3090, in _decode_ber_cont
    Comp._from_ber(char, [comp_tlv])
  File "C:\Python312-64\Lib\site-packages\pycrate_asn1rt\asnobj.py", line 1621, in _from_ber
    self._decode_ber_cont(char, tlv)
  File "C:\Python312-64\Lib\site-packages\pycrate_asn1rt\asnobj_construct.py", line 507, in _decode_ber_cont
    Cho._from_ber(char, [tlv])
  File "C:\Python312-64\Lib\site-packages\pycrate_asn1rt\asnobj.py", line 1621, in _from_ber
    self._decode_ber_cont(char, tlv)
  File "C:\Python312-64\Lib\site-packages\pycrate_asn1rt\asnobj_construct.py", line 2109, in _decode_ber_cont
    raise(ASN1BERDecodeErr('{0}: missing mandatory component, {1}'\
pycrate_asn1rt.err.ASN1BERDecodeErr: RetrieveNotificationsListResponse.notificationList._item_.otherSignedNotification: missing mandatory component, tbsOtherNotification

Workaround
mv gsma_sgp22_v3.py gsma_sgp22_v3.py.original

cat patchfile.txt | patch gsma_sgp22_v3.py.original -o gsma_sgp22_v3.py
patching file gsma_sgp22_v3.py.original

SGP.22-v3.0-1.zip

bug_pycrate.py
OPEN._decode_ber_cont: RetrieveNotificationsListResponse.notificationList.item.otherSignedNotification.euiccCertificate.tbsCertificate.subjectPublicKeyInfo.algorithm.parameters, DEFINED BY lookup not supported
OPEN._decode_ber_cont: RetrieveNotificationsListResponse.notificationList.item.otherSignedNotification.nextCertInChain.tbsCertificate.subjectPublicKeyInfo.algorithm.parameters, DEFINED BY lookup not supported
('notificationList', [('otherSignedNotification', {'tbsOtherNotification': {'seqNumber': 88, 'profileManagementOperation': (1, 2), 'notificationAddress': 'rsp-eu.simlessly.com', 'iccid': b'\x98D5X#P\x89 F\xf9'}, 'euiccNotificationSignature': b'\x96%\xee\x08\xca/\xbb#X\r:\x8ar\xb3\x92u\x8d\x07\xbc\r\xb1\x80\xfc\x05JC\xb9Jb\n\x00/@-\xddF\xc4R\x011\xd9\xad\x7f\x86\x9a\xc0\xc4\xe0\xb3RR\x97}#^<\x8bY\xeaS\xc1\xa6\xcb\xda', 'euiccCertificate': {'tbsCertificate': {'version': 2, 'serialNumber': 170558324583887545867756765014070074943, 'signature': {'algorithm': (1, 2, 840, 10045, 4, 3, 2)}, 'issuer': ('rdnSequence', [[{'type': (2, 5, 4, 10), 'value': ('_unk_0012', b'GEMALTO SA')}], [{'type': (2, 5, 4, 3), 'value': ('_unk_0012', b'GEMALTO EUM CE PAU')}]]), 'validity': {'notBefore': ('utcTime', ('24', '10', '18', '00', '00', '00', 'Z')), 'notAfter': ('generalTime', ('9999', '12', '31', '23', '59', '59', None, 'Z'))}, 'subject': ('rdnSequence', [[{'type': (2, 5, 4, 10), 'value': ('_unk_0012', b'GEMALTO SA')}], [{'type': (2, 5, 4, 5), 'value': ('_unk_0019', b'89033023429000000000042877717740')}]]), 'subjectPublicKeyInfo': {'algorithm': {'algorithm': (1, 2, 840, 10045, 2, 1), 'parameters': ('_unk_006', b'\x86H\xce=\x03\x01\x07')}, 'subjectPublicKey': (63682112740970372210974134734014972668028160697727024093272042841325483258648144505735997702512153758195846054696949148327976550597242081573041956377326903, 520)}, 'extensions': [{'extnID': (2, 5, 29, 35), 'extnValue': b'0\x16\x80\x14\xdc\xde\x1ai\x1f\xe9\xafu\xdd\xa1\xbb\x92\x991\x8b)\xb1\xd4\x16\xb2'}, {'extnID': (2, 5, 29, 14), 'extnValue': b'\x04\x14U\x87\x8d\x0c`s(|c\x08@Kw\x01k\x06\xda\x97\xd3\xe1'}, {'extnID': (2, 5, 29, 15), 'critical': True, 'extnValue': b'\x03\x02\x00\x80'}, {'extnID': (2, 5, 29, 32), 'critical': True, 'extnValue': b'0\x0b0\t\x06\x07g\x81\x12\x01\x02\x01\x01'}]}, 'signatureAlgorithm': {'algorithm': (1, 2, 840, 10045, 4, 3, 2)}, 'signature': (46638659030562055062499246876961152021973208105263302029900432402007881444271819464240309271966965639844676738751606824403890783783615331851873560067803981149667673890899193, 576)}, 'nextCertInChain': {'tbsCertificate': {'version': 2, 'serialNumber': 51117269164942528510938495864802179922, 'signature': {'algorithm': (1, 2, 840, 10045, 4, 3, 2)}, 'issuer': ('rdnSequence', [[{'type': (2, 5, 4, 10), 'value': ('_unk_0019', b'GSM Association')}], [{'type': (2, 5, 4, 3), 'value': ('_unk_0019', b'GSM Association - RSP2 Root CI1')}]]), 'validity': {'notBefore': ('utcTime', ('17', '05', '25', '00', '00', '00', 'Z')), 'notAfter': ('utcTime', ('47', '05', '24', '23', '59', '59', 'Z'))}, 'subject': ('rdnSequence', [[{'type': (2, 5, 4, 10), 'value': ('_unk_0012', b'GEMALTO SA')}], [{'type': (2, 5, 4, 3), 'value': ('_unk_0012', b'GEMALTO EUM CE PAU')}]]), 'subjectPublicKeyInfo': {'algorithm': {'algorithm': (1, 2, 840, 10045, 2, 1), 'parameters': ('_unk_006', b'\x86H\xce=\x03\x01\x07')}, 'subjectPublicKey': (62970975015704509736436756982654773535893891895072610108722779850295505112900096179276122770808816053645629425062933553633696923378196323456826074187846326, 520)}, 'extensions': [{'extnID': (2, 5, 29, 19), 'critical': True, 'extnValue': b'0\x06\x01\x01\xff\x02\x01\x00'}, {'extnID': (2, 5, 29, 32), 'critical': True, 'extnValue': b'0\x0b0\t\x06\x07g\x81\x12\x01\x02\x01\x02'}, {'extnID': (2, 5, 29, 31), 'extnValue': b'0D0B\xa0@\xa0>\x86<http://gsma-crl.symauth.com/offlineca/gsma-rsp2-root-ci1.crl'}, {'extnID': (2, 5, 29, 15), 'critical': True, 'extnValue': b'\x03\x02\x01\x06'}, {'extnID': (2, 5, 29, 30), 'critical': True, 'extnValue': b'00\xa0.0,\xa4*0(1\x130\x11\x06\x03U\x04\n\x0c\nGEMALTO SA1\x110\x0f\x06\x03U\x04\x05\x13\x0889033023'}, {'extnID': (2, 5, 29, 17), 'extnValue': b'0\x0e\x88\x0c+\x06\x01\x04\x01\x81\xf8\x02\x87j\x04\x03'}, {'extnID': (2, 5, 29, 14), 'extnValue': b'\x04\x14\xdc\xde\x1ai\x1f\xe9\xafu\xdd\xa1\xbb\x92\x991\x8b)\xb1\xd4\x16\xb2'}, {'extnID': (2, 5, 29, 35), 'extnValue': b'0\x16\x80\x14\x817\x0fQ%\xd0\xb1\xd4\x08\xd4\xc3\xb22\xe6\xd2^y[\xeb\xfb'}]}, 'signatureAlgorithm': {'algorithm': (1, 2, 840, 10045, 4, 3, 2)}, 'signature': (182167519629839116493407247127635555255523363602079834021063055882452061239938844376112671634714812980715242391955681601016437387741440392927620049293001931113320140837283, 568)}})])

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0