Project

General

Profile

Actions

Feature #6211

open

decode security attributes _compact_ in human-readable way, like we decode EF.ARR

Added by laforge 7 months ago. Updated 4 months ago.

Status:
In Progress
Priority:
Low
Assignee:
Category:
pySim-shell
Target version:
-
Start date:
10/06/2023
Due date:
% Done:

50%

Spec Reference:

Description

See #6178: It would be great to add human-readable decode for those security attributes to pySim-shell... I think we already do that for referenced (via EF.ARR), but not for compact.


Related issues

Related to pySim - Bug #6178: create_ef failed, Expected 9000 and got 6982: Command not allowed - Security status not satisfiedResolvedwei09/14/2023

Actions
Actions #1

Updated by laforge 7 months ago

  • Related to Bug #6178: create_ef failed, Expected 9000 and got 6982: Command not allowed - Security status not satisfied added
Actions #2

Updated by dexter 5 months ago

  • Status changed from New to In Progress
Actions #3

Updated by dexter 5 months ago

  • % Done changed from 0 to 10

Unfortunately the security attributes consist of one mode byte and multiple condition bytes. This means the tail of condition bytes may vary. This is a bit nasty to model in construct since one needs to use Arrays (which we never did before.) Also there was a bug in flatten_dict_lists, which made my think that the way how I used Array was wrong. However, now this seems to work, at least I can handle the unknown amount of bytes now.

The next problem will be that we have to know if we deal with an EF or DF. Otherwise we will end up with an ugly output like "create_ef|update_binary,update_record,erase_binary,erase_record". However, I noticed that when I select an EF, I won't get any security attributes.

I have fixed the flatten_dict_lists function a bit so that it automatically indexes the keys if there are multiple of them. The problem was fixed before, but the fix below will preserve the compact output.

https://gerrit.osmocom.org/c/pysim/+/35254 tlv: improve flatten_dict_lists for multiple keys

Actions #4

Updated by dexter 4 months ago

  • % Done changed from 10 to 50

There is now a patch in gerrit that adds decoding (and possibly encoding) for the security attributes compact field:

https://gerrit.osmocom.org/c/pysim/+/35363 decode security attributes compact field in FCP

Unfortunately this decoding still does not distinguish between EFs and DFs, which makes the output a bit clumsy. I wonder if there a way to distinguish between EFs and DFs by using pythons introspection features (walk up the class tree and look into the file descriptor byte?). In any case, this then would require an Adapter class inside SecurityAttribCompact class that would then do the parsing/building of the three remaining bits.

Actions #5

Updated by laforge 4 months ago

I think the best way would be to pass this information via the "context" of "construct". So when we call the decoder, we pass the information in the context, and the decoder can then use it to distinguish

Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)