pySim-shell: use -a / -A commandline option to authenticate

pySim-shell defines, just like the other pySim programs commandline
arguments that take an ADM pin to authenticate at the card as admin. The
arguments are defined, but not used. Add the missing authentication
part.

Change-Id: I6bed14eb8f4124e28d593cf0816dbe58e7271322
Related: OS#4963
This commit is contained in:
Philipp Maier 2021-03-10 20:14:06 +01:00
parent e6bc4f9032
commit 228c98e4c6
1 changed files with 10 additions and 0 deletions

View File

@ -339,4 +339,14 @@ if __name__ == '__main__':
app = PysimApp(card, rs, opts.script)
rs.select('MF', app)
# If the user supplies an ADM PIN at via commandline args authenticate
# immediatley so that the user does not have to use the shell commands
pin_adm = sanitize_pin_adm(opts.pin_adm, opts.pin_adm_hex)
if pin_adm:
try:
card.verify_adm(h2b(pin_adm))
except Exception as e:
print(e)
app.cmdloop()