dexter has uploaded this change for review.
decode security attributes compact field in FCP
When we select files, we currently display the security attributes
compact field as raw bytes only. Let's decode this field using construct
so that it gets displayed in human readable form.
Change-Id: Iaa1167349027222e69a561d20a4c595fba2fdd2b
Related: OS#6211
---
M pySim/ts_102_221.py
1 file changed, 26 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/63/35363/1
diff --git a/pySim/ts_102_221.py b/pySim/ts_102_221.py
index ac0dc84..56da542 100644
--- a/pySim/ts_102_221.py
+++ b/pySim/ts_102_221.py
@@ -175,7 +175,18 @@
# ETSI TS 102 221 11.1.1.4.7.1
class SecurityAttribCompact(BER_TLV_IE, tag=0x8c):
- _construct = GreedyBytes
+ # see also ISO/IEC 7816-4, section 5.4.3.1, table 16, 17 and 20
+ F = Struct('delete_self'/Flag, 'terminate'/Flag, 'activate'/Flag, 'deactivate'/Flag)
+ FCNT = Struct('create_df|write,append_record'/Flag,
+ 'create_ef|update,erase'/Flag,
+ 'delete_file|read,search'/Flag)
+ _construct = Struct('access_mode'/Select(BitStruct(Const(1, Bit), 'propritary'/BitsInteger(4), 'file_contents'/FCNT),
+ BitStruct(Const(0, Bit), 'file'/F, 'file_contents'/FCNT)),
+ 'security_conditions'/Array(this._.total_len - 1, Select(BitStruct('no_condition'/Const(0x00,BitsInteger(8))),
+ BitStruct('never'/Const(0xff, BitsInteger(8))),
+ BitStruct('match_all'/Flag, 'secure_msg'/Flag,
+ 'ext_auth'/Flag, 'user_auth'/Flag,
+ 'SEID'/BitsInteger(4)))))
# ETSI TS 102 221 11.1.1.4.7.2
class SecurityAttribExpanded(BER_TLV_IE, tag=0xab):
To view, visit change 35363. To unsubscribe, or for help writing mail filters, visit settings.