Пример #1
0
 def application_selection(self, aid):
     resp = super().application_selection(aid)
     tools.output_apdu_info(resp)
     self.store_tag_group(PROCESS_STEP.SELECT,
                          utils.parse_tlv(resp.response))
     # self.run_case('case_application_selection','run_visa',resp)
     return resp
Пример #2
0
 def gpo(self):
     tag9F38 = self.get_tag(PROCESS_STEP.SELECT, '9F38')
     data = ''
     if tag9F38:
         data = tools.assemble_dol(tag9F38)
     resp = super().gpo(data)
     if resp.sw == 0x9000:
         tools.output_apdu_info(resp)
         self.store_tag_group(PROCESS_STEP.GPO,
                              utils.parse_tlv(resp.response))
         # self.run_case('case_gpo','run_visa',resp)
     return resp
Пример #3
0
 def second_gac(self):
     tag8D = self.get_tag(PROCESS_STEP.READ_RECORD, '8D')
     data = tools.assemble_dol(tag8D)
     resp = super().gac(Crypto_Type.TC, data)
     if resp.sw != 0x9000:
         Log.info('send gac1 failed.')
         return
     tlvs = utils.parse_tlv(resp.response)
     tools.output_apdu_info(resp)
     self.store_tag_group(PROCESS_STEP.SECOND_GAC,
                          utils.parse_tlv(resp.response))
     return resp
Пример #4
0
 def gpo(self):
     tag9F38 = self.get_tag(PROCESS_STEP.SELECT, '9F38')
     pdol = ''
     if tag9F38:
         pdol = tools.assemble_dol(tag9F38)
     resp = super().gpo(pdol)
     if resp.sw == 0x9000:
         tools.output_apdu_info(resp)
         tlvs = utils.parse_tlv(resp.response)
         self.store_tag_group(PROCESS_STEP.GPO, tlvs)
         self.run_case('case_gpo', resp)
     return resp
Пример #5
0
 def first_gac(self):
     tag8C = self.get_tag(PROCESS_STEP.READ_RECORD, '8C')
     data = tools.assemble_dol(tag8C)
     resp = super().gac(Crypto_Type.ARQC, data)
     if resp.sw != 0x9000:
         Log.info('send gac1 failed.')
         return
     tlvs = utils.parse_tlv(resp.response)
     tools.output_apdu_info(resp)
     self.store_tag_group(PROCESS_STEP.FIRST_GAC,
                          utils.parse_tlv(resp.response))
     self.run_case('case_first_gac', 'run_mc', resp)
     return resp
Пример #6
0
 def read_record(self,tag94):
     '''
     读记录数据
     '''
     resps = []
     afls = utils.parse_afl(tag94)
     for afl in afls:
         Log.info('read record: %02X%02X',afl.sfi,afl.record_no)
         resp = apdu.read_record(afl.sfi,afl.record_no)
         if resp.sw != 0x9000:
             Log.error('read record wrong')
             return resps
         tools.output_apdu_info(resp)
         resps.append(resp)
         if afl.is_static_sign_data:
             self.sig_data += utils.remove_template70(resp.response)
     return resps
Пример #7
0
 def first_gac_cda(self):
     tag8C = self.get_tag(PROCESS_STEP.READ_RECORD, '8C')
     if not tag8C:
         Log.error('first gac cda faild since tag8C is tempty')
         return False
     tls = utils.parse_tl(tag8C)
     data = ''
     self.unpredicatble_number = ''
     for tl in tls:
         data += terminal.get_terminal(tl.tag, tl.len)
         if tl.tag == '9F37':
             self.unpredicatble_number = terminal.get_terminal(
                 tl.tag, tl.len)
     resp = super().gac(Crypto_Type.TC_CDA, data)
     if resp.sw != 0x9000:
         Log.error('send first gac command failed. SW:%04X', resp.sw)
         return
     tlvs = utils.parse_tlv(resp.response)
     tools.output_apdu_info(resp)
     self.store_tag_group(PROCESS_STEP.FIRST_GAC, tlvs)