Question

Does anyone have experience with reading eVRC (Electronic Vehicle Eegistration Cards), and APD U commands in JAVA?

Any example will be useful.

Thanks in advance.

Was it helpful?

Solution

I would strongly suggest you would go with the javax.smartcardio libraries. Note that there are some availability issues, such as for 64 bit and access conditions for 32 bits in the later Java runtime environments. That said, the APDU and CardTerminal interface is pretty neat compared to many other API's dealing with APDU's.

[UPDATE] about the commands, this seems to be a simple file based card that does not perform any encryption, and employs a proprietary file structure within the specified DF. So the basic operation is: retrieve ATR, SELECT by AID, now you are in the DF (the root of the application). Then select each file using SELECT by File ID, followed by an X number of READ BINARY commands.

E.g.

send "00A4040C 0X <AID>" // SELECT DF aid was not given in document, so find this out, probably JRC
send "00A40200 02 D001 00" // SELECT EF.Registration_A (and hopefully parse the response to get the file length)

send "00B00000 00" // READ BINARY return up to 256 bytes or
send "00B00005 XX" // READ BINARY return xx bytes, the number of bytes left, from offset 05

That would be in Java (out of the top of my head):

CommandAPDU command = new CommandAPDU(0x00, 0xA4, 0x02, 0x00, new byte[] { (byte) 0xD0, (byte) 0x01 }, 256);
ResponseAPDU response = channel.send(command);

Note that you might need to parse the first few bytes of the READ BINARY to find out the file length in a compatible way. Make sure you don't read over the actual number of bytes still left as you might get any error basically. When looping, only count the number of bytes actually returned, not the (maximum) number requested.

If you are using the smartcard IO libs, you only have to specify the first 4 bytes as the header, then the data (the length of the command data will be calculated for you) and then Ne, the maximum number of bytes you want returned (if applicable).

The main pain is parsing the underlying BER structure and verifying the signature of course, but I consider that out of scope.

OTHER TIPS

You may like https://github.com/grakic/jevrc

JEvrc is a reusable open source Java library for reading public data from the Serbian/EU eVRC card. It includes a simplified TLV parser for parsing card data. It supports Serbian eVRC card profile but should be possible to generalize with a patch or two.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top