问题
I have SCR3310v2.0 reader and chip card SLE5528, There are any code samples to be able to record and read the card information, or is there are any free software who do it?
回答1:
I'm using ACR38 so it may be a little different.
If you just started with smartcards, you should defiantly get some SDK (which is basically what you're asking for).
As for the SLE5528: The card is really basic, there are 3 commands which you want to be aware of.
1)Read, can use this command anytime (as long as you're connected). with the ACR38, I will send this command:
FF B2 MSB LSB Length
This is an APDU command, the first byte named CLA and the second is INS. these two are usually used to describe the command (maybe always). then you have P1 and P2, these two bytes are usually used to describe the address on the card or the range of the command. the last one is Lc, in that case (maybe always) it represents the number of bytes to read. any byte after these, is a data byte which a command may require.
Note that because this industry is so wild, some manufacturers may use different commands. If I remember correctly, the manual I used specified B0 in the INS but in the SDK demo code they used B2 which also was the only thing that worked.
2)Verify PSC, you must use this command first if you plan to use the write command. (once for each session).
FF 20 00 00 02 PSC1 PSC2
Usually the default PSC code is FF FF.
3)Write, after verifying with the card you can execute this command to write data:
FF D0 MSB LSB Length DATA1 DATA2 DATA3 and so on.....
If I wanted to change the PSC code, all I had to do is to write it's three byte into the address 03 FD. note that the actual verification code is only two bytes, but for some reason I always need to write the first byte as FF and then the actual two bytes which I want to verify with. I believe that there is some reason behind this, I just don't know what it is.
So, to write a simple program which first reads 14 bytes from address A4 03. then verify with the card using the default PSC code. and at last changes the PSC code to A2 B2; we will do this:
<< FF B2 A4 03 0E
>> FF FF FF FF FF FF FF FF FF FF FF FF FF FF 90 00
<< FF 20 00 00 02 FF FF
>> FF FF FF 90 00
<< FF D0 03 FD 03 FF A2 B2
>> FF A2 B2 90 00
Note that the reader will always return two additional bytes to what we're expecting. these two bytes called the SW code (or the status code). 90 00 means all good. you can find references for the meaning of each return code
here is the manual for the reader that I'm working with: http://www.acs.com.hk/drivers/eng/PMA_ACR38x.pdf
If you can, use java as they have built in functions for working with smart cards, otherwise. you can do what I did and work with the WinSCard API of windows.
来源:https://stackoverflow.com/questions/6895072/scr3310v2-0-and-sle5528-read-write