简体   繁体   English

eVRC智能卡

[英]eVRC smart cards

Does anyone have experience with reading eVRC (Electronic Vehicle Eegistration Cards), and APD U commands in JAVA? 是否有人有阅读过Java中的eVRC(电子车辆登记卡)和APD U命令的经验?

Any example will be useful. 任何示例都是有用的。

Thanks in advance. 提前致谢。

I would strongly suggest you would go with the javax.smartcardio libraries. 我强烈建议您使用javax.smartcardio库。 Note that there are some availability issues, such as for 64 bit and access conditions for 32 bits in the later Java runtime environments. 请注意,存在一些可用性问题,例如在更高版本的Java运行时环境中,对于64位和32位的访问条件。 That said, the APDU and CardTerminal interface is pretty neat compared to many other API's dealing with APDU's. 也就是说,与许多其他处理APDU的API相比,APDU和CardTerminal接口非常整洁。

[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. 关于命令的[UPDATE],这似乎是一个简单的基于文件的卡 ,不执行任何加密,并且在指定的DF中采用专有的文件结构。 So the basic operation is: retrieve ATR, SELECT by AID, now you are in the DF (the root of the application). 因此,基本操作是:检索ATR,通过AID进行SELECT,现在您位于DF(应用程序的根目录)中。 Then select each file using SELECT by File ID, followed by an X number of READ BINARY commands. 然后,使用SELECT(通过文件ID)和X个READ BINARY命令来选择每个文件。

Eg 例如

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): 那将是在Java中(超出我的头脑):

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. 请注意,您可能需要解析READ BINARY的前几个字节,以兼容的方式找出文件长度。 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). 如果使用的是智能卡IO库,则只需指定前4个字节作为标头,然后指定数据(将为您计算命令数据的长度),然后指定Ne(要返回的最大字节数) (如果适用)。

The main pain is parsing the underlying BER structure and verifying the signature of course, but I consider that out of scope. 主要的麻烦当然是解析底层的BER结构并验证签名,但是我认为这超出了范围。

You may like https://github.com/grakic/jevrc 您可能喜欢https://github.com/grakic/jevrc

JEvrc is a reusable open source Java library for reading public data from the Serbian/EU eVRC card. JEvrc是可重用的开源Java库,用于从Serbian / EU eVRC卡读取公共数据。 It includes a simplified TLV parser for parsing card data. 它包括一个简化的TLV解析器,用于解析卡数据。 It supports Serbian eVRC card profile but should be possible to generalize with a patch or two. 它支持塞尔维亚eVRC卡配置文件,但应该可以使用一两个补丁来推广。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM