JavaCard .cap file generation throws IllegalArgumentException

Hi all,
I'm trying to generate a .cap file for some applet source provided externally, and capgen/converter are throwing an IllegalArgumentException when I attempt to generate a .cap (either straight from .opt or using capgen on a pre-generated .jca file). I'm able to generate/run the .cap file from JCOP tools for eclipse, so I'm able to verify it's authenticity.
The output I'm getting is pretty basic even in verbose mode:
C:\projects\MWallet\src>converter -config .\com\schip_select\schip.opt
Java Card 2.2.1 Class File Converter, Version 1.3
Copyright 2003 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
parsing C:\projects\MWallet\src\com\mycard\schip_select\Constants.class
parsing C:\projects\MWallet\src\com\mycard\schip_select\schip.class
parsing C:\projects\MWallet\src\com\mycard\schip_select\schip_pin.class
parsing C:\projects\MWallet\src\com\mycard\schip_select\protected_array.class
converting com.mycard.schip_select.Constants
converting com.mycard.schip_select.schip
parsing C:\JavaCardDevelopment\api_export_files\javacard\framework\javacard\framework.exp
parsing C:\JavaCardDevelopment\api_export_files\java\lang\javacard\lang.exp
parsing C:\gp211\org\globalplatform\javacard\globalplatform.exp
parsing C:\JavaCardDevelopment\api_export_files\javacard\security\javacard\security.exp
converting com.mycard.schip_select.schip_pin
converting com.mycard.schip_select.protected_array
parsing C:\JavaCardDevelopment\api_export_files\javacardx\crypto\javacard\crypto.exp
writing C:\projects\MWallet\src\com\mycard\schip_select\javacard\schip_select.jca
java.lang.IllegalArgumentException
Cap file generation failed.
conversion completed with 1 errors and 0 warnings.
The opt file I've got should be fairly un-offensive:
-out CAP
-exportpath "c:\JavaCardDevelopment\api_export_files;C:\gp211;.\"
-debug
-i
-v
-noverify
-applet 0xA0:0x00:0x00:0x00:0x04:0x10:0x10 com.schip_select.schip
com.schip_select
0xA0:0x00:0x00:0x00:0x04:0x10 1.0
I've tried with or without the -noverify flag.
I'm using Java JDK Standard Edition (build 1.4.1_07-b02) to run the converter, and compile the source files. And I've tried the converter in the Sun Java Card Development kit 2.2.1 and 2.2.2. I've also tried attaching the jdb.exe to converter to see whats going on, I can see that it fails in a function:
com.sun.javacard.jcasm.cap.ReferenceLocationComponent.addTwoByteOffset()
But can't get anymore information than that. Any pointers to what could be causing this (I frankly don't know where to start) would be greatly appreciated.
Thanks,
James

