Good afternoon, 

Thanks a lot you for your answer. I did the test with the PUK code. but it did 
not work as well (see log below).
The Amarisoft SIM card has two PIN codes, I have the following informations  on 
it : 
    - PIN :  1234
    - PIN2 : 1234
    - PUK  : 12345678
    - PUK2  : 12345678

I also think that we have the following commands relative to the (PIN) 
authentication :
    - change_chv : edit one of the pin codes (specified with the option 
--pin-nr)
    - enable_chv / disable_chv : enable/disable the need to enter the PIN to 
access files restricted by it
    - unblock_chv :  unblock a wrong PIN code entered more than 3 times with 
the corresponding PUK code
    - verify_chv : authenticate the user with the PIN code (specified with the 
option --pin-nr)

I did try to unlock the PIN2 but it did not change anything (get a similar 
error). Plus if I enter a wrong PIN1 code, the error is not the same and is 
really clear.



pySIM-shell (00:MF)> verify_chv --pin-nr 1 1234
CHV verification successful
pySIM-shell (00:MF)> verify_chv --pin-nr 1 1233
EXCEPTION of type 'RuntimeError' occurred with message: Failed to verify chv_no 
0x01 with code 0x31323333FFFFFFFF, 2 tries left.
To enable full traceback, run the following command: 'set debug true'
pySIM-shell (00:MF)> verify_chv --pin-nr 1 1234
CHV verification successful
pySIM-shell (00:MF)> verify_chv --pin-nr 2 1234
EXCEPTION of type 'SwMatchError' occurred with message: SW match failed! 
Expected 9000 and got 6b00.
To enable full traceback, run the following command: 'set debug true'
pySIM-shell (00:MF)> verify_chv --pin-nr 2 12345678
EXCEPTION of type 'SwMatchError' occurred with message: SW match failed! 
Expected 9000 and got 6b00.
To enable full traceback, run the following command: 'set debug true'
pySIM-shell (00:MF)> verify_chv --pin-nr 1 12345678
EXCEPTION of type 'RuntimeError' occurred with message: Failed to verify chv_no 
0x01 with code 0x3132333435363738, 2 tries left.
To enable full traceback, run the following command: 'set debug true'
pySIM-shell (00:MF)> verify_chv --pin-nr 1 1234
CHV verification successful
pySIM-shell (00:MF)>


________________________________________
De : benoit michau <michau.ben...@gmail.com>
Envoyé : samedi 6 juillet 2024 07:14
À : Valentin Maillet (EXT) <valentin.maillet....@keas-group.com>
Cc : simtrace@lists.osmocom.org <simtrace@lists.osmocom.org>
Objet : Re: pySim-shell issues with CHV2 verification (amarisoft sim card)
 

Hello,
Afair, PIN 2 should correspond to the PUK code, which is traditionally 8 
digits, not 4. Here, you get an error indicated by the SW code 6B 00, which 
means "wrong parameters P1 or P2". This can correspond to the length of the PIN 
2 expected to be longer than the one you provide.

Le jeu. 4 juil. 2024 à 17:11, Valentin Maillet (EXT) 
<valentin.maillet....@keas-group.com> a écrit :
Good afternoon,


I am trying to verify the CHV2 verification on an Amarisoft  Test SIM Card. 
With a HID OMNIKEY 3121.
I have issues with the CHV2 verification with the pySim software and amarisoft 
simcard.
I get the error below.

Can you please give me some hints on how to fix this issue as I have no idea of 
how to start.

Sincerely,

Valentin M.



pySIM-shell (00:MF)> verify_chv --pin-nr 1 1234
CHV verification successful
pySIM-shell (00:MF)> verify_chv --pin-nr 2 1234
EXCEPTION of type 'SwMatchError' occurred with message: SW match failed! 
Expected 9000 and got 6b00.
To enable full traceback, run the following command: 'set debug true'
pySIM-shell (00:MF)> set debug true
debug - was: False
now: True
pySIM-shell (00:MF)> verify_chv --pin-nr 2 1234
Traceback (most recent call last):
  File "/home/keas/.local/lib/python3.10/site-packages/cmd2/cmd2.py", line 
2399, in onecmd_plus_hooks
    stop = self.onecmd(statement, add_to_history=add_to_history)
  File "/home/keas/.local/lib/python3.10/site-packages/cmd2/cmd2.py", line 
2852, in onecmd
    stop = func(statement)
  File "/home/keas/.local/lib/python3.10/site-packages/cmd2/decorators.py", 
line 382, in cmd_wrapper
    return func(*args_list, **kwargs)  # type: ignore[call-arg]
  File "/home/keas/pysim/./pySim-shell.py", line 824, in do_verify_chv
    (data, sw) = self._cmd.lchan.scc.verify_chv(opts.pin_nr, h2b(pin))
  File "/home/keas/pysim/pySim/commands.py", line 693, in verify_chv
    self._chv_process_sw('verify', chv_no, code, sw)
  File "/home/keas/pysim/pySim/commands.py", line 682, in _chv_process_sw
    raise SwMatchError(sw, '9000')
pySim.exceptions.SwMatchError: SW match failed! Expected 9000 and got 6b00.
EXCEPTION of type 'SwMatchError' occurred with message: SW match failed! 
Expected 9000 and got 6b00.
pySIM-shell (00:MF)>

Reply via email to