dexter has uploaded this change for review. (
https://gerrit.osmocom.org/c/pysim/+/38231?usp=email )
Change subject: pySim-shell: recognize ADP pins longer than 8 digits as hexadecimal
......................................................................
pySim-shell: recognize ADP pins longer than 8 digits as hexadecimal
When a hexadecimal formatted ADM pin is retrieved via the
card_key_provider, it still requires the --pin-is-hex parameter so
that sanitize_pin_adm knows the correct format.
This unfortunately ruins the card_key_provider feature for all cards
that use hexadecimal pins, because the --pin-is-hex would also be
required in scripts, which makes a script either useable for cards
with hexadecimal ADM or for for cards with ASCII ADM.
To minimize the problem, let's recognize all ADM pins longer than 8
digits as hexadecimal in case --pin-is-hex is not set.
Related: OS#4348
Change-Id: Iad9398365d448946c499ce89e3cfb2c3af5d525e
---
M pySim-shell.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/31/38231/1
diff --git a/pySim-shell.py b/pySim-shell.py
index d3f0d87..8c260aa 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -819,7 +819,7 @@
adm_type = opts.adm_type or 'ADM1'
# try to find an ADM-PIN if none is specified
result = card_key_provider_get_field(adm_type, key='ICCID',
value=iccid)
- if opts.pin_is_hex:
+ if opts.pin_is_hex or (result and len(result) > 8):
pin_adm = sanitize_pin_adm(None, result)
else:
pin_adm = sanitize_pin_adm(result)
--
To view, visit
https://gerrit.osmocom.org/c/pysim/+/38231?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Iad9398365d448946c499ce89e3cfb2c3af5d525e
Gerrit-Change-Number: 38231
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>