mirror of https://gerrit.osmocom.org/pysim
pySim-prog.py: add presence/length checks for user-provided SPN
Change-Id: I35fab9a85efda2b83f221a460d31c7d41db582b0
This commit is contained in:
parent
6af4c21cdf
commit
840a9e2a76
|
@ -274,6 +274,10 @@ def gen_parameters(opts):
|
|||
# Digitize MCC/MNC (5 or 6 digits)
|
||||
plmn_digits = _mcc_mnc_digits(mcc, mnc)
|
||||
|
||||
if opts.name is not None:
|
||||
if len(opts.name) > 16:
|
||||
raise ValueError('Service Provider Name must max 16 characters!');
|
||||
|
||||
# ICCID (19 digits, E.118), though some phase1 vendors use 20 :(
|
||||
if opts.iccid is not None:
|
||||
iccid = opts.iccid
|
||||
|
|
|
@ -613,8 +613,9 @@ class SysmoUSIMSJS1(Card):
|
|||
data, sw = self._scc.update_binary('00F7', content)
|
||||
|
||||
# set Service Provider Name
|
||||
content = enc_spn(p['name'], True, True)
|
||||
data, sw = self._scc.update_binary('6F46', rpad(content, 32))
|
||||
if p.get('name') is not None:
|
||||
content = enc_spn(p['name'], True, True)
|
||||
data, sw = self._scc.update_binary('6F46', rpad(content, 32))
|
||||
|
||||
# write EF.IMSI
|
||||
data, sw = self._scc.update_binary('6f07', enc_imsi(p['imsi']))
|
||||
|
|
Loading…
Reference in New Issue