def parse_SE_config(self, config): r = 0x9000 try: ControlReferenceTemplate.parse_SE_config(self, config) except SwError as e: structure = unpack(config) for tlv in structure: tag, length, value = tlv if tag == 0x7f4c: self.chat = CHAT(bertlv_pack([[tag, length, value]])) print(self.chat) elif tag == 0x67: self.auxiliary_data = bertlv_pack([[tag, length, value]]) elif tag == 0x80 or tag == 0x84 or tag == 0x83 or tag == 0x91: # handled by ControlReferenceTemplate.parse_SE_config pass else: raise SwError(SW["ERR_REFNOTUSABLE"]) structure = unpack(config) pin_ref_str = '%c'% self.PACE_PIN for tlv in structure: if [0x83, len(pin_ref_str), pin_ref_str] == tlv: if self.sam.counter <= 0: r = 0x63c0 elif self.sam.counter == 1: r = 0x63c1 elif self.sam.counter == 2: r = 0x63c2 return r, ""
def parse_SE_config(self, config): r = 0x9000 try: ControlReferenceTemplate.parse_SE_config(self, config) except SwError as e: structure = unpack(config) for tlv in structure: tag, length, value = tlv if tag == 0x7f4c: self.chat = CHAT(bertlv_pack([[tag, length, value]])) print(self.chat) elif tag == 0x67: self.auxiliary_data = bertlv_pack([[tag, length, value]]) elif tag == 0x80 or tag == 0x84 or tag == 0x83 or tag == 0x91: # handled by ControlReferenceTemplate.parse_SE_config pass else: raise SwError(SW["ERR_REFNOTUSABLE"]) return r, ""
def parse_SE_config(self, config): r = 0x9000 try: ControlReferenceTemplate.parse_SE_config(self, config) except SwError as e: structure = unpack(config) for tlv in structure: tag, length, value = tlv if tag == 0x7f4c: self.chat = CHAT(bertlv_pack([[tag, length, value]])) elif tag == 0x67: self.auxiliary_data = bertlv_pack([[tag, length, value]]) # extract reference values for verifying # DateOfBirth, DateOfExpiry and CommunityID for ddo in decodeDiscretionaryDataObjects(value): try: oidvalue = ddo[0][2] reference = ddo[1][2] mapped_algo = ALGO_MAPPING[oidvalue] if mapped_algo == "DateOfBirth": self.DateOfBirth = int(reference) logging.info("Found reference DateOfBirth: " + str(self.DateOfBirth)) elif mapped_algo == "DateOfExpiry": self.DateOfExpiry = int(reference) logging.info("Found reference DateOfExpiry: " + str(self.DateOfExpiry)) elif mapped_algo == "CommunityID": self.CommunityID = binascii.hexlify(reference) logging.info("Found reference CommunityID: " + str(self.CommunityID)) except: pass elif tag == 0x80 or tag == 0x84 or tag == 0x83 or tag == 0x91: # handled by ControlReferenceTemplate.parse_SE_config pass else: raise SwError(SW["ERR_REFNOTUSABLE"]) return r, b""
def parse_SE_config(self, config): r = 0x9000 try: ControlReferenceTemplate.parse_SE_config(self, config) except SwError as e: structure = unpack(config) for tlv in structure: tag, length, value = tlv if tag == 0x7f4c: self.chat = CHAT(bertlv_pack([[tag, length, value]])) elif tag == 0x67: self.auxiliary_data = bertlv_pack([[tag, length, value]]) # extract reference values for verifying # DateOfBirth, DateOfExpiry and CommunityID for ddo in decodeDiscretionaryDataObjects(value): try: oidvalue = ddo[0][2] reference = ddo[1][2] mapped_algo = ALGO_MAPPING[oidvalue] if mapped_algo == "DateOfBirth": self.DateOfBirth = int(reference) logging.info("Found reference DateOfBirth: " + str(self.DateOfBirth)) elif mapped_algo == "DateOfExpiry": self.DateOfExpiry = int(reference) logging.info("Found reference DateOfExpiry: " + str(self.DateOfExpiry)) elif mapped_algo == "CommunityID": self.CommunityID = binascii.hexlify(reference) logging.info("Found reference CommunityID: " + str(self.CommunityID)) except: pass elif tag == 0x80 or tag == 0x84 or tag == 0x83 or tag == 0x91: # handled by ControlReferenceTemplate.parse_SE_config pass else: raise SwError(SW["ERR_REFNOTUSABLE"]) return r, ""
def __init__(self): ControlReferenceTemplate.__init__(self, CRT_TEMPLATE["AT"]) self.chat = None DateOfBirth = None DateOfExpiry = None CommunityID = None
def __init__(self): ControlReferenceTemplate.__init__(self, CRT_TEMPLATE["AT"]) self.chat = None