This discussion is archived
10 Replies Latest reply: Feb 13, 2013 10:04 AM by safarmer RSS

SecureChannel Converter Problem

966781 Newbie
Currently Being Moderated
Hi,

iam trying to communicate over a secure channel with the host application.
But when i try to create a SecureChannel object:
package mk.sec.chn;

import org.globalplatform.SecureChannel;

import javacard.framework.APDU;
import javacard.framework.Applet;
import javacard.framework.ISOException;


public class Test extends Applet {

     private SecureChannel chn;   //this does not work...
     
     public Test(byte[] bArray, short bOffset, byte bLength) {
          register(bArray, (short) (bOffset + 1), bArray[bOffset]);
     }

     public static void install(byte[] bArray, short bOffset, byte bLength) {
          new Test(bArray, bOffset, bLength);
     }

     public void process(APDU apdu) throws ISOException {
          
     }
}
i get an error "Converter: Java property jc.home is not set".
Every other applet works fine but when i try to use something from the globalplatform i get this error.

What is this for a property and how to set it right ?

Best regards
  • 1. Re: SecureChannel Converter Problem
    fgrieu Newbie
    Currently Being Moderated
    First the obvious: is there a<tt> -exportpath </tt> option in the converter command line, including<tt> ;whatever </tt> such that<tt> whatever\org\globalplatform\javacard\globalplatform.exp </tt> is the GP export file?
  • 2. Re: SecureChannel Converter Problem
    966781 Newbie
    Currently Being Moderated
    hi,

    there is an -exportpath option, it contains:

    -exportpath
    C:\...\JCSSuite3.0SP1\api\JC_301;
    C:\...\JCSSuite3.0SP1\api\OP_201;
    C:\...\JCSSuite3.0SP1\api\GP_211;
    C:\...\JCSSuite3.0SP1\api\Uicc_10;
    C:\...\JCSSuite3.0SP1\api\BIO_11;
    C:\...\JCSSuite3.0SP1\api\ExtSystem_13;
    C:\...\JCSSuite3.0SP1\api\GDSecurity_10;
    C:\...\JCSSuite3.0SP1\api\ExtCrypto_13;

    i see there an GP_211 which could be GlobalPlattform_2.1.1.
  • 3. Re: SecureChannel Converter Problem
    966781 Newbie
    Currently Being Moderated
    Okay, wait, this statement:

    "but when i try to use something from the globalplatform i get this error"

    is wrong.

    I can import the org.globalplatform and i can use GPSystem.lockCard() for example without converter errors.
    But everything which has to do with the secure channel does produce this error. it doenst matter whether i try to create a secure channel interface or try to use GPSystem.getSecureChannel().

    Edited by: 984544 on 29.01.2013 02:35
  • 4. Re: SecureChannel Converter Problem
    fgrieu Newbie
    Currently Being Moderated
    I assume<tt> C:\...\JCSSuite3.0SP1\api\GP_211\org\globalplatform\javacard\globalplatform.exp </tt> exists and has MD5 <tt> D9921353619347345864A3AB7B3B30E9 </tt>.

    Both<tt> lockCard </tt>and<tt> getSecureChannel </tt>reference that, thus if you can use the first but not the second, well, I'm puzzled.

    Update: what about removing that presumably obsolete OP_201 (OpenPlatform) stuff? I always strive to have a bare minimum of exp files in the exportpath of converter.
  • 5. Re: SecureChannel Converter Problem
    966781 Newbie
    Currently Being Moderated
    "Both lockCard and getSecureChannel reference that"

    yes, the primary problem was not to include the org.globalplatform functionality but this mysterious java property "jc.home" which need to be set with something.

    Maybe the lockCard() function does not need this property and the getSecureChannel() need it.
  • 6. Re: SecureChannel Converter Problem
    fgrieu Newbie
    Currently Being Moderated
    <tt>converter.bat </tt>invokes<tt> java.exe </tt>with<tt> -Djc.home=%JC_CLASSIC_HOME% </tt>, where the<tt> -D </tt>option "set a system property", whatever that means.

    I never met that problem or remember using<tt> -D </tt>. But perhaps check how your environment variable<tt> JC_CLASSIC_HOME </tt>is set.

    PS: if the problem is solved, as hinted by the use of past tense, there's an option on this forum to mark that.
  • 7. Re: SecureChannel Converter Problem
    966781 Newbie
    Currently Being Moderated
    I did not get that...

    I found this post: bugs on JCDK 3.0.4

    but did not understand in which XML file he adds the attribute.
    I found no options in my IDE to change this, so maybe i have to it by myself...
  • 8. Re: SecureChannel Converter Problem
    fgrieu Newbie
    Currently Being Moderated
    The problem looks very similar to the post you linked to.

    That mentions the problem is solved by using<tt> converter.bat </tt>rather than ant. That seems sound. I'm of the kind that frowns on tools that are supposed to simplify the task by hiding the details, and end up forcing you to understand both how they work and these details in order to get the job done.
  • 9. Re: SecureChannel Converter Problem
    966781 Newbie
    Currently Being Moderated
    Okay it really seems to be a converter bug.

    If i change my converter to 2.2.2 all works fine. Each converter from 3.0.1 and above will throw this error.
  • 10. Re: SecureChannel Converter Problem
    safarmer Expert
    Currently Being Moderated
    984544 wrote:
    Okay it really seems to be a converter bug.

    If i change my converter to 2.2.2 all works fine. Each converter from 3.0.1 and above will throw this error.
    I thought JC 3.0.1 would require the export files from GP 2.2? You can test this by getting the API etc from the GP website.

    - Shane

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points