Code style improvements
git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@452 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
@@ -125,7 +125,6 @@ class CardContainer:
|
|||||||
class SAM(object):
|
class SAM(object):
|
||||||
|
|
||||||
def __init__(self, PIN, cardNumber, mf=None):
|
def __init__(self, PIN, cardNumber, mf=None):
|
||||||
import virtualsmartcard.CryptoUtils
|
|
||||||
|
|
||||||
self.CardContainer = CardContainer(PIN, cardNumber)
|
self.CardContainer = CardContainer(PIN, cardNumber)
|
||||||
#self.CardContainer.loadConfiguration(path, password)
|
#self.CardContainer.loadConfiguration(path, password)
|
||||||
@@ -575,8 +574,6 @@ class Security_Environment(object):
|
|||||||
class Secure_Messaging(object):
|
class Secure_Messaging(object):
|
||||||
|
|
||||||
def __init__(self, MF, SE=None):
|
def __init__(self, MF, SE=None):
|
||||||
import virtualsmartcard.CryptoUtils
|
|
||||||
|
|
||||||
self.mf = MF
|
self.mf = MF
|
||||||
if not SE:
|
if not SE:
|
||||||
self.current_SE = Security_Environment()
|
self.current_SE = Security_Environment()
|
||||||
@@ -911,9 +908,11 @@ 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(SW["ERR_CONDITIONNOTSATISFIED"])
|
raise SwError(SW["ERR_CONDITIONNOTSATISFIED"])
|
||||||
|
|
||||||
|
to_sign = ""
|
||||||
if p2 == 0x9A: #Data to be signed
|
if p2 == 0x9A: #Data to be signed
|
||||||
to_sign = data
|
to_sign = data
|
||||||
elif p2 == 0xAC: #Data objects, sign values
|
elif p2 == 0xAC: #Data objects, sign values
|
||||||
@@ -924,7 +923,7 @@ class Secure_Messaging(object):
|
|||||||
elif p2 == 0xBC: #Data objects to be signed
|
elif p2 == 0xBC: #Data objects to be signed
|
||||||
pass
|
pass
|
||||||
|
|
||||||
signature = self.current_SE.dst.key.sign(data,"")
|
signature = self.current_SE.dst.key.sign(to_sign, "")
|
||||||
return SW["NORMAL"], signature
|
return SW["NORMAL"], signature
|
||||||
|
|
||||||
def hash(self, p1, p2, data):
|
def hash(self, p1, p2, data):
|
||||||
|
|||||||
Reference in New Issue
Block a user