Project

General

Profile

Actions

Feature #6265

open

decode numeric SW in case of errors

Added by laforge 6 months ago. Updated 5 months ago.

Status:
New
Priority:
Normal
Assignee:
Category:
pySim-prog
Target version:
-
Start date:
11/20/2023
Due date:
% Done:

0%

Spec Reference:

Description

We quite often get support requests from users of pySim-prog who run into ADM key errors which don't get decoded properly and rather repor backtraces:

> Using PC/SC reader number 0
> Ready for Programming: Insert card now (or CTRL-C to cancel)
> Autodetected card type: sysmoISIM-SJA2
> Generated card parameters : [...]
> Programming ...
>
> Card programming failed with an exception:
> ---------------------8<---------------------
> Traceback (most recent call last):
>   File "./pySim-prog.py", line 822, in <module>
>     rc = process_card(scc, opts, first, ch)
>   File "./pySim-prog.py", line 774, in process_card
>     card.program(cp)
>   File "/home/xxxxxx/pysim/pySim/legacy/cards.py", line 1335, in program
>     self.verify_adm(h2b(p['pin_adm']))
>   File "/home/xxxxxx/pysim/pySim/legacy/cards.py", line 1331, in verify_adm
>     (res, sw) = self._scc.verify_chv(0x0A, key)
>   File "/home/xxxxxx/pysim/pySim/commands.py", line 587, in verify_chv
>     self._chv_process_sw('verify', chv_no, code, sw)
>   File "/home/xxxxxx/pysim/pySim/commands.py", line 575, in _chv_process_sw
>     raise SwMatchError(sw, '9000')
> pySim.exceptions.SwMatchError: SW match failed! Expected 9000 and got 6983.

We should not print raw exceptions like this but properly decode the status word according to the tables we do alrady have in pySim and give the user a meaningful error message.

Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)