forked from public/pysim
cards: remove unnecessary execptions.
The _scc.veryif_adm() method already does status word checking internally and also raises an execption should the authentication be unsuccessful, so we do not have to put an additional status word check + execition when we use the method from cards. Change-Id: I785d27e4d49a9cda1a771b56ce5ac9c1f1d1e79a Related: OS#4963
This commit is contained in:
@@ -854,8 +854,6 @@ class SysmoUSIMSJS1(UsimCard):
|
|||||||
if not key:
|
if not key:
|
||||||
raise ValueError("Please provide a PIN-ADM as there is no default one")
|
raise ValueError("Please provide a PIN-ADM as there is no default one")
|
||||||
(res, sw) = self._scc.verify_chv(0x0A, key)
|
(res, sw) = self._scc.verify_chv(0x0A, key)
|
||||||
if sw != '9000':
|
|
||||||
raise RuntimeError('Failed to authenticate with ADM key %s'%(key))
|
|
||||||
return sw
|
return sw
|
||||||
|
|
||||||
def program(self, p):
|
def program(self, p):
|
||||||
@@ -1045,9 +1043,7 @@ class FairwavesSIM(UsimCard):
|
|||||||
# authenticate as ADM1
|
# authenticate as ADM1
|
||||||
if not p['pin_adm']:
|
if not p['pin_adm']:
|
||||||
raise ValueError("Please provide a PIN-ADM as there is no default one")
|
raise ValueError("Please provide a PIN-ADM as there is no default one")
|
||||||
sw = self.verify_adm(h2b(p['pin_adm']))
|
self.verify_adm(h2b(p['pin_adm']))
|
||||||
if sw != '9000':
|
|
||||||
raise RuntimeError('Failed to authenticate with ADM key %s'%(p['pin_adm'],))
|
|
||||||
|
|
||||||
# TODO: Set operator name
|
# TODO: Set operator name
|
||||||
if p.get('smsp') is not None:
|
if p.get('smsp') is not None:
|
||||||
@@ -1152,9 +1148,7 @@ class WavemobileSim(UsimCard):
|
|||||||
def program(self, p):
|
def program(self, p):
|
||||||
if not p['pin_adm']:
|
if not p['pin_adm']:
|
||||||
raise ValueError("Please provide a PIN-ADM as there is no default one")
|
raise ValueError("Please provide a PIN-ADM as there is no default one")
|
||||||
sw = self.verify_adm(h2b(p['pin_adm']))
|
self.verify_adm(h2b(p['pin_adm']))
|
||||||
if sw != '9000':
|
|
||||||
raise RuntimeError('Failed to authenticate with ADM key %s'%(p['pin_adm'],))
|
|
||||||
|
|
||||||
# EF.ICCID
|
# EF.ICCID
|
||||||
# TODO: Add programming of the ICCID
|
# TODO: Add programming of the ICCID
|
||||||
@@ -1254,8 +1248,6 @@ class SysmoISIMSJA2(UsimCard, IsimCard):
|
|||||||
if not key:
|
if not key:
|
||||||
raise ValueError("Please provide a PIN-ADM as there is no default one")
|
raise ValueError("Please provide a PIN-ADM as there is no default one")
|
||||||
(res, sw) = self._scc.verify_chv(0x0A, key)
|
(res, sw) = self._scc.verify_chv(0x0A, key)
|
||||||
if sw != '9000':
|
|
||||||
raise RuntimeError('Failed to authenticate with ADM key %s'%(key))
|
|
||||||
return sw
|
return sw
|
||||||
|
|
||||||
def program(self, p):
|
def program(self, p):
|
||||||
|
|||||||
Reference in New Issue
Block a user