decode security attributes _compact_ in human-readable way, like we decode EF.ARR
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.
- % 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
- % 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.