better debug output

git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@695 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
frankmorgner
2012-01-25 09:49:50 +00:00
parent 2ecea8ae4c
commit 72f5d00a53
2 changed files with 9 additions and 18 deletions

View File

@@ -274,6 +274,8 @@ class Iso7816OS(SmartcardOS):
except ValueError as e:
logging.warning(str(e))
return self.formatResult(False, 0, "", SW["ERR_INCORRECTPARAMETERS"], False)
logging.info("Parsed APDU:\n%s", str(c))
#Handle Class Byte
#{{{
@@ -325,6 +327,7 @@ class Iso7816OS(SmartcardOS):
try:
if SM_STATUS == "Standard SM":
c = self.SAM.parse_SM_CAPDU(c, header_authentication)
logging.info("Decrypted APDU:\n%s", str(c))
elif SM_STATUS == "Proprietary SM":
raise SwError("ERR_SECMESSNOTSUPPORTED")
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",
size, len(msg))
logging.info("APDU (%d Bytes):\n%s", len(msg),
hexdump(msg, short=True))
answer = self.os.execute(msg)
logging.info("RESP (%d Bytes):\n%s\n", len(answer),
hexdump(answer, short=True))
logging.info("Response APDU (%d Bytes):\n%s\n", len(answer),
hexdump(answer))
self.__sendToVPICC(answer)
def stop(self):

View File

@@ -128,7 +128,6 @@ class nPA_SE(Security_Environment):
if (p1, p2) != (0x00, 0x00):
raise SwError(SW["ERR_INCORRECTPARAMETERS"])
print "performing PACE step", self.eac_step + 1
if self.eac_step == 0 and self.at.algorithm == "PACE":
return self.__eac_pace_step1(data)
elif self.eac_step == 1 and self.at.algorithm == "PACE":
@@ -258,6 +257,8 @@ class nPA_SE(Security_Environment):
pace.print_ossl_err()
raise SwError(SW["WARN_NOINFO63"])
print "Established PACE channel"
if self.at.keyref_is_can():
if (self.sam.counter == 1):
self.sam.active = True
@@ -330,25 +331,14 @@ class nPA_SE(Security_Environment):
else:
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,
pace.get_buf(self.at.eph_pub_key), id_picc,
auxiliary_data, pace.get_buf(data)):
pace.print_ossl_err()
raise SwError(SW["ERR_CONDITIONNOTSATISFIED"])
print "Terminal's signature verified"
self.eac_step += 1
return 0x9000, ""