Authentication on website using smart card in python

為{幸葍}努か 提交于 2020-02-27 22:32:08

问题


So I have a smart card provided by the company which looks like a credit card with a chip. This card logins on a website after the card is inserted into the card reader.

Now I have to write a program in python which can read the card and login on that website using Requests module. I tried to find out how to retrieve this authentication data from the card using python script and then use this data but I am partially successful. I installed the pyscard:

from smartcard.System import readers
from smartcard.util import toHexString

r=readers()
print(r)

connection = r[0].createConnection()
connection.connect()
SELECT = [0xA0, 0x88, 0x00, 0x00] # CLA, INS, P1, P2
DF_TELECOM = [ 0x02, 0x7F, 0x10]  # Lc, Data, Le
data, sw1, sw2 = connection.transmit( SELECT + DF_TELECOM )

So far I am able to transmit data and retrieve some data from card. I sent the command 88 in INS (Source : ISO 7816) which is for some sort of internal authentication( I assume this authentication data is used to login on the website) but I get below response :

data = []
sw1 = 110
sw2 = 00

I couldn't find the meaning of this response in ISO 7816. Can somebody tell me whether I have the right approach or hint to proceed further from here? In short, i want to know how to login on the website using python script and smart card?


回答1:


Basically, the response you're getting is essentially "6E00" which means "Class not supported", just replace the "INS" value with 0x00 and you should be fine



来源:https://stackoverflow.com/questions/60112869/authentication-on-website-using-smart-card-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!