2

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.

asked Mar 1, 2012 at 9:10

2 Answers 2

4

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.

answered Mar 1, 2012 at 22:15
Sign up to request clarification or add additional context in comments.

12 Comments

I am using javax.smartcardio libraries, but i have problem with exact commands, for example how to read data on some specific tag at smart card, i need some command examples if someone have.
Could you point me to the specifications? I could not find it on the internet. It should not be too hard with ISO 7816-4 and the specifications. Otherwise, show me the commands that you did try and which failed, I'll probably recognize them.
Yes, it is ISO 7816-4. That is a specification.
7816-4 is a meta specification at best. It specifies the basics of a file based chip operating system, nothing more, nothing specific. APDU structures are described, but many things are not filled in. You need more than that to implement anything.
I think that this is specification eur-lex.europa.eu/LexUriServ/… . I understand that i have to select file and get data, but i need some example code of command for selecting file and get data of some tag.
|
0

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.

answered Nov 13, 2013 at 1:37

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.