最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javacard - Java Card applet selection - Stack Overflow

programmeradmin5浏览0评论

I encountered a problem performing select for an installed applet. The applet is HelloWorld app from the Java Card SDK 2.2.1

If I understand correctly, after opening secure channel I should select an applet (execute the select command) and then send an apdu command to the selected applet. After that, HelloWorld should return the payload of the received command in response.

I am using gpshell. The applet is installed on a physical card. get_status -element 20 returns the following:

When I try to execute select I get error 6108. (Also tried d00000006203010c01 - same result)

The sequence of commands to execute in gpshell is as follows:

mode_211

enable_trace

set_context

card_connect

select -AID A000000003000000

open_sc -security 3 -scpimpl 0x15 -scp 2 -keyind 0 -key 404142434445464748494a4b4c4d4e4f -keyDerivation emvcps11

get_status -element 20

select -AID d00000006203010c01

I'm just starting to work with Java Card, so maybe the problem is obvious. What am I doing wrong?

P.S. According to code 6108 is not an error code(??) It is Info message (61 - SW1; 08 - number of bytes available - SW2 ). So why gpshell terminate connection?

I encountered a problem performing select for an installed applet. The applet is HelloWorld app from the Java Card SDK 2.2.1

If I understand correctly, after opening secure channel I should select an applet (execute the select command) and then send an apdu command to the selected applet. After that, HelloWorld should return the payload of the received command in response.

I am using gpshell. The applet is installed on a physical card. get_status -element 20 returns the following:

When I try to execute select I get error 6108. (Also tried d00000006203010c01 - same result)

The sequence of commands to execute in gpshell is as follows:

mode_211

enable_trace

set_context

card_connect

select -AID A000000003000000

open_sc -security 3 -scpimpl 0x15 -scp 2 -keyind 0 -key 404142434445464748494a4b4c4d4e4f -keyDerivation emvcps11

get_status -element 20

select -AID d00000006203010c01

I'm just starting to work with Java Card, so maybe the problem is obvious. What am I doing wrong?

P.S. According to https://www.eftlab/knowledge-base/complete-list-of-apdu-responses code 6108 is not an error code(??) It is Info message (61 - SW1; 08 - number of bytes available - SW2 ). So why gpshell terminate connection?

Share Improve this question edited Mar 26 at 16:35 Alan Kazbekov asked Mar 26 at 13:36 Alan KazbekovAlan Kazbekov 1,1892 gold badges12 silver badges34 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

As you already have guessed, your command is returning data, and you should issue a GET RESPONSE with Lc = SW2 in order to read the remaining bytes. The response probably contains the FCI, FCP, AID, or other proprietary data returned by the applet upon selection.

The command should be as follows

00 C0 00 00 08

The reason why the command is returning 61 XX instead of the response bytes followed by 90 00 seems to be that gpshell is sending here the SELECT command without Le field (case 3 - no response). The best move would be to send the SELECT command with a Le field set to 00 (case 4 - return all the bytes from the response).

发布评论

评论列表(0)

  1. 暂无评论