6A80 is the error which says that there is mismatch between jc version of card and java version.
For Javacard 2.2.1 java version is jdk.1.4.1
But lets not focus on that
I tried to recreate the problem. You were using GP classes to create a cap file so I downloaded GP exp files from
[http://www.globalplatform.org/specificationform2.asp|http://www.globalplatform.org/specificationform2.asp].
Compiled files as
javac -g -classpath .\classes;..\lib\api.jar;..\lib\installer.jar;libs/gp211.jar;libs/jc221.jar {PACKAGE_DIR}\*.javaMy opt file is as
-out EXP JCA CAP
-exportpath C:\java_card2.2.1\java_card_kit-2_2_1\api_export_files;C:\GP211\GP_exportA00000015100
-applet <APPLET_AID> <Applet_DIR>
<PACKAGE>
<PACKAGE_AID> 1.0and called converter command as
converter -config {PATH_TO_EXPORT_FILE}\HelloWorld.optI was able to create the CAP file successfully.

Similar Messages

  • Javacard converting to CAP file

    I'm trying to generate a .cap file for some applet source provided externally, and capgen/converter are throwing an IllegalArgumentException when I attempt to generate a .cap (either straight from .opt or using capgen on a pre-generated .jca file).
    The output I'm getting is pretty basic even in verbose mode:
    java.lang.IllegalArgumentException
    Cap file generation failed.
    conversion completed with 1 errors and 0 warnings.
    I've tried with or without the -noverify flag.
    I'm using Java JDK Standard Edition (build 1.4.1_02) to run the converter, and compile the source files. And I've tried the converter in the Sun Java Card Development kit 2.2.1.
    also I'm using GlobalPlatform 2.1.1.
    When using JDK 1.3 version, success generate CAP File.. but 1.4 version is throw java.lang.IllegalArgumentException.
    Help me.. Thanks,
    Edited by: StrangeWorld on Jun 7, 2010 6:19 PM

    Hi,
    You need to target JDK 1.3 to compile classes to convert to a cap file. You can however do this with any newer JDK (I use Java 6). You need to specify the -source 1.3 and -target 1.1 arguments (this instructs the compiler to target and older JVM).
    You should then be able to convert your class into a CAP file. If this doesn't work switch the values for source and target as this is off the top of my head and I usually get the back to front.
    Cheers,
    Shane

  • Sent step by step apdu command to load cap file into javacard

    Dear All,
    I have log file about process loading cap file into card:
    Loading "E:\Sample.cap" ...
    T - 80F28000024F00
    C - 08A000000003000000019E9000
    ISD AID : A000000003000000
    T - 80E602001407A000000132000108A00000000300000000000000
    C - 009000
    T - 80E80000C8C48209B6010011DECAFFED010202010107A000000132000102001F0011001F00000015009A005D0772000A00C8001B03E400020000000002000004001502000107A0000000620001000107A000000062010106005D80810000C20000810200800000FF000100000000810500FF0003000000028000130008010D000002CA02DE02E202E702EE02F602FB0308032B036204AA04C804E8000009040308020705060C0D00010D040308020705060C0D090A0B010707720003201D046D06048D00141C7500120001000300
    C - 009000
    T - 80E80001C800098F00163D1D8C001A77068D001401770110188C001B7A0220181D8C001C7A03101C026B07017F001D7A7B001D670D8F001F3D1C8C00207F001D7B001D1C8B00127B001D93038903290803290903290A03290B03290D03290E707F1506160E251100FF53290C160C606D1B1604160E41251100FF53290D160D605C191E160E41251100FF531505160E251100FF53435B290F160F6308160F0245290F160F10096D075909017005590801160F10146D27160D160C432910161063081610024529101610100C6D0700
    C - 009000
    T - 80E80002C8590B01700B161010106F05590A01590E01160E1607A4FF7F1100961609411608430547290F160F630703290F700E160F1100FF6F071100FF290FAD0005160F5B38104B160B41160A43290F160F630703290F700E160F1100FF6F071100FF290FAD0007160F5B387A045603290503290603290704290803290916066008160610096F0F1B1607590701251100FF53290616056008160510096F0E191E590201251100FF532905160610096F2E160510096F281605160643290A160A6308160A0245290A160A10086D00
    C - 009000
    T - 80E80003C80C16091008160A434129095908017042160610096F0E590801160565355905FF7030160510096F0E590801160665235906FF701E160616056F0E16061605432906032905700C1605160643290503290616071604A4FF5D1609106445290916096307117FFF29091609160847290916091100FF6F071100FF2909AD000316095B387A0430191E0441251100FF5375002D00020081000D0082001B18068901191E0541251100FF537818078901191E054125191E0641258D001778191E0441251100FF53107F6E101800
    C - 009000
    T - 80E80004C8058901191E0441251100FF537803780320188C001B18110100900B870218110118900B870318110118900B870418110080900B87051808900C8706181D880718AE0788081804048D00138709181006048D00158700181006048D0015870A7A02201D046D06048D0014181D880718AE0788087A011006780110AE0B780210AD090325780310AD090303387A0110AE08780330191E1103008D00183B057805501D1604411100806F040378AE0B6106078D0014AD051D1A1F16048D00193B1604780540AD090303381800
    C - 009000
    T - 80E80005C803880B1803890C1803890D1803890E1803880F1F60081FAD05926F06058D0014191EAD05031F8D00193B1804880F7A0543032905AE0B046B06088D001419031E41257501300002FFC600110000000D058D00141819031E418C001E290618AF011E41890119AF0125066A06058D00141806881008AF01412904A800E2181916048C001E2905191604257300C800010004000F0031008600A71605AD02926F06058D0014191604AF0141AD020316058D00193B181605890CA8009AAD0603191604AF0141251100FF5300
    C - 009000
    T - 80E80006C839AD0604191604AF01410441251100FF5339AD0605191604AF01410541251100FF5339AD0606191604AF01410641251100FF5339AD0607191604AF01410741251100FF533970441605AD03926F06058D0014191604AF0141AD030316058D00193B181605890D70231605AD04926F06058D0014191604AF0141AD040316058D00193B181605890E700216041605AF014141290416041606A7FF1DAF0CAF0D41AF0E41610C058D00147006058D00147A0210AE0B046A0BAE0F6007AE10066A06088D00141804880B1800
    C - 009000
    T - 80E80007C8AE0788087A0440AD09030338AE0B6106078D0014180488111F650A18191E1F8B00217802780846032905032906032907032908AE116106088D0014AE0861040378AE107501DF00010003000918191E8C001E29091FAF011609416C6B04AF01412904705D181916041E418C001E29051916041E41257300400000000400110013004000220031702F1605652B1E160441AF0141290870201605651C1E160441AF0141290670111605650D1E160441AF01412907700216041605AF0141412904160416096FA1AD060700
    C - 009000
    T - 80E80008C8261100FF53290916091609452909AD0A0316098D00183B16069800B916079800B418191606191607AD03AD04AF0E8C0022AD0007251100FF53AD0606264510084F29091609AD0607266C14AD0903043818AE078808180388111140007816091609452909AD000716098D00183BAD0005251100FF53AD0605264510084F29091609AD0607266C14AD0903043818AE078808180388111140007816091609452909AD000516098D00183BAD0005AD0007AD0A058D0023AD0A05AD0A038D00246214AD0903043818AE0700
    C - 009000
    T - 80E80009C8880818038811114000781608604918191608AD02AF0C8C0025AD0003251100FF53AD0604264510084F29091609AD0607266C14AD0903043818AE078808180388111140007816091609452909AD000316098D00183BAD0003AD0A05AD0A078D0023AD0A07AD0A038D00246214AD0903043818AE0788081803881111400078AD09030338AE086511183D840804435B88087006058D0014037803430329047031181D160441251100FF5329051A1F160441251100FF532906160516066F040478160516066D0402781600
    C - 009000
    T - 80E8000AC80404415B29041604056CCE03780462032906042907703D181D160741251100FF531A1F160741251100FF534116064129061504160516074116065B3816061100FF6F070429067005032906160704435B2907160763C37A08000A000200010000000000000A001B0500000000000100000004000000130002002B003300090001000105009A002602001D0602001D0B02001D0002001D0102001D0202001D0302001D0402001D0D02001D0E02001D0502001D0702001D0F02001D0802001D0902001D0A02001D110200
    C - 009000
    T - 80E8000BC8001D0C02001D10038105020681080C060000330681080D01001D000681100506811006068110020600027A06800000068105000500000006000225010013000600002B03001D0D0600005906000728060006EB060001430900C8008BFF1726E2220E1F1A080808060403020809090F0302090507081D08100704040404060B0A082A04030C03260C030C050609060B060B060B060F0C030C060C030C080D02031205040B030205050A1D08061408330F0F0B0C111A020205080C060602040D09080C060602040D0900
    C - 009000
    T - 80E8800C5A03030603080602040E0205080C060602040D090303060308060204060506050039090D050508080B04050503030403FFFF06243509090D31180A2C091416081414200E690E130E270615190E19171B711B3B3C0D09233B0D092C00
    C - 009000
    Completed !
    However, I want to run step by step a command to load this cap file into card.
    When I sent "80F28000024F00", it is ok. It response: 08A000000003000000019E9000
    After that, I sent next command: 80E602001407A000000132000108A00000000300000000000000, it response as 6985.
    I don't understand why. Please help me this problem. I must do how to load this cap
    Thanks & Best Regards
    Kelvin Nguyen

    Hi,
    You need to delete the old CAP file before loading it again. The problem is that when you call INSTALL FOR LOAD it sees there is already a CAP file with that AID present.
    You can try sending a GET STATUS command listing load files to see what is on the card already. You need to delete what is present to be able to load/install again.
    Shane

  • How to load the .cap file in a Smart Card?

    Dear All,
    Hello..!!
    I am using JCDK 2.2 and have used Eclipse JCDK.
    I have written a simple read/write applet and created a .cap file using Eclipse's Converter Java Card tool.
    What is the next step to be done?
    I have a smart card device and have installed its drivers.
    When do the APDU commands come into picture?
    Expecting help.
    Thanks a lot.
    Regards,
    Suril

    Suril Sarvaiya wrote:
    Hi Shane....
    Thnx a lot....
    I have downloaded GP-Shell 1.4.4
    When I open its application and write any command and press enter ; the app window closes immendiately.
    Can you please help me on this?
    One more thing Shane......
    I'm writig a java class using javax.smartcardio
    I have installed drivers of Omnikey 3021
    but the TerminalFactory is not detecting it?
    Any idea on that?
    Thanks again...
    Regards,
    SurilHi all,
    Is Mr. thread starter has solved his problem?
    I profit this thread to post my question. I'm working with new environment and I have problem loading cap file into my smartcard.
    specification come first :-)
    - My smartcard is said to be JC2.2.1 and GP2.1.1 compatible
    - My code (for testing) is written in Java under eclipse Helios service 2 with JavaCard plugin (for JC2.2.2)
    I compile my code with JDK 1.3 (for compatible version) and using the JC plugin to generate cap file (along with exp and jca).
    My problem is exactly the same as one that was posted in this forum about 2 years ago but is not answered :-)
    [Problem Loading Application to Card |http://forums.oracle.com/forums/thread.jspa?threadID=1749334&tstart=420]
    + I successfully authenticate with smartcard
    + APDU command Install for Load is executed successfully
    + BUT the APDU command LOAD file fails with returned status word is 6424
    For details, I post here my javacard applet code and APDU command executed with my tool:
    package mksAuthSys;
    import javacard.framework.APDU;
    import javacard.framework.Applet;
    import javacard.framework.ISO7816;
    import javacard.framework.ISOException;
    import javacard.framework.OwnerPIN;
    public class Jcardlet extends Applet {
         private final static byte[] myPIN = { (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04};
         final static byte Jcardlet_CLA =(byte)0xB0;
         final static byte VERIFY = (byte) 0x20;
         final static byte PIN_TRY_LIMIT =(byte)0x03;
         final static byte MAX_PIN_SIZE =(byte)0x08;
         final static short SW_VERIFICATION_FAILED = 0x6300;
         OwnerPIN pin;
         private Jcardlet() {
              pin = new OwnerPIN(PIN_TRY_LIMIT, MAX_PIN_SIZE);
              pin.update(myPIN, (byte) 0, (byte) 4 );
             register();
         public static void install(byte bArray[], short bOffset, byte bLength)
                   throws ISOException {
              new Jcardlet().register();
         public boolean select() {
              if ( pin.getTriesRemaining() == 0 ) return false;
             return true;     
         public void deselect(){
              pin.reset();
         //@Override
         public void process(APDU apdu) throws ISOException {
              // TODO Auto-generated method stub
              byte[] buffer = apdu.getBuffer();
              if ((buffer[ISO7816.OFFSET_CLA] == 0) &&
                      (buffer[ISO7816.OFFSET_INS] == (byte)(0xA4))) return;          
              if (buffer[ISO7816.OFFSET_CLA] != Jcardlet_CLA)
                    ISOException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED);          
              switch (buffer[ISO7816.OFFSET_INS]) {
               case VERIFY: verify(apdu);
                 return;
               default: ISOException.throwIt (ISO7816.SW_INS_NOT_SUPPORTED);
         private void verify(APDU apdu) {
              // TODO Auto-generated method stub
             byte[] buffer = apdu.getBuffer();
             // retrieve the PIN data for validation.
             byte byteRead = (byte)(apdu.setIncomingAndReceive());
             // check pin
             // the PIN data is read into the APDU buffer
             // at the offset ISO7816.OFFSET_CDATA
             // the PIN data length = byteRead
             if ( pin.check(buffer, ISO7816.OFFSET_CDATA,byteRead) == false )
               ISOException.throwIt(SW_VERIFICATION_FAILED);          
    }And my APDU command:
    Loading "D:\mksAuthSys.cap" ...
    T - 80F28000024F00
    C - 08A000000003000000079E9000
    ISD AID : A000000003000000
    T - 80E602001508F23412345610000008A00000000300000000000000
    C - 009000
    T - 80E80000C8C482018B010012DECAFFED010204000108F23412345610000002001F0012001F000C001500420012009D0011001C0000009F00020001000402010004001502030107A0000000620101000107A000000062000103000C0108F234123456100001002306001200800301000104040000003DFFFF0030004507009D000510188C0003188F00013D0610088C00028700AD007B000403078B0005188B00067A02308F00073D8C00088B00067A0110AD008B00096104037804780110AD008B000A7A0221198B000B2D1A0300
    C - 6424
    Stopped loading due to unexpected status words.Urgently look forward to hearing from you.
    Thanks a bunch in advance
    Best Regards,
    JDL

  • Wrong CAP file version error message

    I'm trying to write a loader application that will send a CAP file into JavaCard, and then install it automatically.
    I have developed my JavaCard Applet by using Eclipse3.1.0 and JCOP30.
    After running my JavaCard Applet by Eclipse, I got its CAP file in folder [b\bin\FVSCardPkg\javacard\[/b]
    But when I run my loader application with this CAP file, the error message will display:
    EX: msg Wrong CAP file version, class class com.ibm.jc.JCException
    Wrong CAP file version
         at com.ibm.jc.CapFile.parseHeader(Unknown Source)
         at com.ibm.jc.CapFile.readCapFile(Unknown Source)
         at com.ibm.jc.CapFile.<init>(Unknown Source)
         at LoaderPkg.loader.load(loader.java:35)
         at LoaderPkg.loader.main(loader.java:20)
    This is my loader application source code:
    import java.io.*;
    import com.ibm.jc.*;
    import com.ibm.jc.terminal.*;
    *  Sample /**
    *  Sample loader. Demonstrates how to use the offcard API to download
    *  a cap-file on a JCOP41V22 Engineering sample card and listing of applets loaded will
    * follow.
    public class loader{
         private final static String termName = "pcsc:4"; // Real card
    //     private final static String termName = "Remote"; // Simulator
         protected static final byte[] JCOP_CARD_MANAGER_AID = { (byte) 0xa0, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00};
         protected static final byte defaultInstallParam[] = { -55, 0 };
         static String[] capFileName={"D:/MyCardPkg.cap"};
         public static void main(String[] args){
              try{
                   loader l = new loader();
                   l.load();
              }catch(Exception e){
                   System.err.println("EX: msg " + e.getMessage() + ", class " + e.getClass());
                   e.printStackTrace(System.err);
              System.exit(0);
              //Likewise for simulation, be patient the port takes time to close.
              //Use command line "netstate" to check the disapperance of the port before
              // activating JCShell command to read the simulated card.
         private loader(){}
         private void load() throws Exception{
              CapFile capFile = new CapFile(capFileName[0], null);
              System.out.println("Package name: " + capFile.pkg);
              byte[][] applets = capFile.aids;
              if ((applets == null) || (applets.length == 0)){
                   throw new RuntimeException("no applets in cap file");
              // Get connection to terminal, take note that jcop.exe is required to be activated
              // in simulation mode.
              System.out.println("Open terminal ...");
              //Make sure that the simulator jcop.exe is activated before unmarking this satement
              //Remember to delete the downloaded applet before running otherwise error is
              //expected if the simulator finds the existence of the applet with the
              //same pakage name ID and AID
              //Issue /close command at "cm" prompt if the card is in use,, ie it should
              //have "-" prompt. Be patient that the port takes time to close. Use command line
              //"netstate" to check the disapperance of the port before running.
              // pcsc:4=Card Terminal  Or  Remote=LocalHost Terminal
              JCTerminal term = JCTerminal.getInstance(termName, null);
              //For real JCOP41V22 card, please unmark this statement and delete the downloaded
              //applet before running. Error expected if the card finds the existence of the applet
              //with the same pakage name ID and AID
              //Issue /close command at "cm" prompt if the card is in use,, ie it should
              //have "-" prompt.
              term.open();
              // Add in this statement for real card which requires some response time
              term.waitForCard(5000);
              // Create a logging terminal spitting out the APDUs on standard out
              TraceJCTerminal _term = new TraceJCTerminal();
              _term.setLog(new PrintWriter(System.out));
              _term.init(term);
              term = _term;
              // Get JavaCard representative, passing NULL resets card and returns ATR
              System.out.println("Get card ...");
              JCard card = new JCard(term, null, 2000);
              // Get the off-card representative for the card manager and use it to
              // select the on-card CardManager
              System.out.println("Select card manager ...");
              CardManager cardManager = new CardManager(card, CardManager.daid);
              cardManager.select();
              // For downloading something, we have to be authenticated to card manager.
              // For this, the keys must be set. The keys to use should of course
              // be configurable as well.
              byte[] dfltKey = c2b("404142434445464748494a4b4c4d4e4f");
              cardManager.setKey(new OPKey(255, 1, OPKey.DES_ECB, dfltKey));
              cardManager.setKey(new OPKey(255, 2, OPKey.DES_ECB, dfltKey));
              cardManager.setKey(new OPKey(255, 3, OPKey.DES_ECB, dfltKey));
              cardManager.setKey(new OPKey(1, 1, OPKey.DES_ECB, c2b("707172737475767778797a7b7c7d7e7f")));
              cardManager.setKey(new OPKey(1, 2, OPKey.DES_ECB, c2b("606162636465666768696a6b6c6d6e6f")));
              cardManager.setKey(new OPKey(1, 3, OPKey.DES_ECB, c2b("505152535455565758595a5b5c5d5e5f")));
              System.out.println("init Update ...");
              cardManager.initializeUpdate(255,0);
              System.out.println("Authenticate to card manager ...");
              cardManager.externalAuthenticate(OPApplet.APDU_CLR);
              // And load the cap-file, do not forget to call installForLoad
              System.out.println("Loading cap-file ...");
              byte[] cardManagerAid = cardManager.getAID();
              cardManager.installForLoad(capFile.pkgId,0, capFile.pkgId.length, cardManagerAid, 0, cardManagerAid.length, null, 0, null, 0, 0, null, 0);
              cardManager.load(capFile, null, CardManager.LOAD_ALL, null, cardManager.getMaxBlockLen());
              byte[] capaid = capFile.aids[0];
              System.out.println("Finished loading !");
              // Install applet, we try to install the first applet given in the
              // cap file, and try to instantiate it under the same AID as given for its
              // representation in the cap file. No installation data is passed.
              System.out.println("Installing applet ...");
              cardManager.installForInstallAndMakeSelectable(capFile.pkgId, 0, capFile.pkgId.length, capaid,0, capaid.length, capaid, 0, capaid.length, 0, defaultInstallParam, 0, defaultInstallParam.length, null, 0);
              System.out.println("Install succeeded!");
              // synchronize state with on-card card manager
              System.out.println("Update!");
              cardManager.update();
              // Print information regarding card manager, applets and packages on-card
              JCInfo info = JCInfo.INFO;
              System.out.println("\nCardManager AID : " + JCInfo.dataToString(cardManager.getAID()));
              System.out.println("CardManager state : " + info.toString("card.status", (byte) cardManager.getState()) + "\n");
              //Echountered error 6A 86 with this statement:Object[] app = cardManager.getApplets(CardManager.GET_APPLETS,
              //CardManager.CVM_FORMAT_HEX, true);
              //Solved the bug by playing the integers in arg0 and arg1.
              Object[] app = cardManager.getApplets(1, true);
              if (app == null) {
                   System.out.println("No applets installed on-card");
              } else {
                   System.out.println("Applets:");
                   for (int i = 0; i < app.length; i++) {
                        System.out.println(info.toString("applet.status", (byte) ((OPApplet) app).getState()) + " " + JCInfo.dataToString(((OPApplet) app[i]).getAID()));
              // List packages on card
              // Encountered error with this statement:Object[] lf = cardManager.getLoadFiles(CardManager.CVM_FORMAT_HEX, true);
              // Solved the bug by setting arg0 = 0,
              Object[] lf = cardManager.getLoadFiles(true);
              if (lf == null) {
                   System.out.println("No packages installed on-card");
              } else {
                   System.out.println("Packages:");
                   for (int i = 0; i < lf.length; i++) {
                        System.out.println(info.toString("loadfile.status", (byte)((LoadFile) lf[i]).getState()) + " " + JCInfo.dataToString(((LoadFile) lf[i]).getAID()));
              term.close();
         static String numbers = "0123456789abcdef";
         private byte[] c2b(String s) {
              if (s == null) return null;
              if (s.length() % 2 != 0) throw new RuntimeException("invalid length");
              byte[] result = new byte[s.length() / 2];
              for (int i = 0; i < s.length(); i += 2) {
                   int i1 = numbers.indexOf(s.charAt(i));
                   if (i1 == -1) throw new RuntimeException("invalid number");
                   int i2 = numbers.indexOf(s.charAt(i + 1));
                   if (i2 == -1) throw new RuntimeException("invalid number");
                   result[i / 2] = (byte) ((i1 << 4) | i2);
              return result;
    How to solve this problem?
    Thank you in advance.

    I'm not understanding if your cap file is in "b\bin\FVSCardPkg\javacard\", then why are you loading "D:/MyCardPkg.cap"?
    The issue isn't with your off card application, but the cap file version. Look at the cap file components in JCVM specification. I believe it's the Header component. The major, minor should match your card but not greater. In other words, your can't load a 2.2 on a 2.1 card, but a 2.1 can load on a 2.2

  • CAP file generating ERROR

    Hi everybody ,
    I'm trying to build a javacard project by using ANT tool . The problem is when i use the JCOP tool converter (tric.jar) with JRE 1.4 or 1.5 i got the following error :
    Error: class java.lang.RuntimeException, resolving constant-pool of clazz Lhun/eid/javacard/EIDApplet; failed: no such method getClass, ()Ljava/lang/Class; in Ljava/lang/Object;
    and JCOP tool converter with JRE 1.6 , igot another error : invalid magic cafebabe
    After that , i replaced the JCOP tool's converter by using the java_card_kit-2_2_2's converter , and i got another error :
    [java] converting hun.eid.javacard.EIDApplet
    [java] parsing C:\Users\mannykitty\workspace NEW\HUNEID\lib\api_export_files\javacard\framework\javacard\framework.exp
    [java] parsing C:\Users\mannykitty\workspace NEW\HUNEID\lib\api_export_files\javacardx\crypto\javacard\crypto.exp
    [java] error: line 2094: hun.eid.javacard.EIDApplet: method getClass() of class java.lang.Object not found in export file lang.exp or the method signature has changed.
    [java] error: line 2094: hun.eid.javacard.EIDApplet: class java.lang.Class not found in export file lang.exp.
    [java] error: line 2094: hun.eid.javacard.EIDApplet: class java.lang.Class in return type of method java.lang.Object.getClass() not found.
    [java] error: line 2094: hun.eid.javacard.EIDApplet: method getClass() of class java.lang.Object not found in export file lang.exp or the method signature has changed.
    [java] error: line 2094: hun.eid.javacard.EIDApplet: class java.lang.Class not found in export file lang.exp.
    [java] error: line 2094: hun.eid.javacard.EIDApplet: class java.lang.Class in return type of method java.lang.Object.getClass() not found.
    [java] conversion completed with 6 errors and 0 warnings.
    [java] Java Result: 1
    Can someone tell me how to fix this ? Any help will be appreciated !

    I've added the api.jar to class path for compiling but it's seemed not to be changed . Here is my ANT build.xml config :
    <property name="lib" value="lib"/>
         <property name="JCKlibHome" value="c:\Java\java_card_kit-2_2_2\lib"/>
    <property name="JCOPlib" value="${lib}/slbJIop.jar;${lib}/jc_api_212.jar;${lib}/jce1_2_2.jar;${lib}/sunjce_provider.jar"/>
    <property name="JCOPtools" value="${JCKlibHome}/converter.jar;${JCKlibHome}/offcardverifier.jar"/>
    <property name="src" value="src"/>
         <property name="build" value="build"/>
    <property name="classes" value="${build}/classes"/>
    <property name="cardout" value="${build}/card"/>
    <property name="tmp" value="${build}/tmp"/>
    <property name="buildcp" value="${JCOPlib};${JCKlibHome}/api.jar"/>
    Compile :
    <target name="compile" depends="init" description="Compile the javacard source into class files">
    <!-- Compile the java code from ${src} into ${classes} -->
    <javac debug="yes" classpath="${buildcp}" srcdir="${src}" destdir="${classes}"/>
    </target>
    CAP generation:
    <target name="createCAP" depends="compile,capuptodatecheck" unless="capfile.uptodate" description="Create the CAP file from the class files">
    <java classname="com.sun.javacard.converter.Converter" classpath="${JCOPtools}" fork="yes">
         <arg line="-classdir ${classes}" />
         <arg line="-exportpath ${JCOPlib};C:\Java\java_card_kit-2_2_2\api_export_files"/>
         <arg line="-d ${cardout}" />
         <arg line="-v" />
         <arg line="-out CAP EXP JCA" />
         <arg line="-applet 0x41:0x70:0x70:0x68:0x75:0x6e:0x65:0x69:0x64 hun.eid.javacard.EIDApplet hun.eid.javacard 0x41:0x70:0x70:0x68:0x75:0x6e:0x65:0x69:0x64:0x01" />
         <arg line="1.0" />
    ERROR :
    [java] error: line 2094: hun.eid.javacard.EIDApplet: method getClass() of class java.lang.Object not found in export file lang.exp or the method signature has changed.
    [java] error: line 2094: hun.eid.javacard.EIDApplet: class java.lang.Class not found in export file lang.exp.
    [java] error: line 2094: hun.eid.javacard.EIDApplet: class java.lang.Class in return type of method java.lang.Object.getClass() not found.
    [java] error: line 2094: hun.eid.javacard.EIDApplet: method getClass() of class java.lang.Object not found in export file lang.exp or the method signature has changed.
    [java] error: line 2094: hun.eid.javacard.EIDApplet: class java.lang.Class not found in export file lang.exp.
    [java] error: line 2094: hun.eid.javacard.EIDApplet: class java.lang.Class in return type of method java.lang.Object.getClass() not found.
    [java] conversion completed with 6 errors and 0 warnings.
    [java] Java Result: 1
    :(

  • Accessing a Static Array in one CAP file from another CAP in same project

    Hi all,
    I have been developing a banking application on JavaCard. So the size of the applet has grown size able and have now split the file to multiple CAP files. I have been using NXP JCOP plugin in Eclipse for development. Below are the steps done
    a.) I have created multiple packages under the same project where one project has all the variable which are public static final and don't reference any other class. Also this package does not extend Applet. So it finally generates to a CAP file.
    b.) Another package which imports the above package and also extend Applet is the one which has all the UI and logic related to the project. The applet uses the static array defined in the another package to show the menu on phone.
    Now the problem is that when the code come to point for fetching the menu data, i have some thing like menu.length . But when the code comes to this point in debugger i get a
    +6F 00    Status: No precise diagnosis.+
    To cross check i put a watch on the menu variable and found that it has all the data required for showing the menu (which is of 32 byes). So now i am perplexed on why this length is giving this problem. Am i doing some thing wrong. Below is the Snip of the larger code
    This code is the package which has all the constants..
    package constantsPack;
    import javacard.framework.APDU;
    import javacard.framework.ISO7816;
    import javacard.framework.JCSystem;
    import javacard.framework.Util;
    public class ConstantsApplet {
    //menu array decleration
    public static final byte[] MAIN_SETUP_MENU = {
                       (byte) 0x81,  ConstantsApplet.CMD_DTL_LENGTH, ConstantsApplet.CMD_NUMBER, ConstantsApplet.MAIN_CMD_SET_UP_MENU, (byte) 0x00,
                       (byte) 0x82, (byte) 0x02, ConstantsApplet.DEVICEID_SIM, ConstantsApplet.DEVICEID_ME,
                       (byte) 0x85, (byte) 0x08 ,'A','B', 'C',' ','A','p','p','s',
                       (byte) 0x8F, (byte) 0x0D, ConstantsApplet.SB_MENU, 'A','b','c','d','e','f','g',' ','B','a','n','k',
    // other constants.
    }This is the package which has the applet and which uses the variables of the above package
    package myPkgLib;
    import constantsPack.*;
    import javacard.framework.APDU;
    import javacard.framework.Applet;
    import javacard.framework.ISO7816;
    import javacard.framework.ISOException;
    import javacard.framework.OwnerPIN;
    import javacard.framework.Util;
    import javacard.framework.JCSystem;
    public class myApplet extends Applet{
    // other code
    fetch(ConstantsApplet.MAIN_SETUP_MENU.length);
    }Any help regarding this would be very helpful...
    Regards
    Prakash
    Edited by: prakash on Apr 18, 2012 11:57 PM

    Hi lexdabear,
    I tried putting a function inside the library package where the static array is present, but the results are the same... Also by try catch . what exception you want to catch... i see Exception has just .equal function... Tried with ExternalException also but does not seem to enter it..
    Attaching the source code compilable in eclipse below ..
    package constantsPack;
    public class ConstantsApplet {
         public static final byte[] MAIN_SETUP_MENU = {
              (byte) 0x81, (byte) 0x03, (byte) 0x01, (byte) 0x25, (byte) 0x00,
              (byte) 0x82, (byte) 0x02, (byte) 0x81, (byte) 0x82,
              (byte) 0x85, (byte) 0x08 ,'A','B', 'C',' ','A','p','p','s',
              (byte) 0x8F, (byte) 0x0D,  0x0F, 't','e','s','t','a','p','p',' ','B','a','n','k',
              public ConstantsApplet ()
    }The applet code where the above static array is used..
    package smilePkgLib;
    import constantsPack.*;
    import javacard.framework.APDU;
    import javacard.framework.Applet;
    import javacard.framework.ISOException;
    import javacard.framework.Util;
    public class BLApplet extends Applet{
         short fetchcode =0;
         public static void install(byte[] bArray, short bOffset, byte bLength) {
              // GP-compliant JavaCard applet registration
              new smilePkgLib.BLApplet().register(bArray,
                        (short) (bOffset + 1), bArray[bOffset]);
         private BLApplet(){
              // put init code
          * The main method.
         public void process(APDU apdu) throws ISOException {
              if (selectingApplet()) {
                   return;
              byte choosenMenuItem = 0;
              byte[] buf = apdu.getBuffer();
              byte bytesRead =(byte)(apdu.setIncomingAndReceive());
              fetchList(ConstantsApplet.MAIN_SETUP_MENU , (byte)0x00);
         private void fetchList(byte[] list, byte command){
              shouldFetch(list);
          * Overloaded method to fetch the MENUs only.     
          * @param menu
         private void shouldFetch(byte[] menu) {
              shouldFetch((byte)menu.length);
         private void shouldFetch(byte len) {
                   fetchcode = Util.makeShort((byte) 0x91, (byte) (len));          
    }The JCOP script to run the above project
    /select |DefaultApplet
    # Terminal Profile
    /send A0100000133B67FF7F1F020F0B4100000000869804000000 Have the eclipse loadable project but dont know how to put here...
    Regards
    prakash.

  • Verify user pin on a smart card & load a cap file on a card (with eclipse)

    I have been able install JCWDE (Java card development Kit) successfully on eclipse.Basically all I need to do is verify user pin on a smart card.As in first set a pin and then verify it.
    To begin with I have referred many tutorials (here: http://www.javaworld.com/jw-07-1999/jw-07-javacard.html?page=1) and implemented the wallet code in eclipse.I have the cap file generated and the scripts generated.I am not sure how to load it on the smart card with eclipse.
    I tried to deploy the cap file but it keeps saying connected.Also when we initiate the applet I get the same result.
    output:
    Java Card 2.2.2 APDU Tool, Version 1.3
    Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
    Opening connection to localhost on port 9032.
    Connected.
    I have also tried : http://www.cs.ru.nl/E.Poll/hw/practical.html ........ but no luck.
    I have the wallet.cap ,wallet.exp ,wallet.jca ,wallet.opt create.script, select,cap-download.scripts files already generated in eclipse.
    How does a successfully implemented applet code on a smart card work?How does this wallet code work if it is successfully implemented ? Does it have like some GUI which prompts the user to enter the pin?
    Wallet code for reference :
    package com.sun.javacard.samples.wallet;
    import javacard.framework.*;
    public class Wallet extends Applet {
    /* constants declaration */
    // code of CLA byte in the command APDU header
    final static byte Wallet_CLA =(byte)0x80;
    // codes of INS byte in the command APDU header
    final static byte VERIFY = (byte) 0x20;
    final static byte CREDIT = (byte) 0x30;
    final static byte DEBIT = (byte) 0x40;
    final static byte GET_BALANCE = (byte) 0x50;
    // maximum balance
    final static short MAX_BALANCE = 0x7FFF;
    // maximum transaction amount
    final static byte MAX_TRANSACTION_AMOUNT = 127;
    // maximum number of incorrect tries before the
    // PIN is blockedd
    final static byte PIN_TRY_LIMIT =(byte)0x03;
    // maximum size PIN
    final static byte MAX_PIN_SIZE =(byte)0x08;
    // signal that the PIN verification failed
    final static short SW_VERIFICATION_FAILED =
    0x6300;
    // signal the the PIN validation is required
    // for a credit or a debit transaction
    final static short SW_PIN_VERIFICATION_REQUIRED =
    0x6301;
    // signal invalid transaction amount
    // amount > MAX_TRANSACTION_AMOUNT or amount < 0
    final static short SW_INVALID_TRANSACTION_AMOUNT = 0x6A83;
    // signal that the balance exceed the maximum
    final static short SW_EXCEED_MAXIMUM_BALANCE = 0x6A84;
    // signal the the balance becomes negative
    final static short SW_NEGATIVE_BALANCE = 0x6A85;
    /* instance variables declaration */
    OwnerPIN pin;
    short balance;
    private Wallet (byte[] bArray,short bOffset,byte bLength) {
    // It is good programming practice to allocate
    // all the memory that an applet needs during
    // its lifetime inside the constructor
    pin = new OwnerPIN(PIN_TRY_LIMIT, MAX_PIN_SIZE);
    byte iLen = bArray[bOffset]; // aid length
    bOffset = (short) (bOffset+iLen+1);
    byte cLen = bArray[bOffset]; // info length
    bOffset = (short) (bOffset+cLen+1);
    byte aLen = bArray[bOffset]; // applet data length
    // The installation parameters contain the PIN
    // initialization value
    pin.update(bArray, (short)(bOffset+1), aLen);
    register();
    } // end of the constructor
    public static void install(byte[] bArray, short bOffset, byte bLength) {
    // create a Wallet applet instance
    new Wallet(bArray, bOffset, bLength);
    } // end of install method
    public boolean select() {
    // The applet declines to be selected
    // if the pin is blocked.
    if ( pin.getTriesRemaining() == 0 )
    return false;
    return true;
    }// end of select method
    public void deselect() {
    // reset the pin value
    pin.reset();
    public void process(APDU apdu) {
    // APDU object carries a byte array (buffer) to
    // transfer incoming and outgoing APDU header
    // and data bytes between card and CAD
    // At this point, only the first header bytes
    // [CLA, INS, P1, P2, P3] are available in
    // the APDU buffer.
    // The interface javacard.framework.ISO7816
    // declares constants to denote the offset of
    // these bytes in the APDU buffer
    byte[] buffer = apdu.getBuffer();
    // check SELECT APDU command
    if (apdu.isISOInterindustryCLA()) {
    if (buffer[ISO7816.OFFSET_INS] == (byte)(0xA4)) {
    return;
    } else {
    ISOException.throwIt (ISO7816.SW_CLA_NOT_SUPPORTED);
    // verify the reset of commands have the
    // correct CLA byte, which specifies the
    // command structure
    if (buffer[ISO7816.OFFSET_CLA] != Wallet_CLA)
    ISOException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED);
    switch (buffer[ISO7816.OFFSET_INS]) {
    case GET_BALANCE:
    getBalance(apdu);
    return;
    case DEBIT:
    debit(apdu);
    return;
    case CREDIT:
    credit(apdu);
    return;
    case VERIFY:
    verify(apdu);
    return;
    default:
    ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);
    } // end of process method
    private void credit(APDU apdu) {
    // access authentication
    if ( ! pin.isValidated() )
    ISOException.throwIt(SW_PIN_VERIFICATION_REQUIRED);
    byte[] buffer = apdu.getBuffer();
    // Lc byte denotes the number of bytes in the
    // data field of the command APDU
    byte numBytes = buffer[ISO7816.OFFSET_LC];
    // indicate that this APDU has incoming data
    // and receive data starting from the offset
    // ISO7816.OFFSET_CDATA following the 5 header
    // bytes.
    byte byteRead =
    (byte)(apdu.setIncomingAndReceive());
    // it is an error if the number of data bytes
    // read does not match the number in Lc byte
    if ( ( numBytes != 1 ) || (byteRead != 1) )
    ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);
    // get the credit amount
    byte creditAmount = buffer[ISO7816.OFFSET_CDATA];
    // check the credit amount
    if ( ( creditAmount > MAX_TRANSACTION_AMOUNT)
    || ( creditAmount < 0 ) )
    ISOException.throwIt(SW_INVALID_TRANSACTION_AMOUNT);
    // check the new balance
    if ( (short)( balance + creditAmount) > MAX_BALANCE )
    ISOException.throwIt(SW_EXCEED_MAXIMUM_BALANCE);
    // credit the amount
    balance = (short)(balance + creditAmount);
    } // end of deposit method
    private void debit(APDU apdu) {
    // access authentication
    if ( ! pin.isValidated() )
    ISOException.throwIt(SW_PIN_VERIFICATION_REQUIRED);
    byte[] buffer = apdu.getBuffer();
    byte numBytes =
    (byte)(buffer[ISO7816.OFFSET_LC]);
    byte byteRead =
    (byte)(apdu.setIncomingAndReceive());
    if ( ( numBytes != 1 ) || (byteRead != 1) )
    ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);
    // get debit amount
    byte debitAmount = buffer[ISO7816.OFFSET_CDATA];
    // check debit amount
    if ( ( debitAmount > MAX_TRANSACTION_AMOUNT)
    || ( debitAmount < 0 ) )
    ISOException.throwIt(SW_INVALID_TRANSACTION_AMOUNT);
    // check the new balance
    if ( (short)( balance - debitAmount ) < (short)0 )
    ISOException.throwIt(SW_NEGATIVE_BALANCE);
    balance = (short) (balance - debitAmount);
    } // end of debit method
    private void getBalance(APDU apdu) {
    byte[] buffer = apdu.getBuffer();
    // inform system that the applet has finished
    // processing the command and the system should
    // now prepare to construct a response APDU
    // which contains data field
    short le = apdu.setOutgoing();
    if ( le < 2 )
    ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);
    //informs the CAD the actual number of bytes
    //returned
    apdu.setOutgoingLength((byte)2);
    // move the balance data into the APDU buffer
    // starting at the offset 0
    buffer[0] = (byte)(balance >> 8);
    buffer[1] = (byte)(balance & 0xFF);
    // send the 2-byte balance at the offset
    // 0 in the apdu buffer
    apdu.sendBytes((short)0, (short)2);
    } // end of getBalance method
    private void verify(APDU apdu) {
    byte[] buffer = apdu.getBuffer();
    // retrieve the PIN data for validation.
    byte byteRead = (byte)(apdu.setIncomingAndReceive());
    // check pin
    // the PIN data is read into the APDU buffer
    // at the offset ISO7816.OFFSET_CDATA
    // the PIN data length = byteRead
    if ( pin.check(buffer, ISO7816.OFFSET_CDATA,
    byteRead) == false )
    ISOException.throwIt(SW_VERIFICATION_FAILED);
    } // end of validate method
    } // end of class Wallet
    Any help on this would highly appreciated !! :)

    Hi,
    Thanks a lot for reply.But I am not sure as to how can I delete the simulator.
    All I want to do is write a pin on the smart card and verify it.But I am not being able to deploy the cap file or initiate the applet.
    Also for passing the pin correct me if I am wrong........ according to what you said and what I have understood
    If the code is like this :
    public static void install(byte[] bArray, short bOffset, byte bLength) {
    // create a Wallet applet instance
    new Wallet(bArray, bOffset, bLength);
    } // end of install method
    byte aLen = bArray[bOffset]; // applet data length
    // The installation parameters contain the PIN
    // initialization value
    pin.update(bArray, (short)(bOffset+1), aLen);
    Lets say my pin is : 1234
    then I would pass it here.....
    new Wallet(bArray, 1234, bLength);

  • ERROR while generating CAP file

    Hello,
    Iam trying to generate a cap file of JCRMI applet. Iam getting the following errors while generating a CAP file. Can anybody help me.
    Thanks in advance,
    With Regards,
    Abhishek Goud
    {color:#ff0000}{color:#008080}*C:\Documents and Settings\Administrator\Desktop\Demo>converter -classdir C:\jav*
    a_card_kit-2_2_2\lib -exportpath C:\java_card_kit-2_2_2\api_export_files;C:\java
    cardkit-2_2_2\lib -applet 0xa0:0x00:0x00:0x00:0x62:0x03:0x01:0x08:0x01 PurseAp*
    plet com.sun.javacard.samples.RMIDemo 0xa0:0x00:0x00:0x00:0x62:0x12:0x34 1.3
    {color}
    Java Card 2.2.2 Class File Converter, Version 1.3
    Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to lic
    ense terms.
    warning: You did not supply export file for the previous minor version of the pa
    ckage
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported type long of
    field serialVersionUID.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unhandled bytecode ifnull in clinit method, try a different compiler.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unhandled bytecode goto
    in clinit method, try a different compiler.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported bytecode inv
    okestatic in clinit method.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported parameter ty
    pe String of invoked method class$(java.lang.String) of class com.sun.javacard.s
    amples.RMIDemo.PurseImpl_Stub.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported bytecode ane
    warray in clinit method.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported bytecode aas
    tore in clinit method.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported bytecode inv
    okevirtual in clinit method.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported parameter ty
    pe String of invoked method getMethod(java.lang.String, java.lang.Class) of clas
    s java.lang.Class.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unhandled bytecode ifnul
    l in clinit method, try a different compiler.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unhandled bytecode goto
    in clinit method, try a different compiler.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported bytecode inv
    okestatic in clinit method.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported parameter ty
    pe String of invoked method class$(java.lang.String) of class com.sun.javacard.s
    amples.RMIDemo.PurseImpl_Stub.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported bytecode ane
    warray in clinit method.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported bytecode aas
    tore in clinit method.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported bytecode inv
    okevirtual in clinit method.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported parameter ty
    pe String of invoked method getMethod(java.lang.String, java.lang.Class) of clas
    s java.lang.Class.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unhandled bytecode ifnul
    l in clinit method, try a different compiler.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unhandled bytecode goto
    in clinit method, try a different compiler.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported bytecode inv
    okestatic in clinit method.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported parameter ty
    pe String of invoked method class$(java.lang.String) of class com.sun.javacard.s
    amples.RMIDemo.PurseImpl_Stub.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported bytecode ane
    warray in clinit method.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported bytecode inv
    okevirtual in clinit method.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported parameter ty
    pe String of invoked method getMethod(java.lang.String, java.lang.Class) of clas
    s java.lang.Class.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unhandled bytecode ifnul
    l in clinit method, try a different compiler.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unhandled bytecode goto
    in clinit method, try a different compiler.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported bytecode inv
    okestatic in clinit method.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported parameter ty
    pe String of invoked method class$(java.lang.String) of class com.sun.javacard.s
    amples.RMIDemo.PurseImpl_Stub.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported bytecode ane
    warray in clinit method.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported bytecode inv
    okevirtual in clinit method.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported parameter ty
    pe String of invoked method getMethod(java.lang.String, java.lang.Class) of clas
    s java.lang.Class.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unhandled bytecode ifnul
    l in clinit method, try a different compiler.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unhandled bytecode goto
    in clinit method, try a different compiler.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported bytecode inv
    okestatic in clinit method.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported parameter ty
    pe String of invoked method class$(java.lang.String) of class com.sun.javacard.s
    amples.RMIDemo.PurseImpl_Stub.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported bytecode ane
    warray in clinit method.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unhandled bytecode ifnul
    l in clinit method, try a different compiler.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unhandled bytecode goto
    in clinit method, try a different compiler.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported bytecode inv
    okestatic in clinit method.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported parameter ty
    pe String of invoked method class$(java.lang.String) of class com.sun.javacard.s
    amples.RMIDemo.PurseImpl_Stub.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported bytecode aas
    tore in clinit method.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported bytecode inv
    okevirtual in clinit method.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported parameter ty
    pe String of invoked method getMethod(java.lang.String, java.lang.Class) of clas
    s java.lang.Class.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unhandled bytecode goto
    in clinit method, try a different compiler.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unhandled bytecode pop i
    n clinit method, try a different compiler.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported bytecode new
    in clinit method.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported bytecode inv
    okespecial in clinit method.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported parameter ty
    pe String of invoked method <init>(java.lang.String) of class java.lang.NoSuchMe
    thodError.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported bytecode ath
    row in clinit method.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported parameter ty
    pe String of method class$.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported parameter ty
    pe String of invoked method forName(java.lang.String) of class java.lang.Class.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported return type
    String of invoked method getMessage() of class java.lang.Throwable.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported parameter ty
    pe String of invoked method <init>(java.lang.String) of class java.lang.NoClassD
    efFoundError.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported long type co
    nstant.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported parameter ty
    pe long of invoked method invoke(java.rmi.Remote, java.lang.reflect.Method, java
    *.lang.Object, long) of class java.rmi.server.RemoteRef.*
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported String type
    constant.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported parameter ty
    pe String of invoked method <init>(java.lang.String, java.lang.Exception) of cla
    ss java.rmi.UnexpectedException.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported long type co
    nstant.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported parameter ty
    pe long of invoked method invoke(java.rmi.Remote, java.lang.reflect.Method, java
    *.lang.Object, long) of class java.rmi.server.RemoteRef.*
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported String type
    constant.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported parameter ty
    pe String of invoked method <init>(java.lang.String, java.lang.Exception) of cla
    ss java.rmi.UnexpectedException.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported long type co
    nstant.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported parameter ty
    pe long of invoked method invoke(java.rmi.Remote, java.lang.reflect.Method, java
    *.lang.Object, long) of class java.rmi.server.RemoteRef.*
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported String type
    constant.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported parameter ty
    pe String of invoked method <init>(java.lang.String, java.lang.Exception) of cla
    ss java.rmi.UnexpectedException.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported long type co
    nstant.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported parameter ty
    pe long of invoked method invoke(java.rmi.Remote, java.lang.reflect.Method, java
    *.lang.Object, long) of class java.rmi.server.RemoteRef.*
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported String type
    constant.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported parameter ty
    pe String of invoked method <init>(java.lang.String, java.lang.Exception) of cla
    ss java.rmi.UnexpectedException.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported long type co
    nstant.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported parameter ty
    pe long of invoked method invoke(java.rmi.Remote, java.lang.reflect.Method, java
    *.lang.Object, long) of class java.rmi.server.RemoteRef.*
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported String type
    constant.
    error: com.sun.javacard.samples.RMIDemo.PurseImpl_Stub: unsupported parameter ty
    pe String of invoked method <init>(java.lang.String, java.lang.Exception) of cla
    ss java.rmi.UnexpectedException.
    {color}
    conversion completed with 73 errors and 1 warnings.

    It seems there is a variable of type "long" in your applet. The "long" type is not supported by Java Card, so you should remove all variables with type "long".
    Otherwise, without the source code, it is difficult to help you find out what's wrong.

  • Error while creating cap file

    while creating Cap file through converter , error is coming Class helloworld does not belong to this package while giving the same package path where it is existing physically. i m using javacard version 2.2.1 and J2SE 1.4

    Hi Joseph
    Thanks and accept my regards. Now I am able to create the .cap file. but I am facing another problem. I am developing a sim application but I am not able to find the sim.toolkit libraries. Can you plz guide me, where i would find the libraries.

  • Converting CAP file to JCA using normalizer

    Hi, I'm trying to generate 2.2.1(or 2.2.2) JCA file from 2.2.1(or 2.2.2) CAP file using JCDK 3.0 normalizer. I generated class files successfully but when using converter from javacard-kit 2.2.2 i get following error messages
    unsupported class file format of version 50.0.
    Is there any way to solve the error? I also like to know if there exists any other tool other than normalizer to convert cap file to jca file,

    javac -g -source 1.2 -target 1.2 -classpath $JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar src/xu/test/*.java -d binYou can have a look at the man file for javac in the section source/target and try the different options. I'm using sun-java6-jdk with these compiler parameters and have no problem when it comes to converting the files.
    Hope this can help you.
    Cheers

  • Error in convertionof .class to CAP file

    we are using java_card_kit-2_2_1 with j2sdk-1.4.2_12 for developing Applet for Smart card.We are new to the javacard enviornment.We are testng with the avvailable samples in java card kit.
    The steps we are following is given below:
    1.Convertion of java file to class file.
    Class file generated in the path- c:\java_card_kit-2_2_1\samples\src\com\sun\javacard\samples\Helloworld
    2. convertion of class file to Cap file:
    we are using one batch file -run.bat
    run.bat:
    set CLASSES=%JCHOME%\lib\apduio.jar;...;%JC_HOME%\lib\api.jar;%JC_HOME%\lib\capdump.jar;
    xcopy /s %JC_HOME%\api_export_files\*.* exp
    java -classpath %_CLASSES% samples.src.com.sun.javacard.samples
    converter -config HelloWorld.opt
    3.We are running the run.bat file when exp folder is created having the .exp files init.
    4.Then we are using the converter as:
    converter -config ...HelloWorld.opt.
    the .opt file contains..
    -out EXP JCA CAP
    -exportpath C:\java_card_kit-2_2_1\api_export_files
    -applet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x1:0x1
    com.sun.javacard.samples.HelloWorld.HelloWorld
    com.sun.javacard.samples.HelloWorld
    0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x1 1.0
    Then the error is generated as:
    error:export file framework.exp of package javacard.framework not found.
    the above run.bat file the line below needs explanation..
    java -classpath %_CLASSES% samples.src.com.sun.javacard.samples
    converter -config HelloWorld.opt
    plz reply
    Message was edited by:
    jit_hk

    converting .class files to a loadable format for the smart card creates .cap file and .exp files. the .exp files specify information about any (shared) libraries.
    i dunno how exactly to do it with the java card kit from sun. look into the jcop converter tric.jar .

  • How to create CAP file based on a J2ME project ?

    Hi all,
    Recently I need to install a midlet application into the sim card with an applet loader.
    And it requires a java card cap file.
    I already installed:
    1> JAVA Card Kit 2.2.2
    2> JDK 1.6.0_01
    3> J2ME Wireless Toolkit 2.2
    4> Eclipse 3.2
    But I don't know how to generate a cap file from the Eclipse J2ME midlet project.
    Any tips?
    Thank you in advance.

    You cannot install a midlet on a sim card. If it's a Java Card, the format is defined to .cap file. Check out the Java Card VM specification for details. For .cap file creation/installation you can use Sun's Java Card development kit.
    http://java.sun.com/products/javacard/dev_kit.html

  • Convert from java file to cap file

    Dear Pro,
    Please help me this problem,
    I'm building a applet in eclipse. Now, I want to convert from java file to cap file to load it into javacard.
    I need repair what tools and do what, please help me!
    Thanks & Best Regards,
    KeillyNguyen

    Run -> Run Configuration -> Double click Java Card Application -> Click Run
    After that, the CAP file will be generated in the bin directory.
    Are you come from VN? Im Vietnamese :) Nice to meet you

  • What is the wrong about converting the .class of api of jc to .cap files?

    hi everyone
    l tried to convert the .class filses of api to .cap files,there are some wrongs please help me!
    ___the .opt file:___
    -out JCA CAP EXP
    -exportpath D:\jCDK2_2_1\api_export_files
    -classdir D:\workspace\framework
    framework
    0x0a:0x0:0x0:0x0:0x62:0x1:0x01 1.2
    converter result:
    c:documents and settings\administrator>converter -config d:\workspace\framework\framework.opt
    java card 2.2.1 class files converter ,version 1.3
    copyright 2003 sun microsystems,inc.all rights reserved.use is subject to license terms
    error:javacard.framework.JCSystem:unsupported method modifier native in method isTransient.
    error:javacard.framework.JCSystem:unsupported method modifier native in method makeTransientBooleanArray.
    error:javacard.framework.JCSystem:unsupported method modifier native in method makeTransientByteArray
    error:javacard.framework.JCSystem:unsupported method modifier native in method makeTransientShortArray
    conversion completed with 13 errors and 0 warnings.
    thanks in advance

    Hi,
    I am not sure why you are trying to convert the API packages into CAP files. The JAR files that ship with the JCDK are only stub implementations for compiling against. They do not have an actual implementation. You will find methods returning a short always return 0 etc. You should only need to convert your code into CAP files. You will just need to reference the .exp files that are included in the JCDK for the API so your code can be converted.
    Cheers,
    Shane

Maybe you are looking for

  • I-tunes downloading erroe

    Please help with the following error while downloading I-tunes version 9 on Windows business Vista. An error occurred during the installation of assembly 'Microsoft.VC80.CRT, version = "8.0.50727.4053" HR result 0x80070422

  • Search text for keywords - innodb table

    I have a longtext column in a table that I need to search through for keywords. The table is in innodb format. I dont want to change it to myisam because I can't afford to have it lock at the table level... I prefer the row level of innodb. How can I

  • Best Practice Documents on Sourcefire

    Hello, May I know if there are any deployment best practice documents on IPS (covering Pre Processors settings etc), Network AMP and Fire AMP. Thanks. Regards, Akhtar

  • AD Sync failover workflow not firing?

    Hi Everyone, We have a sitaution where it doesn't look like the AD Sync failover workflow is firing. We are syncing changes from an AD resource using IDM 7.1.1.14 and have configured the AD Sync Failover as documented in the docs. Everything seems to

  • Enhancing TCode : SDO1

    Hi Peers, I have a requirement of enhancing the Tcode SDO1(Std Report transaction) . When we run this transaction after we specify the inputs such as Document Type, Created Date, Created by.. we get a list of Sales Document records. After the user se