APDU command to get the serial number of a smart card

时光怂恿深爱的人放手 提交于 2019-12-19 05:07:13

问题


How can I get the serial number of a smart card using APDU command? I have tried to query it by using SCardGetAttrib function of winscard.dll with no luck, I've been told to use an APDU command to do that since there is no standard way to get the serial number. The problem is that I can't figure out what type my smart cards are! So I have looked into the documents of few of popular smart card manufacturers with no luck to find a way to get the serial number!!

My card reader is ACR88.


回答1:


In the commands below the A0 might need to be 00 or something else (the code below works on a SIM card) :

SELECT MF :

=> A0A40000023F00 
<= 9F16

SELECT EFiccid :

=> A0A40000022FE2 
<= 9F0F

READ BINARY :

=> A0B000000A 
<= 984310011823020084F99000

Your ICCID is swapped and has a luhn check (984310011823020084F9 => 8934011081322000489).




回答2:


for SCOSTA specific cards you can use the following command to read the chip serial number under TAG 46, 00CA0046XX or 00CA0246XX "Last XX depends on the card varies for knowing the length give 00 and will give a response of '6CXX' where you can use xx for getting the correct data, this is because the length of serial number varies for card to card



来源:https://stackoverflow.com/questions/17677923/apdu-command-to-get-the-serial-number-of-a-smart-card

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