SmartcardSAM: Fixed syntax errors
SEutils: Now replying with error RAPDU when we do not support a referenced algorithm git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@445 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
@@ -21,6 +21,7 @@ from time import time
|
|||||||
from random import seed, randint
|
from random import seed, randint
|
||||||
from virtualsmartcard.ConstantDefinitions import *
|
from virtualsmartcard.ConstantDefinitions import *
|
||||||
from virtualsmartcard.utils import inttostring, stringtoint
|
from virtualsmartcard.utils import inttostring, stringtoint
|
||||||
|
from virtualsmartcard.SWutils import *
|
||||||
|
|
||||||
class ControlReferenceTemplate:
|
class ControlReferenceTemplate:
|
||||||
def __init__(self,type,config=""):
|
def __init__(self,type,config=""):
|
||||||
@@ -61,7 +62,7 @@ class ControlReferenceTemplate:
|
|||||||
|
|
||||||
def __set_algo(self,data):
|
def __set_algo(self,data):
|
||||||
if not ALGO_MAPPING.has_key(data):
|
if not ALGO_MAPPING.has_key(data):
|
||||||
raise ValueError
|
raise SwError(SW["ERR_REFNOTUSABLE"])
|
||||||
else:
|
else:
|
||||||
#TODO: Sanity checking
|
#TODO: Sanity checking
|
||||||
self.algorithm = ALGO_MAPPING[data]
|
self.algorithm = ALGO_MAPPING[data]
|
||||||
|
|||||||
@@ -939,7 +939,7 @@ class Secure_Messaging(object):
|
|||||||
if p1 != 0x8E or p2 != 0x80:
|
if p1 != 0x8E or p2 != 0x80:
|
||||||
raise SwError(SW["ERR_INCORRECTP1P2"])
|
raise SwError(SW["ERR_INCORRECTP1P2"])
|
||||||
if self.CAPDU_SE.cct.algorithm == None or self.current_SE.cct.key == None:
|
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,
|
checksum = virtualsmartcard.CryptoUtils.crypto_checksum(self.current_SE.cct.algorithm,
|
||||||
self.current_SE.cct.key,
|
self.current_SE.cct.key,
|
||||||
@@ -959,7 +959,7 @@ class Secure_Messaging(object):
|
|||||||
if p1 != 0x9E or not p2 in (0x9A,0xAC,0xBC):
|
if p1 != 0x9E or not p2 in (0x9A,0xAC,0xBC):
|
||||||
raise SwError(SW["ERR_INCORRECTP1P2"])
|
raise SwError(SW["ERR_INCORRECTP1P2"])
|
||||||
if self.current_SE.dst.key == None:
|
if self.current_SE.dst.key == None:
|
||||||
raise SWError(SE["ERR_CONDITIONNOTSATISFIED"])
|
raise SwError(SE["ERR_CONDITIONNOTSATISFIED"])
|
||||||
|
|
||||||
if p2 == 0x9A: #Data to be signed
|
if p2 == 0x9A: #Data to be signed
|
||||||
to_sign = data
|
to_sign = data
|
||||||
|
|||||||
Reference in New Issue
Block a user