Discussion:
Get error while loading Muscle Applet on "SmartCafe Expert 3.2 72k" Smart Card?
Rns Course
2012-10-31 15:08:03 UTC
Permalink
Hi all;

I have a "SmartCafe Expert 3.2 72k" smart card and want to load&install Muscle Applet on it using GPShell.exe (1.4.4).
I've used the following script to install the CardEdge.cap on it:

mode_211
enable_trace
enable_timer
establish_context
card_connect -readerNumber 4 // My Omnikey CardMan3121 reader is the 4th reader in the system registry
select -AID a000000003000000
open_sc -scp 2 -scpimpl 0x15 -security 1 -keyind 0 -keyver 0 -key 404142434445464748494a4b4c4d4e4f -keyDerivation emvcps11  // Open secure channel
install -file CardEdge.cap 
card_disconnect
release_context

When I run the script with GPShell.exe, I get the following output:

mode_211
enable_trace
enable_timer
establish_context
command time: 0 ms
card_connect -readerNumber 4
command time: 63 ms
select -AID a000000003000000
Command --> 00A4040008A000000003000000
Wrapped command --> 00A4040008A000000003000000
Response <-- 6F108408A000000003000000A5049F6501FF9000
command time: 62 ms
open_sc -scp 2 -scpimpl 0x15 -security 1 -keyind 0 -keyver 0 -key 404142434445464748494a4b4c4d4e4f -keyDerivation emvcps11
Command --> 80500000081CEA81CACBFF859F00
Wrapped command --> 80500000081CEA81CACBFF859F00
Response <-- 0000017695008D0F97270102001058FAE6F7D0E3485ABC93FBEAC7409000
Command --> 8482010010C255066E7B12B6A3219691B3F4F21DB2
Wrapped command --> 8482010010C255066E7B12B6A3219691B3F4F21DB2
Response <-- 9000
command time: 250 ms
install -file CardEdge.cap
Command --> 80E602001805A00000000108A0000000030000000006EF04C60238B00000
Wrapped command --> 84E602002005A00000000108A0000000030000000006EF04C60238B00093961105E2EDAE4B00
Response <-- 009000
Command --> 80E80000EFC48238A701000FDECAFFED010204090005A00000000102001F000F001F000A0033029A006F2973000A04B6000006E200040000000005010004003305030107A0000000620101000107A0000000620209030107A0000000620102030107A0000000620201000107A000000062000103000A0106A00000000101001C06006F01800314000D04040005005DFFFF0040007905D605F406140634065E8100000084000200010111000024A9252125482601260E2631266C2676267E2687268E269B26A626B126BA26CB26DC008400030001010D000026F82750277227BB27CB27DB27FC28B028C428D628E528F329570729
Wrapped command --> 84E80000F7C48238A701000FDECAFFED010204090005A00000000102001F000F001F000A0033029A006F2973000A04B6000006E200040000000005010004003305030107A0000000620101000107A0000000620209030107A0000000620102030107A0000000620201000107A000000062000103000A0106A00000000101001C06006F01800314000D04040005005DFFFF0040007905D605F406140634065E8100000084000200010111000024A9252125482601260E2631266C2676267E2687268E269B26A626B126BA26CB26DC008400030001010D000026F82750277227BB27CB27DB27FC28B028C428D628E528F329570729FD16DE1935F35094
Response <-- 6A80
load() returns 0x80206A80 (6A80: Wrong data / Incorrect values in command data.)



I've compiled Muscle Applet source using Apache Ant by JavaCard 2.2.2 and JDK 7u2, so that the .cap file (CardEdge.cap) size is 16.2 KB.

Now, I have several questions:
1) Is the applet compilation method different for different smart cards?
(In the build.xml file, there is not any smart card specific information to modify!
  I've downloaded Muscle source from here: https://github.com/martinpaljak/MuscleApplet)  

2) Does the applet compilation differ in JCOP and JTOP cards?
(Compilation process with JavaCard 2.2.2 works fine, but with JavaCard 2.2.1, I get errors!)

3) Could you tell me the complete and correct parameters for "install" command of GPShell for the specified card?

And...
4) What's the reason of the returned error in GPShell: 

Response <-- 6A80
load() returns 0x80206A80 (6A80: Wrong data / Incorrect values in command data.)

??


Thanks In Advance.
Sebastien Lorquet
2012-10-31 15:50:47 UTC
Permalink
Hi,

1) No. This is the "compile once load anywhere" part of javacard applets, modulo
availability of particular APIs.
Newer card shall accept old cap files, but not the reverse.

2) Not sure what "jtop" means, but i would say no. Only some very particular old
gemalto javacard required a specific off-card verification/transformation step
before the cap file is accepted. But Smartcafe, IIRC, is a G&D card, so no
specific tool should be required.

3) in your trace you're not INSTALLing anything yet, you're merely LOADing,
which is the first step, when the classes are copied inside the card. install is
the second step, in which the applet class is instanciated. The parameters
required for the applet may be in the spec, or can be understood by reading the
code. I don't know them, and that's not the problem yet.

