Project

General

Profile

Actions

Bug #6121

closed

pysim: aram_store_ref_ar_do with --pkg-ref fails

Added by lynxis 7 months ago. Updated 5 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
07/29/2023
Due date:
% Done:

100%

Spec Reference:

Description

Version: git/master/6c5c3f8b2b49a56b6204be83ded918bec0c5826f
Simcard: SysmocomSJA2

unauthenticated (no call to verify_adm)

pySIM-shell (MF)> set debug true
debug - was: False
now: True
pySIM-shell (MF)> select ADF.ARA-M
"" 
pySIM-shell (MF/ADF.ARA-M)> aram_store_ref_ar_do --aid ffffffffffff --device-app-id 550F1A164CCD48D27A5EA3B765957493CD830171 --android-permissions 0000000000000001 --pkg-ref eu.fe80.cn.carrier
Traceback (most recent call last):
  File "/home/lynxis/.local/share/virtualenvs/pysim-C216Z-pe/lib/python3.11/site-packages/cmd2/cmd2.py", line 2399, in onecmd_plus_hooks
    stop = self.onecmd(statement, add_to_history=add_to_history)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lynxis/.local/share/virtualenvs/pysim-C216Z-pe/lib/python3.11/site-packages/cmd2/cmd2.py", line 2852, in onecmd
    stop = func(statement)
           ^^^^^^^^^^^^^^^
  File "/home/lynxis/.local/share/virtualenvs/pysim-C216Z-pe/lib/python3.11/site-packages/cmd2/decorators.py", line 382, in cmd_wrapper
    return func(*args_list, **kwargs)  # type: ignore[call-arg]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/ara_m.py", line 376, in do_aram_store_ref_ar_do
    res_do = ADF_ARAM.store_data(self._cmd.card._scc._tp, csrado)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/ara_m.py", line 289, in store_data
    return ADF_ARAM.xceive_apdu_tlv(tp, '80e29000', do, StoreResponseDoCollection)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/ara_m.py", line 267, in xceive_apdu_tlv
    cmd_do_enc = cmd_do.to_ie()
                 ^^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/tlv.py", line 230, in to_ie
    return self.to_tlv()
           ^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/tlv.py", line 234, in to_tlv
    val = self.to_bytes()
          ^^^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/tlv.py", line 186, in to_bytes
    out += c.to_ie()
           ^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/tlv.py", line 230, in to_ie
    return self.to_tlv()
           ^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/tlv.py", line 234, in to_tlv
    val = self.to_bytes()
          ^^^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/tlv.py", line 186, in to_bytes
    out += c.to_ie()
           ^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/tlv.py", line 230, in to_ie
    return self.to_tlv()
           ^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/tlv.py", line 234, in to_tlv
    val = self.to_bytes()
          ^^^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/tlv.py", line 186, in to_bytes
    out += c.to_ie()
           ^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/tlv.py", line 230, in to_ie
    return self.to_tlv()
           ^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/tlv.py", line 234, in to_tlv
    val = self.to_bytes()
          ^^^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/tlv.py", line 189, in to_bytes
    return super().to_bytes()
           ^^^^^^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/tlv.py", line 95, in to_bytes
    do = self.__class__._construct.build(self.decoded, total_len=None)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lynxis/.local/share/virtualenvs/pysim-C216Z-pe/lib/python3.11/site-packages/construct/core.py", line 336, in build
    self.build_stream(obj, stream, **contextkw)
  File "/home/lynxis/.local/share/virtualenvs/pysim-C216Z-pe/lib/python3.11/site-packages/construct/core.py", line 348, in build_stream
    self._build(obj, stream, context, "(building)")
  File "/home/lynxis/.local/share/virtualenvs/pysim-C216Z-pe/lib/python3.11/site-packages/construct/core.py", line 2133, in _build
    context.update(obj)
  File "/home/lynxis/.local/share/virtualenvs/pysim-C216Z-pe/lib/python3.11/site-packages/construct/lib/containers.py", line 119, in update
    for k,v in seqordict:
        ^^^
ValueError: not enough values to unpack (expected 2, got 1)
EXCEPTION of type 'ValueError' occurred with message: not enough values to unpack (expected 2, got 1)
pySIM-shell (MF/ADF.ARA-M)> 

authenticated (verify_adm)

