pySim-shell: add method to match card profile to card
UICC and old SIM cards can be difficult to tell apart without prior knowledge of the card. The ATR won't tell if the card is UICC or not. The only remaining option is to try out if the card is able to handle UICC APDUs. The same is true for 2G SIM cards. It is not guranteed that every UICC card will have 2G functionality. Lets add functionality to match a profile to the currently plugged card by actively probing it. Lets also add another profile to distinguish between UICC-only cards and UICC cards that include SIM functionality. Change-Id: If090d32551145f75c644657b90085a3ef5bfa691 Related: OS#5274
This commit is contained in:
@@ -332,6 +332,8 @@ from pySim.construct import *
|
||||
import enum
|
||||
|
||||
from pySim.filesystem import *
|
||||
from pySim.profile import CardProfile
|
||||
from pySim.profile import match_sim
|
||||
|
||||
######################################################################
|
||||
# DF.TELECOM
|
||||
@@ -975,6 +977,9 @@ def _decode_select_response(resp_hex):
|
||||
return ret
|
||||
|
||||
class CardProfileSIM(CardProfile):
|
||||
|
||||
ORDER = 2
|
||||
|
||||
def __init__(self):
|
||||
sw = {
|
||||
'Normal': {
|
||||
@@ -1016,3 +1021,7 @@ class CardProfileSIM(CardProfile):
|
||||
super().__init__('SIM', desc='GSM SIM Card', cla="a0", sel_ctrl="0000", files_in_mf=[DF_TELECOM(), DF_GSM()], sw=sw)
|
||||
def decode_select_response(self, data_hex:str) -> Any:
|
||||
return _decode_select_response(data_hex)
|
||||
|
||||
@staticmethod
|
||||
def match_with_card(scc:SimCardCommands) -> bool:
|
||||
return match_sim(scc)
|
||||
|
||||
Reference in New Issue
Block a user