wrap errors in sm if decryption was successfull
This commit is contained in:
@@ -328,22 +328,21 @@ class Iso7816OS(SmartcardOS):
|
|||||||
command_chaining &= 0x01
|
command_chaining &= 0x01
|
||||||
#}}}
|
#}}}
|
||||||
|
|
||||||
|
sm = False
|
||||||
try:
|
try:
|
||||||
if SM_STATUS == "Standard SM" or SM_STATUS == "Proprietary SM":
|
if SM_STATUS == "Standard SM" or SM_STATUS == "Proprietary 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))
|
logging.info("Decrypted APDU:\n%s", str(c))
|
||||||
|
sm = True
|
||||||
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)
|
||||||
if SM_STATUS == "Standard SM" or SM_STATUS == "Proprietary SM":
|
answer = self.formatResult(Iso7816OS.seekable(c.ins), c.effective_Le, result, sw, sm)
|
||||||
answer = self.formatResult(Iso7816OS.seekable(c.ins), c.effective_Le, result, sw, True)
|
|
||||||
else:
|
|
||||||
answer = self.formatResult(Iso7816OS.seekable(c.ins), c.effective_Le, result, sw, False)
|
|
||||||
except SwError as e:
|
except SwError as e:
|
||||||
logging.info(e.message)
|
logging.info(e.message)
|
||||||
import traceback
|
import traceback
|
||||||
traceback.print_exception(*sys.exc_info())
|
traceback.print_exception(*sys.exc_info())
|
||||||
sw = e.sw
|
sw = e.sw
|
||||||
result = ""
|
result = ""
|
||||||
answer = self.formatResult(False, 0, result, sw, False)
|
answer = self.formatResult(False, 0, result, sw, sm)
|
||||||
|
|
||||||
return answer
|
return answer
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user