aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2021-12-01 12:40:09 +0100
committerPhilipp Maier <pmaier@sysmocom.de>2021-12-01 12:40:09 +0100
commit2213547d08815530d84e0b164f8c167f8e5dcf65 (patch)
tree5bda32092cacc6fce6723dae72442415d1dc6f3e
parent8d8bdef6377f552d34d896f32f821310875f33e6 (diff)
-rw-r--r--pySim/ara_m.py4
-rw-r--r--pySim/ts_102_221.py20
2 files changed, 16 insertions, 8 deletions
diff --git a/pySim/ara_m.py b/pySim/ara_m.py
index 5dee3e0..34449d7 100644
--- a/pySim/ara_m.py
+++ b/pySim/ara_m.py
@@ -337,6 +337,10 @@ class ADF_ARAM(CardADF):
if res_do:
self._cmd.poutput_json(res_do.to_dict())
+ def decode_select_response(self, data_hex):
+ print("CAUGHT!")
+ return pySim.ts_51_011.CardProfileSIM.decode_select_response(data_hex)
+
# SEAC v1.1 Section 4.1.2.2 + 5.1.2.2
sw_aram = {
diff --git a/pySim/ts_102_221.py b/pySim/ts_102_221.py
index f145d19..3df79f0 100644
--- a/pySim/ts_102_221.py
+++ b/pySim/ts_102_221.py
@@ -675,20 +675,24 @@ class CardProfileUICC(CardProfile):
@staticmethod
def decode_select_response(resp_hex:str) -> object:
"""ETSI TS 102 221 Section 11.1.1.3"""
+ print(resp_hex)
fixup_fcp_proprietary_tlv_map(FCP_Proprietary_TLV_MAP)
resp_hex = resp_hex.upper()
# outer layer
fcp_base_tlv = TLV(['62'])
fcp_base = fcp_base_tlv.parse(resp_hex)
# actual FCP
- fcp_tlv = TLV(FCP_TLV_MAP)
- fcp = fcp_tlv.parse(fcp_base['62'])
- # further decode the proprietary information
- if 'A5' in fcp:
- prop_tlv = TLV(FCP_Proprietary_TLV_MAP)
- prop = prop_tlv.parse(fcp['A5'])
- fcp['A5'] = tlv_val_interpret(FCP_prorietary_interpreter_map, prop)
- fcp['A5'] = tlv_key_replace(FCP_Proprietary_TLV_MAP, fcp['A5'])
+ if '62' in fcp_base:
+ fcp_tlv = TLV(FCP_TLV_MAP)
+ fcp = fcp_tlv.parse(fcp_base['62'])
+ # further decode the proprietary information
+ if 'A5' in fcp:
+ prop_tlv = TLV(FCP_Proprietary_TLV_MAP)
+ prop = prop_tlv.parse(fcp['A5'])
+ fcp['A5'] = tlv_val_interpret(FCP_prorietary_interpreter_map, prop)
+ fcp['A5'] = tlv_key_replace(FCP_Proprietary_TLV_MAP, fcp['A5'])
+ else:
+ return resp_hex
# finally make sure we get human-readable keys in the output dict
r = tlv_val_interpret(FCP_interpreter_map, fcp)
return tlv_key_replace(FCP_TLV_MAP, r)