Hi,

If you cant load the applet when you use the crypto api, this may be a on
card linking problem.
Maybe your card only support one version of the crypto package (say v1.0),
and when you compile with a more recent JCDK, this JCDK wants to link with a
more recent version of the crypto package (say 1.1). Check the .cap manifest
file for more info about this. (cap are JARs)

your GPShell commands looks all right, even if you can use a security value
of 1 (C-MAC) instead of 3 (C-MAC&C-ENC) with cyberflex.

NVDataLimit is useless, remove it, this is only a "ask card to fail if I
load more than 500 bytes of eeprom for code". And you never know exactly how
much you use :-)

I notice that your gpshell script refers to "$PKGAPPLET.cap.transf ", that's
right because gemalto cyberflex cards have an on card verifier and need the
Trusted Logic "captransf.jar". Don't forget to regerenate the .transf file
if you change the cap file :-) (you didn't mention the call to captransf in
your build process description :-) )

An APDU trace log (with security =1 if possible) should be more useful to
say you what's wrong.

Regards,
Sebastien.

On Fri, Mar 20, 2009 at 7:23 PM, jose85 <[email protected]> wrote:

>
> Hello ,
>
> I've done many javacard programs using this method :
> _compilation with javacard kit 2.2.1
> _convertion into ".cap" with the javacard kit 2.1.2
> All this programs work fine with this method : helloworld, read, write in
> the card, ....
>
> But when i want to use the crypto api, i can't charge the program in the
> card (just by adding 2 lines for generating keys):
> ----------> returns 0x80206A80 (6A80: Wrong data / Incorrect values i
> data.)
>
> I think it's because i use the 2.1.2 version , but if i use the 2.2.1 to
> convert , it's another error and no program work with this method.....even
> helloworld doesn't work...
> -----------> returns 0x80206985 (6985: Command not allowed - Conditions of
> use not satisfied.)
>
> I thing i must change my gpshel command , but i have read many forums but
> can't find the configuration for my card cyberflex 32k, some people had
> similar problems so they used the kit 2.1.2 combined with 2.2.1 like me,
> but
> i think they can't use the crypto api with this.........
>
> here are the scripts for compiling , converting and installing the cardlet
> in the card :
>
> ------------------------------------------------------------------------------------------------------------------------
> echo Compilation...
> echo $JC22_API
> $JAVA_HOME/bin/javac -source 1.2 -target 1.2 -g -classpath $JC22_API -d
> $OUT/$PROJECT/ $SRC/$PROJECT/$PKGAPPLET/$APPLET.java
> echo $APPLET.class compiled: OK
> echo .
>
> echo Converting...
> $JAVA_HOME/bin/java -classpath
> $JC22_HOME/lib/converter.jar:$JC22_HOME/lib/offcardverifier.jar
> com.sun.javacard.converter.Converter -nobanner -classdir $OUT/$PROJECT/
> -exportpath $JC_EXP -d $OUT/$PROJECT/ -out EXP JCA CAP -applet $AIDAPPLET
> $PKGAPPLET.$APPLET $PKGAPPLET $AIDPACKAGE $PKGVERSION
> echo $APPLET.cap converted: OK
> echo .
> cp $OUT/$PROJECT/$PKGAPPLET/javacard/$PKGAPPLET.cap $OUT/$PROJECT/
>
> echo Scripting...
> $JAVA_HOME/bin/java -classpath $JC22_HOME/lib/scriptgen.jar
> com.sun.javacard.scriptgen.Main -nobanner -o $OUT/$PROJECT/$APPLET.scr
> $OUT/$PROJECT/$PKGAPPLET/javacard/$PKGAPPLET.cap
> echo $APPLET.scr created: OK
> echo .
>
> echo Completing script...
> cat $MISC/Header.scr $OUT/$PROJECT/$APPLET.scr $MISC/Install.scr
> $MISC/Footer.scr > $OUT/$PROJECT/$SIMUSCRIPT.scr
> rm -f $OUT/$PROJECT/$APPLET.scr
> echo $SIMUSCRIPT.scr created: OK
>
>
> -------------------------------------------------------------------------------------------------------------------------------------------
>
> --------------------------------------------------------------------------------------------------------------------------------------------
>
> echo establish_context >> $OUT/config.txt
> echo card_connect >> $OUT/config.txt
> echo select -AID $CARDSECURITYDOMAIN2 >> $OUT/config.txt
> echo open_sc -security 3 -keyind 0 -keyver 0 -mac_key $CARDKEY -enc_key
> $CARDKEY  >> $OUT/config.txt
> echo install_for_load -pkgAID $PACKAGEAID -nvCodeLimit 500 >>
> $OUT/config.txt
> echo load -file $OUT/$PROJECT/$PKGAPPLET/javacard/$PKGAPPLET.cap.transf >>
> $OUT/config.txt
> echo install_for_install -instParam 00 -priv 02 -AID $APPLETAID -pkgAID
> $PACKAGEAID -instAID $APPLETAID -nvDataLimit 500 >> $OUT/config.txt
> echo card_disconnect >> $OUT/config.txt
> echo release_context >> $OUT/config.txt
>
> -------------------------------------------------------------------------------------------------------------------------------------------------
>
> the variable  $JC_EXP is the directory
> "java_card_kit-2_1_2/api21_export_files" or
> "java_card_kit-2_2_/api_export_files" with the the first directory it works
> well but the second doesn't work , while charging the applet in the card :
> -------------------> returns 0x80206985 (6985: Command not allowed -
> Conditions of use not satisfied.)
>
>
>
>
> Any help will be apreciated,
>
> kind regards
>
> Franck
>
> --
> View this message in context:
> http://www.nabble.com/How-to-use-the-crypto-api-with-a-card-gemalto-cyberflex-32k---tp22626105p22626105.html
> Sent from the MuscleCard mailing list archive at Nabble.com.
>
> _______________________________________________
> Muscle mailing list
> [email protected]
> http://lists.drizzle.com/mailman/listinfo/muscle
>
_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to