laforge has uploaded this change for review. (
https://gerrit.osmocom.org/c/pysim/+/34880?usp=email )
Change subject: euicc: Add get_profiles_info command
......................................................................
euicc: Add get_profiles_info command
Example output:
pySIM-shell (02:MF/ADF.ISD-R)> get_profiles_info
{
"profile_info_seq": {
"profile_info": {
"iccid": "98940462222222222222",
"isdp_aid": "a0000005591010ffffffff8900001200",
"profile_state": "enabled",
"service_provider_name": "foobar",
"profile_name": "foobar",
"profile_class": "provisioning"
}
}
}
Change-Id: I52d136f99dc0eb29905e7ca0cd0865486d3cf65b
---
M docs/shell.rst
M pySim/euicc.py
2 files changed, 68 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/80/34880/1
diff --git a/docs/shell.rst b/docs/shell.rst
index 31d73c0..610500f 100644
--- a/docs/shell.rst
+++ b/docs/shell.rst
@@ -883,6 +883,11 @@
:module: pySim.euicc
:func: ADF_ISDR.AddlShellCommands.rem_notif_parser
+get_profiles_info
+~~~~~~~~~~~~~~~~~
+
+Obtain information about the profiles present on the eUICC using the ES10c
GetProfilesInfo() function.
+
enable_profile
~~~~~~~~~~~~~~
diff --git a/pySim/euicc.py b/pySim/euicc.py
index d9b7b70..d9f96d9 100644
--- a/pySim/euicc.py
+++ b/pySim/euicc.py
@@ -167,11 +167,41 @@
class LoadCRL(BER_TLV_IE, tag=0xbf35, nested=[]): # FIXME
pass
+# SGP.22 Section 5.7.15: GetProfilesInfo
+class TagList(BER_TLV_IE, tag=0x5c):
+ _construct = GreedyRange(Int8ub) # FIXME: tags could be multi-byte
+class ProfileInfoListReq(BER_TLV_IE, tag=0xbf2d, nested=[TagList]): # FIXME:
SearchCriteria
+ pass
+class IsdpAid(BER_TLV_IE, tag=0x4f):
+ _construct = HexAdapter(GreedyBytes)
+class ProfileState(BER_TLV_IE, tag=0x9f70):
+ _construct = Enum(Int8ub, disabled=0, enabled=1)
+class ProfileNickname(BER_TLV_IE, tag=0x90):
+ _construct = Utf8Adapter(GreedyBytes)
+class ServiceProviderName(BER_TLV_IE, tag=0x91):
+ _construct = Utf8Adapter(GreedyBytes)
+class ProfileName(BER_TLV_IE, tag=0x92):
+ _construct = Utf8Adapter(GreedyBytes)
+class IconType(BER_TLV_IE, tag=0x93):
+ _construct = Enum(Int8ub, jpg=0, png=1)
+class Icon(BER_TLV_IE, tag=0x94):
+ _construct = GreedyBytes
+class ProfileClass(BER_TLV_IE, tag=0x95):
+ _construct = Enum(Int8ub, test=0, provisioning=1, operational=2)
+class ProfileInfo(BER_TLV_IE, tag=0xe3, nested=[Iccid, IsdpAid, ProfileState,
ProfileNickname,
+ ServiceProviderName, ProfileName,
IconType, Icon,
+ ProfileClass]): # FIXME: more IEs
+ pass
+class ProfileInfoSeq(BER_TLV_IE, tag=0xa0, nested=[ProfileInfo]):
+ pass
+class ProfileInfoListError(BER_TLV_IE, tag=0x81):
+ _construct = Enum(Int8ub, incorrectInputValues=1, undefinedError=2)
+class ProfileInfoListResp(BER_TLV_IE, tag=0xbf2d, nested=[ProfileInfoSeq,
ProfileInfoListError]):
+ pass
+
# SGP.22 Section 5.7.16:: EnableProfile
class RefreshFlag(BER_TLV_IE, tag=0x88): # FIXME
_construct = Int8ub # FIXME
-class IsdpAid(BER_TLV_IE, tag=0x4f):
- _construct = HexAdapter(GreedyBytes)
class EnableResult(BER_TLV_IE, tag=0x80):
_construct = Enum(Int8ub, ok=0, iccidOrAidNotFound=1, profileNotInDisabledState=2,
disallowedByPolicy=3, wrongProfileReenabling=4, catBusy=5,
undefinedError=127)
@@ -199,8 +229,6 @@
pass
# SGP.22 Section 5.7.20 GetEID
-class TagList(BER_TLV_IE, tag=0x5c):
- _construct = GreedyRange(Int8ub)
class EidValue(BER_TLV_IE, tag=0x5a):
_construct = HexAdapter(GreedyBytes)
class GetEuiccData(BER_TLV_IE, tag=0xbf3e, nested=[TagList, EidValue]):
@@ -321,6 +349,12 @@
d = rn.to_dict()
self._cmd.poutput_json(flatten_dict_lists(d['notification_sent_resp']))
+ def do_get_profiles_info(self, opts):
+ """Perform an ES10c GetProfilesInfo
function."""
+ pi = ADF_ISDR.store_data_tlv(self._cmd.lchan.scc, ProfileInfoListReq(),
ProfileInfoListResp)
+ d = pi.to_dict()
+
self._cmd.poutput_json(flatten_dict_lists(d['profile_info_list_resp']))
+
en_prof_parser = argparse.ArgumentParser()
en_prof_grp = en_prof_parser.add_mutually_exclusive_group()
en_prof_grp.add_argument('--isdp-aid', help='Profile identified by
its ISD-P AID')
--
To view, visit
https://gerrit.osmocom.org/c/pysim/+/34880?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I52d136f99dc0eb29905e7ca0cd0865486d3cf65b
Gerrit-Change-Number: 34880
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange