Example #1
0
 def listreaders(self):
     return gp.listReaders(self.__context)
Example #2
0
def INFO(info):
    print("INFO " + info)

def INFO_ARRAY(a):
    INFO(''.join('%02X' %(ord(c)) for c in a))

def str_bin(s):
    for i in len(s) >> 1:
        pass
    
if __name__ == "__main__":
    gp.enableTraceMode(True)
    
    c = gp.establishContext()
    
    readernames = gp.listReaders(c)
    for i in range(len(readernames)):
        print('%d - %s' %(i, readernames[i]))
    i = int(input("Please select one reader: "))
    cc = gp.connectCard(c, readernames[i], gp.SCARD_PROTOCOL_T1)
    
    gp.sendApdu(c, cc, None, '\x00\xB0\x00\x00\x00')
    gp.selectApplication(c, cc, '')
    sc = gp.mutualAuthentication(c, cc, gp.DEFAULT_KEY, gp.DEFAULT_KEY, gp.DEFAULT_KEY, gp.DEFAULT_KEY, 0x00, 0x00, 0x02, 0x15, 0, 0)
    
    INFO("Get status:")
    try:
        status10 = gp.getStatus(c, cc, None, gp.GET_STATUS_P1_EXECUTABLE_LOAD_FILES_MODULES)
        INFO("    Status 0x10: " + str(status10))
    except:
        pass