def ReadRecordExt(sfi, recno, p3, expectData='', expectSW='9000', info='', name='Read Record'): ''' Read Binary (INS : 'B2') cla: p1: p2: p3: expectSW: name: only for display Returns a two elements tuple: (response-data, sw1sw2) See <ISO 7816-4> 7.3.3 ''' response_data = api_pcsc.SendAPDU(cla='00', ins='B2', p1=recno, p2=sfi2p2_B2(sfi), p3=p3, data='', expectData=expectData, expectSW=expectSW, info=info, name=name) sw = api_pcsc.GetSW() return (response_data, sw)
def VerifyPIN(cla, p1, p2, p3, data='', expectSW='9000', info='', name='Verify PIN'): ''' Verify PIN (INS : '20') cla: p1: p2: p3: data: expectSW: info: name: only for display Returns a two elements tuple: (response-data, sw1sw2) See <ISO 7816-4> 7.5.6 ''' response_data = api_pcsc.SendAPDU(cla=cla, ins='20', p1=p1, p2=p2, p3=p3, data=data, expectSW=expectSW, info=info, name=name) sw = api_pcsc.GetSW() return (response_data, sw)
def UpdateBinary(cla, p1, p2, p3, data='', expectSW='9000', info='', name='Update Binary'): ''' Update Binary (INS : 'D6') cla: p1: p2: p3: data: expectSW: info: name: only for display Returns a two elements tuple: (response-data, sw1sw2) See <ISO 7816-4> 7.2.4 ''' response_data = api_pcsc.SendAPDU(cla=cla, ins='D6', p1=p1, p2=p2, p3=p3, data=data, expectSW=expectSW, info=info, name=name) sw = api_pcsc.GetSW() return (response_data, sw)
def GetResponse(cla, p1, p2, p3, expectData='', expectSW='9000', info='', name='Get Response'): ''' Get Response (INS : 'C0') cla: p1: p2: p3: expectSW: name: only for display Returns a two elements tuple: (response-data, sw1sw2) See <ISO 7816-4> 7.6.1 ''' response_data = api_pcsc.SendAPDU(cla=cla, ins='C0', p1=p1, p2=p2, p3=p3, data='', expectData=expectData, expectSW=expectSW, info=info, name=name) sw = api_pcsc.GetSW() return (response_data, sw)
def ExternalAuth(data, cla='00', p1='00', p2='00', p3='08', expectSW='9000', info='', name='External Authenticate'): ''' External Authenticate (INS : '82') data: cla: p1: p2: p3: expectSW: name: only for display Returns a two elements tuple: (response-data, sw1sw2) See <ISO 7816-4> 7.5.4 ''' response_data = api_pcsc.SendAPDU(cla=cla, ins='82', p1=p1, p2=p2, p3=p3, data=data, expectSW=expectSW, info=info, name=name) sw = api_pcsc.GetSW() return (response_data, sw)
def SelectFile(cla='00', p1='04', p2='00', data='', expectSW='9000', info='', name='Select File'): ''' Select File (INS : 'A4') cla: p1: p2: data: data to be sent to card, default is empty. 'P3' will be caculated automatic. expectSW: name: only for display Returns a two elements tuple: (response-data, sw1sw2) See <ISO 7816-4> 7.1.1 ''' p3, da = GetP3Data(data) response_data = api_pcsc.SendAPDU(cla=cla, ins='A4', p1=p1, p2=p2, p3=p3, data=da, expectSW=expectSW, info=info, name=name) sw = api_pcsc.GetSW() return (response_data, sw)