diff --git a/virtualsmartcard/src/vpicc/virtualsmartcard/SEutils.py b/virtualsmartcard/src/vpicc/virtualsmartcard/SEutils.py index 76df631..6443c6f 100644 --- a/virtualsmartcard/src/vpicc/virtualsmartcard/SEutils.py +++ b/virtualsmartcard/src/vpicc/virtualsmartcard/SEutils.py @@ -21,6 +21,7 @@ from time import time from random import seed, randint from virtualsmartcard.ConstantDefinitions import * from virtualsmartcard.utils import inttostring, stringtoint +from virtualsmartcard.SWutils import * class ControlReferenceTemplate: def __init__(self,type,config=""): @@ -61,7 +62,7 @@ class ControlReferenceTemplate: def __set_algo(self,data): if not ALGO_MAPPING.has_key(data): - raise ValueError + raise SwError(SW["ERR_REFNOTUSABLE"]) else: #TODO: Sanity checking self.algorithm = ALGO_MAPPING[data] diff --git a/virtualsmartcard/src/vpicc/virtualsmartcard/SmartcardSAM.py b/virtualsmartcard/src/vpicc/virtualsmartcard/SmartcardSAM.py index 215bf14..2cf769a 100644 --- a/virtualsmartcard/src/vpicc/virtualsmartcard/SmartcardSAM.py +++ b/virtualsmartcard/src/vpicc/virtualsmartcard/SmartcardSAM.py @@ -939,7 +939,7 @@ class Secure_Messaging(object): if p1 != 0x8E or p2 != 0x80: raise SwError(SW["ERR_INCORRECTP1P2"]) if self.CAPDU_SE.cct.algorithm == None or self.current_SE.cct.key == None: - raise SWError(SE["ERR_CONDITIONNOTSATISFIED"]) + raise SwError(SE["ERR_CONDITIONNOTSATISFIED"]) checksum = virtualsmartcard.CryptoUtils.crypto_checksum(self.current_SE.cct.algorithm, self.current_SE.cct.key, @@ -959,7 +959,7 @@ class Secure_Messaging(object): if p1 != 0x9E or not p2 in (0x9A,0xAC,0xBC): raise SwError(SW["ERR_INCORRECTP1P2"]) if self.current_SE.dst.key == None: - raise SWError(SE["ERR_CONDITIONNOTSATISFIED"]) + raise SwError(SE["ERR_CONDITIONNOTSATISFIED"]) if p2 == 0x9A: #Data to be signed to_sign = data