Reputation: 917
I'm looking for smart card readers that can write and read data to/from the smart card. i found that many are using the PCSC API. Can PCSC allow me to write my own data to the card? (intending to write example user name user number to the card), then i can also read this data back via the API for my own software to process it?
i read thru a few sites including this https://ludovicrousseau.blogspot.sg/2010/04/pcsc-sample-in-c.html
it seems that Scardtransmit can only send commands and get the reply? don't really get how it works
Upvotes: -1
Views: 4068
Reputation: 94058
Yes, in general this is possible if your card supports it and you can authenticate to the card for write access.
There are many many different smart cards out there. PCSC is an API, originally by Microsoft, to provide a standardized API to communicate between PC and Smart Card (hence the name). As the actual reading and writing to memory is performed by the smart card chip itself, any reader that supports PCSC can be used by an application to write data to the chip.
Of course, your card should be compatible with the reader. Furthermore, it should either be a memory card, file system card or programmable smart card. PCSC was designed for the latter two - smart cards should have a general purpose CPU according to most documents. However, some memory cars like DESFire v2 also provide a higher level CPU interface. Furthermore, many readers provide proprietary API's (for older memory card standards) that are accessible through SCardTransmit with the CLA byte set to FF
.
How data can be written depends on the smart card. In ISO/IEC 7816-4 - which defined file system cards but is often also used for general purpose smart cards - there are commands to write to file (UPDATE BINARY) or record. DESFire has its own protocol however. You'll need the documentation, test cards and test keys to authenticate to the smart card first. To make this easier many manufacturers and resellers offer development kits that include smart cards, a compatible reader, sample software and sometimes even a complete development environment.
Upvotes: 3