在仿真器上成功进行Java Card开发之后,我正在处理真正的Java卡(Gemalto IDCore 3010)。我一直在使用Global Platform,但即使使用最基本的示例代码也会遇到问题,这会在卡片上列出小程序。
这是原始代码:
mode_201
enable_trace
establish_context
card_connect
select -AID a0000000030000
open_sc -security 1 -keyind 0 -keyver 0 -mac_key 404142434445464748494a4b4c4d4e4f -enc_key 404142434445464748494a4b4c4d4e4f // Open secure channel
get_status -element e0
card_disconnect
release_context
我已修改过,现在就是这样:
//I changed this, because the Card Management & API is compliant with GP2.1.1.
mode_211
enable_trace
establish_context
//Switches are not necessary as I am using only one single-slot card reader
card_connect
//The auto-detected ISD AID of the card is: A000000018434D00
select -AID A000000018434D00
//This is the line where the command fails
open_sc -security 0 -keyind 0 -keyver 0 -keyDerivation none -key 47454d5850524553534f53414d504c45 // Open secure channel
//This would list applets and packages and security domains
get_status -element e0
card_disconnect
release_context
在Global Platform页面上,可以发现这些是 open_sc 命令的开关:
open_sc -keyind x -keyver x -key xyz -mac_key xyz -enc_key xyz -kek_key xyz -security x -scp x -scpimpl x -keyDerivation x
Open secure channel
但遗憾的是,我无法在这些开关上找到足够的信息。
这是我通过修改后的代码获得的错误消息:
C:\JavaCard\GPShell-1.4.4>GPShell.exe list.txt
mode_211
enable_trace
establish_context
card_connect
select -AID A000000018434D00
Command --> 00A4040008A000000018434D00
Wrapped command --> 00A4040008A000000018434D00
Response <-- 6F198408A000000018434D00A50D9F6E061291518101009F6501FF9000
open_sc -security 0 -keyind 0 -keyver 0 -keyDerivation none -key 47454d585052455
3534f53414d504c45 // Open secure channel
Command --> 80CA006600
Wrapped command --> 80CA006600
Response <-- 6A88
GP211_get_secure_channel_protocol_details() returns 0x80206A88 (6A88: Referenced
data not found.)
有人可以告诉我出了什么问题以及我应该如何参数化和执行 open_sc 命令?非常感谢你!
解决方案:这是工作版本:
mode_201
enable_trace
establish_context
card_connect
select -AID A000000018434D00
open_sc -scp 1 -scpimpl 0x15 -security 3 -keyind 0 -keyver 0 -key 47454d5850524553534f53414d504c45 -keyDerivation visa2
get_status -element e0
card_disconnect
release_context
答案 0 :(得分:1)
不幸的是,与日常生活中的其他设备相比,完整的手册或说明通常不提供智能卡。如果您没有一些必要的参数,则会丢失。尝试使用开关mode_201
:
mode_201
enable_trace
enable_timer
establish_context
card_connect
select -AID A000000018434D00
open_sc -security 3 -keyind 0 -keyver 0 -key 47454d5850524553534f53414d504c45 -keyDerivation visa2 // Open secure channel
get_status -element e0
card_disconnect
release_context
有一个名为 listgemXpressoProR3_2E64.txt 的示例文件:https://sourceforge.net/p/globalplatform/code/HEAD/tree/trunk/gpshell/helloInstallgemXpressoProR3_2E64.txt
也许您的卡与此金雅拓卡兼容。
答案 1 :(得分:-1)
请尝试以下脚本:
mode_211
gemXpressoPro
enable_trace
establish_context
card_connect -readerNumber 1
select -AID A000000018434D00
open_sc -security 3 -keyind 0 -keyver 0 -key 47454d5850524553534f53414d504c45 -mac_key 47454d5850524553534f53414d504c45 -enc_key 47454d5850524553534f53414d504c45 // Open secure channel
delete -AID A000000482
card_disconnect
release_context