2

eVRC(Electronic Vehicle Eegistration Cards)やJAVAでのAPD Uコマンドを読んだ経験のある人はいますか?

どんな例でも役に立ちます。

前もって感謝します。

4

2 に答える 2

4

javax.smartcardioライブラリを使用することを強くお勧めします。後のJavaランタイム環境では、64ビットや32ビットのアクセス条件など、いくつかの可用性の問題があることに注意してください。とは言うものの、APDUとCardTerminalインターフェースは、APDUを処理する他の多くのAPIと比較してかなりきれいです。

[UPDATE]コマンドについては、これは暗号化を行わない単純なファイルベースのカードのようであり、指定されたDF内で独自のファイル構造を採用しています。したがって、基本的な操作は次のとおりです。ATRを取得し、AIDでSELECTすると、DF(アプリケーションのルート)に移動します。次に、SELECT by File IDを使用して各ファイルを選択し、続いてX個のREADBINARYコマンドを選択します。

例えば

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

それはJava(私の頭のてっぺんから)にあるでしょう:

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

互換性のある方法でファイルの長さを見つけるために、READBINARYの最初の数バイトを解析する必要がある場合があることに注意してください。基本的にエラーが発生する可能性があるため、まだ残っている実際のバイト数を読み過ぎないように注意してください。ループするときは、要求された(最大)数ではなく、実際に返されたバイト数のみをカウントします。

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.

于 2012-03-01T22:15:02.053 に答える
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.

于 2013-11-13T01:37:59.347 に答える