fixed parsing of CLA with proprietary SM
activates SM also for the proprietary case
This commit is contained in:
@@ -313,25 +313,25 @@ class Iso7816OS(SmartcardOS):
|
|||||||
logical_channel = class_byte & 0x0f
|
logical_channel = class_byte & 0x0f
|
||||||
logical_channel += 4
|
logical_channel += 4
|
||||||
#Bit 6 indicates secure messaging
|
#Bit 6 indicates secure messaging
|
||||||
secure_messaging = class_byte >> 5
|
secure_messaging = class_byte >> 6
|
||||||
secure_messaging &= 0x01
|
|
||||||
if (secure_messaging == 0x00):
|
if (secure_messaging == 0x00):
|
||||||
SM_STATUS = "No SM"
|
SM_STATUS = "No SM"
|
||||||
elif (secure_messaging == 0x01):
|
elif (secure_messaging == 0x01):
|
||||||
SM_STATUS = "Standard SM"
|
SM_STATUS = "Standard SM"
|
||||||
|
else:
|
||||||
|
# Bit 8 is set to 1, which is not specified by ISO 7816-4
|
||||||
|
SM_STATUS = "Proprietary SM"
|
||||||
#In both cases Bit 5 specifies command chaining
|
#In both cases Bit 5 specifies command chaining
|
||||||
command_chaining = class_byte >> 5
|
command_chaining = class_byte >> 5
|
||||||
command_chaining &= 0x01
|
command_chaining &= 0x01
|
||||||
#}}}
|
#}}}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if SM_STATUS == "Standard 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))
|
||||||
elif SM_STATUS == "Proprietary SM":
|
|
||||||
raise SwError(SW["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)
|
||||||
if SM_STATUS == "Standard SM":
|
if SM_STATUS == "Standard SM" or SM_STATUS == "Proprietary SM":
|
||||||
answer = self.formatResult(Iso7816OS.seekable(c.ins), c.effective_Le, result, sw, True)
|
answer = self.formatResult(Iso7816OS.seekable(c.ins), c.effective_Le, result, sw, True)
|
||||||
else:
|
else:
|
||||||
answer = self.formatResult(Iso7816OS.seekable(c.ins), c.effective_Le, result, sw, False)
|
answer = self.formatResult(Iso7816OS.seekable(c.ins), c.effective_Le, result, sw, False)
|
||||||
|
|||||||
Reference in New Issue
Block a user