How to read Smart Card data

二次信任 提交于 2019-12-24 07:38:22

问题


I am trying to retrieve the data from the smart card using smart card reader. I've used the software (PascProbe.exe) to obtain all the data I've could. This what I got:

Card Reader: OMNIKEY CardMan 5x21-CL 0
ATR=3B8F8001804F0CA0000003060A0018000000007A (hex)
Card type: PicoPass 2KS
Card serial number (CSN, UID): 504B4901FBFF12E0 (hex);
PACS bits (raw Wiegand) data: 000000202FA473F8
applying HID H10304 card format:
Facility Code: =762
Card Number: =145916

I understand how to get CSN(UID) and ATR from card using APDU, and I understand how to get facility code and card number from PACS bits (here H10304 card format), but I don't know what I need to know in order to retrieve "PACS bits" from the smart card. Please help. (I am using .Net)
Thx in advance


回答1:


You do something like this (in both .NET and C++, it makes no difference), using Omnikey 5x21 and APDU commands.

  1. Start secured session (READ, NOT WRITE).
  2. Select 0x00
  3. Auth with KD 0x21
  4. Read 0x06, 0x07, 0x08, 0x09. (If you do this inside secured session its the real data written on the card, otherwise its FF FF FF FF FF .....)
  5. Now, did you get your Wiegand at 0x07? If yes, done. Esle Read 0x07 again, but set the 3rd byte 0x80, not at 0x00.(this depends on the card you have)
  6. End your session.

The way you use APDU commands in Secured Session is quite different, you need the read key. Also there is DES encryption for the communication.

You can read the dev-guide about 5x21-CL. But Im sure you did it at the time reading this.



来源:https://stackoverflow.com/questions/40431877/how-to-read-smart-card-data

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