vicc: debug parsed APDU

closes https://github.com/frankmorgner/vsmartcard/pull/103/
This commit is contained in:
Frank Morgner
2022-05-06 12:24:03 +02:00
parent fe5977bc39
commit 4b872bb000

View File

@@ -283,12 +283,8 @@ class Iso7816OS(SmartcardOS):
""" """
raise SwError(SW["ERR_INSNOTSUPPORTED"]) raise SwError(SW["ERR_INSNOTSUPPORTED"])
logging.info("Command APDU (%d bytes):\n %s", len(msg),
hexdump(msg, indent=2))
try: try:
c = C_APDU(msg) c = C_APDU(msg)
logging.debug("%s", str(c))
except ValueError as e: except ValueError as e:
logging.warning(str(e)) logging.warning(str(e))
return self.formatResult(False, 0, b"", return self.formatResult(False, 0, b"",
@@ -607,10 +603,21 @@ class VirtualICC(object):
size, len(msg)) size, len(msg))
logging.info("Command APDU (%d bytes):\n %s\n", len(msg), logging.info("Command APDU (%d bytes):\n %s\n", len(msg),
hexdump(msg, indent=2)) hexdump(msg, indent=2))
try:
logging.debug(str(C_APDU(msg)))
except:
pass
answer = self.os.execute(msg) answer = self.os.execute(msg)
try:
logging.debug(str(R_APDU(answer)))
except:
pass
logging.info("Response APDU (%d bytes):\n %s\n", len(answer), logging.info("Response APDU (%d bytes):\n %s\n", len(answer),
hexdump(answer, indent=2)) hexdump(answer, indent=2))
self.__sendToVPICC(answer) self.__sendToVPICC(answer)
def stop(self): def stop(self):