def _persoForZYT(card): aid = 'A00000033301010600030800005A5954' apdu = APDU(card) apdu.selectAID(aid) apdu.gpInit('404142434445464748494A4B4C4D4E4F', '404142434445464748494A4B4C4D4E4F', '404142434445464748494A4B4C4D4E4F', '0C') apdu.gpAuth() path = os.getcwd() persoFp = open(path + '\\'+ "zytPerso.idf",'r') l = persoFp.readlines() l = [e.replace('\n','')for e in l] i = 0 for e in l: i = i+1 if 'DGI' in e: li = e.split('=') dgi = li[0][3:] apduB = li[1] if i == len(l): last = True else: last = False if (int(dgi,16)&0x8000 ) == 0x8000: encrypt = False else : encrypt = False apdu.gpStoreData(apduB, last, encrypt)
def _installPPSE(card): card.Transmit('00A4040000') gp = GP.GP('404142434445464748494A4B4C4D4E4F', '404142434445464748494A4B4C4D4E4F', '404142434445464748494A4B4C4D4E4F', '0C') gp.Authentication(card, '01') aid = '325041592e5359532e4444463031' gp.Delete(aid,card) p = 'C900' + 'EF'+ LV('A0'+LV('A5038201C0810101')) P = 'C9038FF000EF0AA008810101A5038201C0' gp.Install(PKG_AID, MDL_AID, aid, card,p) apdu = APDU(card) apdu.selectAID(PPSE_AID) apdu.gpInit('404142434445464748494A4B4C4D4E4F', '404142434445464748494A4B4C4D4E4F', '404142434445464748494A4B4C4D4E4F', '0C') apdu.gpAuth() DGI9102_PPSE = '9102'+LV('A5'+LV81('BF0C'+LV('61'+LV('4F'+LV('A00000033301010600030800005A5954')+'50'+LV('50424F435F437265646974')+'870101')))) apdu.gpStoreData(DGI9102_PPSE, last = True)
def _installPPSE(card): card.Transmit('00A4040000') gp = GP.GP('404142434445464748494A4B4C4D4E4F', '404142434445464748494A4B4C4D4E4F', '404142434445464748494A4B4C4D4E4F', '0C') gp.Authentication(card, '01') aid = '325041592e5359532e4444463031' gp.Delete(aid, card) p = 'C900' + 'EF' + LV('A0' + LV('A5038201C0810101')) P = 'C9038FF000EF0AA008810101A5038201C0' gp.Install(PKG_AID, MDL_AID, aid, card, p) apdu = APDU(card) apdu.selectAID(PPSE_AID) apdu.gpInit('404142434445464748494A4B4C4D4E4F', '404142434445464748494A4B4C4D4E4F', '404142434445464748494A4B4C4D4E4F', '0C') apdu.gpAuth() DGI9102_PPSE = '9102' + LV('A5' + LV81('BF0C' + LV( '61' + LV('4F' + LV('A00000033301010600030800005A5954') + '50' + LV('50424F435F437265646974') + '870101')))) apdu.gpStoreData(DGI9102_PPSE, last=True)