catch SwErrors in formatResult

This commit is contained in:
Frank Morgner
2013-07-09 07:24:15 +02:00
parent 50b2f85cc4
commit 8e5d044ab5

View File

@@ -529,7 +529,15 @@ class NPAOS(Iso7816OS):
result = data[:le] result = data[:le]
if sm: if sm:
sw, result = self.SAM.protect_result(sw, result) try:
sw, result = self.SAM.protect_result(sw, result)
except SwError as e:
logging.info(e.message)
import traceback
traceback.print_exception(*sys.exc_info())
sw = e.sw
result = ""
answer = self.formatResult(False, 0, result, sw, False)
return R_APDU(result, inttostring(sw)).render() return R_APDU(result, inttostring(sw)).render()