better debug output
git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@695 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
@@ -275,6 +275,8 @@ class Iso7816OS(SmartcardOS):
|
|||||||
logging.warning(str(e))
|
logging.warning(str(e))
|
||||||
return self.formatResult(False, 0, "", SW["ERR_INCORRECTPARAMETERS"], False)
|
return self.formatResult(False, 0, "", SW["ERR_INCORRECTPARAMETERS"], False)
|
||||||
|
|
||||||
|
logging.info("Parsed APDU:\n%s", str(c))
|
||||||
|
|
||||||
#Handle Class Byte
|
#Handle Class Byte
|
||||||
#{{{
|
#{{{
|
||||||
class_byte = c.cla
|
class_byte = c.cla
|
||||||
@@ -325,6 +327,7 @@ class Iso7816OS(SmartcardOS):
|
|||||||
try:
|
try:
|
||||||
if SM_STATUS == "Standard SM":
|
if SM_STATUS == "Standard SM":
|
||||||
c = self.SAM.parse_SM_CAPDU(c, header_authentication)
|
c = self.SAM.parse_SM_CAPDU(c, header_authentication)
|
||||||
|
logging.info("Decrypted APDU:\n%s", str(c))
|
||||||
elif SM_STATUS == "Proprietary SM":
|
elif SM_STATUS == "Proprietary SM":
|
||||||
raise SwError("ERR_SECMESSNOTSUPPORTED")
|
raise SwError("ERR_SECMESSNOTSUPPORTED")
|
||||||
sw, result = self.ins2handler.get(c.ins, notImplemented)(c.p1, c.p2, c.data)
|
sw, result = self.ins2handler.get(c.ins, notImplemented)(c.p1, c.p2, c.data)
|
||||||
@@ -661,11 +664,9 @@ class VirtualICC(object):
|
|||||||
logging.warning("Expected %u bytes, but received only %u",
|
logging.warning("Expected %u bytes, but received only %u",
|
||||||
size, len(msg))
|
size, len(msg))
|
||||||
|
|
||||||
logging.info("APDU (%d Bytes):\n%s", len(msg),
|
|
||||||
hexdump(msg, short=True))
|
|
||||||
answer = self.os.execute(msg)
|
answer = self.os.execute(msg)
|
||||||
logging.info("RESP (%d Bytes):\n%s\n", len(answer),
|
logging.info("Response APDU (%d Bytes):\n%s\n", len(answer),
|
||||||
hexdump(answer, short=True))
|
hexdump(answer))
|
||||||
self.__sendToVPICC(answer)
|
self.__sendToVPICC(answer)
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
|
|||||||
@@ -128,7 +128,6 @@ class nPA_SE(Security_Environment):
|
|||||||
if (p1, p2) != (0x00, 0x00):
|
if (p1, p2) != (0x00, 0x00):
|
||||||
raise SwError(SW["ERR_INCORRECTPARAMETERS"])
|
raise SwError(SW["ERR_INCORRECTPARAMETERS"])
|
||||||
|
|
||||||
print "performing PACE step", self.eac_step + 1
|
|
||||||
if self.eac_step == 0 and self.at.algorithm == "PACE":
|
if self.eac_step == 0 and self.at.algorithm == "PACE":
|
||||||
return self.__eac_pace_step1(data)
|
return self.__eac_pace_step1(data)
|
||||||
elif self.eac_step == 1 and self.at.algorithm == "PACE":
|
elif self.eac_step == 1 and self.at.algorithm == "PACE":
|
||||||
@@ -258,6 +257,8 @@ class nPA_SE(Security_Environment):
|
|||||||
pace.print_ossl_err()
|
pace.print_ossl_err()
|
||||||
raise SwError(SW["WARN_NOINFO63"])
|
raise SwError(SW["WARN_NOINFO63"])
|
||||||
|
|
||||||
|
print "Established PACE channel"
|
||||||
|
|
||||||
if self.at.keyref_is_can():
|
if self.at.keyref_is_can():
|
||||||
if (self.sam.counter == 1):
|
if (self.sam.counter == 1):
|
||||||
self.sam.active = True
|
self.sam.active = True
|
||||||
@@ -330,25 +331,14 @@ class nPA_SE(Security_Environment):
|
|||||||
else:
|
else:
|
||||||
auxiliary_data = None
|
auxiliary_data = None
|
||||||
|
|
||||||
#print "at.eph_pub_key"
|
|
||||||
#print hexdump(self.at.eph_pub_key)
|
|
||||||
#print "my_pace_eph_pubkey"
|
|
||||||
#print hexdump(pace.buf2string(self.my_pace_eph_pubkey))
|
|
||||||
#print "data"
|
|
||||||
#print hexdump(data)
|
|
||||||
#if self.auxiliary_data:
|
|
||||||
#print "auxiliary_data"
|
|
||||||
#print hexdump(self.auxiliary_data)
|
|
||||||
#else:
|
|
||||||
#print "auxiliary_data"
|
|
||||||
#print "None"
|
|
||||||
|
|
||||||
if 1 != pace.TA_STEP6_verify(self.eac_ctx,
|
if 1 != pace.TA_STEP6_verify(self.eac_ctx,
|
||||||
pace.get_buf(self.at.eph_pub_key), id_picc,
|
pace.get_buf(self.at.eph_pub_key), id_picc,
|
||||||
auxiliary_data, pace.get_buf(data)):
|
auxiliary_data, pace.get_buf(data)):
|
||||||
pace.print_ossl_err()
|
pace.print_ossl_err()
|
||||||
raise SwError(SW["ERR_CONDITIONNOTSATISFIED"])
|
raise SwError(SW["ERR_CONDITIONNOTSATISFIED"])
|
||||||
|
|
||||||
|
print "Terminal's signature verified"
|
||||||
|
|
||||||
self.eac_step += 1
|
self.eac_step += 1
|
||||||
|
|
||||||
return 0x9000, ""
|
return 0x9000, ""
|
||||||
|
|||||||
Reference in New Issue
Block a user