pySIM-shell (MF)> select ADF.ARA-M
"" 
pySIM-shell (MF/ADF.ARA-M)> aram_store_ref_ar_do --aid ffffffffffff --device-app-id 550F1A164CCD48D27A5EA3B765957493CD830171 --android-permissions 0000000000000001 --pkg-ref eu.fe80.cn.carrier
Traceback (most recent call last):
  File "/home/lynxis/.local/share/virtualenvs/pysim-C216Z-pe/lib/python3.11/site-packages/cmd2/cmd2.py", line 2399, in onecmd_plus_hooks
    stop = self.onecmd(statement, add_to_history=add_to_history)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lynxis/.local/share/virtualenvs/pysim-C216Z-pe/lib/python3.11/site-packages/cmd2/cmd2.py", line 2852, in onecmd
    stop = func(statement)
           ^^^^^^^^^^^^^^^
  File "/home/lynxis/.local/share/virtualenvs/pysim-C216Z-pe/lib/python3.11/site-packages/cmd2/decorators.py", line 382, in cmd_wrapper
    return func(*args_list, **kwargs)  # type: ignore[call-arg]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/ara_m.py", line 376, in do_aram_store_ref_ar_do
    res_do = ADF_ARAM.store_data(self._cmd.card._scc._tp, csrado)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/ara_m.py", line 289, in store_data
    return ADF_ARAM.xceive_apdu_tlv(tp, '80e29000', do, StoreResponseDoCollection)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/ara_m.py", line 267, in xceive_apdu_tlv
    cmd_do_enc = cmd_do.to_ie()
                 ^^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/tlv.py", line 230, in to_ie
    return self.to_tlv()
           ^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/tlv.py", line 234, in to_tlv
    val = self.to_bytes()
          ^^^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/tlv.py", line 186, in to_bytes
    out += c.to_ie()
           ^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/tlv.py", line 230, in to_ie
    return self.to_tlv()
           ^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/tlv.py", line 234, in to_tlv
    val = self.to_bytes()
          ^^^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/tlv.py", line 186, in to_bytes
    out += c.to_ie()
           ^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/tlv.py", line 230, in to_ie
    return self.to_tlv()
           ^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/tlv.py", line 234, in to_tlv
    val = self.to_bytes()
          ^^^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/tlv.py", line 186, in to_bytes
    out += c.to_ie()
           ^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/tlv.py", line 230, in to_ie
    return self.to_tlv()
           ^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/tlv.py", line 234, in to_tlv
    val = self.to_bytes()
          ^^^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/tlv.py", line 189, in to_bytes
    return super().to_bytes()
           ^^^^^^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/tlv.py", line 95, in to_bytes
    do = self.__class__._construct.build(self.decoded, total_len=None)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lynxis/.local/share/virtualenvs/pysim-C216Z-pe/lib/python3.11/site-packages/construct/core.py", line 336, in build
    self.build_stream(obj, stream, **contextkw)
  File "/home/lynxis/.local/share/virtualenvs/pysim-C216Z-pe/lib/python3.11/site-packages/construct/core.py", line 348, in build_stream
    self._build(obj, stream, context, "(building)")
  File "/home/lynxis/.local/share/virtualenvs/pysim-C216Z-pe/lib/python3.11/site-packages/construct/core.py", line 2133, in _build
    context.update(obj)
  File "/home/lynxis/.local/share/virtualenvs/pysim-C216Z-pe/lib/python3.11/site-packages/construct/lib/containers.py", line 119, in update
    for k,v in seqordict:
        ^^^
ValueError: not enough values to unpack (expected 2, got 1)
EXCEPTION of type 'ValueError' occurred with message: not enough values to unpack (expected 2, got 1)
pySIM-shell (MF/ADF.ARA-M)> 

Actions #1

Updated by lynxis 7 months ago

After applying https://gerrit.osmocom.org/c/pysim/+/34007 the object can now be encoded.
I've manual validated it with the example on https://source.android.com/docs/core/connect/uicc.

Now the card is rejecting the call with SW_DATA_INVALID 0x6984.
The aram-applet doesn't support PkgRefDO.
The SW_DATA_INVALID should come from AccessRuleMaster.java#L307

Actions #2

Updated by laforge 5 months ago

  • Status changed from New to Resolved
  • Assignee set to lynxis
  • % Done changed from 0 to 100

patch was merged

Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)