4) 6A80 = bad command data. Your cap file is not accepted at the very first
"LOAD" APDU.
The problem is, this code is very generic and the reason is not easy to guess
- this may be because the card does not support javacard 2.2.2, only jc 2.2.1.
- this may be because the apdu is too long for this card. The buffer size in the
card (=max apdu size) is not always 5+255+1 data bytes.
I don't remember if the class version is still embedded in cap files, but you
could also try older jdk versions if nothing else works (jdk 5 or 6 instead of
jdk7, even if the effect of this is unsure)

Have a try with a precompiled applet, or by using shorter apdus, e.g. <128 bytes
(I don't know how to do that in gpshell).
That would be my own first steps.

Also, why not compare your generated cap file with a precompiled cardedge.cap
file? the cap file format is documented in the jcdk specs.

After that, I would be cautious with gpshell, install is a strangely named
command here. Have a look at the doc, it's better to avoid "combined" commands.
If you have a load command, go with that, and deal with the instanciation
(install) later.

Last but not least, do not use any -nvlimit et al. parameter, this is useless
for testing, this is only a way to limit the available card resources. Since you
don't know exactly what resources are required, it's better to avoid some
additional problems and not use these limiting options.

At least, the keys/auth part is OK :)

Regards
Sebastien
Post by Rns Course
Hi all;
I have a "SmartCafe Expert 3.2 72k" smart card and want to load&install Muscle
Applet on it using GPShell.exe (1.4.4).
mode_211
enable_trace
enable_timer
establish_context
card_connect -readerNumber 4 // My Omnikey CardMan3121 reader is the 4th
reader in the system registry
select -AID a000000003000000
open_sc -scp 2 -scpimpl 0x15 -security 1 -keyind 0 -keyver 0 -key
404142434445464748494a4b4c4d4e4f -keyDerivation emvcps11 // Open secure channel
install -file CardEdge.cap
card_disconnect
release_context
mode_211
enable_trace
enable_timer
establish_context
command time: 0 ms
card_connect -readerNumber 4
command time: 63 ms
select -AID a000000003000000
Command --> 00A4040008A000000003000000
Wrapped command --> 00A4040008A000000003000000
Response <-- 6F108408A000000003000000A5049F6501FF9000
command time: 62 ms
open_sc -scp 2 -scpimpl 0x15 -security 1 -keyind 0 -keyver 0 -key
404142434445464748494a4b4c4d4e4f -keyDerivation emvcps11
Command --> 80500000081CEA81CACBFF859F00
Wrapped command --> 80500000081CEA81CACBFF859F00
Response <-- 0000017695008D0F97270102001058FAE6F7D0E3485ABC93FBEAC7409000
Command --> 8482010010C255066E7B12B6A3219691B3F4F21DB2
Wrapped command --> 8482010010C255066E7B12B6A3219691B3F4F21DB2
Response <-- 9000
command time: 250 ms
install -file CardEdge.cap
Command --> 80E602001805A00000000108A0000000030000000006EF04C60238B00000
Wrapped command -->
84E602002005A00000000108A0000000030000000006EF04C60238B00093961105E2EDAE4B00
Response <-- 009000
Command -->
80E80000EFC48238A701000FDECAFFED010204090005A00000000102001F000F001F000A0033029A006F2973000A04B6000006E200040000000005010004003305030107A0000000620101000107A0000000620209030107A0000000620102030107A0000000620201000107A000000062000103000A0106A00000000101001C06006F01800314000D04040005005DFFFF0040007905D605F406140634065E8100000084000200010111000024A9252125482601260E2631266C2676267E2687268E269B26A626B126BA26CB26DC008400030001010D000026F82750277227BB27CB27DB27FC28B028C428D628E528F329570729
Wrapped command -->
84E80000F7C48238A701000FDECAFFED010204090005A00000000102001F000F001F000A0033029A006F2973000A04B6000006E200040000000005010004003305030107A0000000620101000107A0000000620209030107A0000000620102030107A0000000620201000107A000000062000103000A0106A00000000101001C06006F01800314000D04040005005DFFFF0040007905D605F406140634065E8100000084000200010111000024A9252125482601260E2631266C2676267E2687268E269B26A626B126BA26CB26DC008400030001010D000026F82750277227BB27CB27DB27FC28B028C428D628E528F329570729FD16DE1935F35094
Response <-- 6A80
load() returns 0x80206A80 (6A80: Wrong data / Incorrect values in command data.)
I've compiled Muscle Applet source using Apache Ant by JavaCard 2.2.2 and JDK
7u2, so that the .cap file (CardEdge.cap) size is 16.2 KB.
1) Is the applet compilation method different for different smart cards?
(In the build.xml file, there is not any smart card specific information to modify!
I've downloaded Muscle source from
here: https://github.com/martinpaljak/MuscleApplet)
2) Does the applet compilation differ in JCOP and JTOP cards?
(Compilation process with JavaCard 2.2.2 works fine, but with JavaCard 2.2.1,
I get errors!)
3) Could you tell me the complete and correct parameters for "install" command
of GPShell for the specified card?
And...
Response <-- 6A80
load() returns 0x80206A80 (6A80: Wrong data / Incorrect values in command data.)
??
Thanks In Advance.
_______________________________________________
Muscle mailing list
http://lists.drizzle.com/mailman/listinfo/muscle
Loading...