Multi-platform JCOP development in Eclipse

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Multi-platform JCOP development in Eclipse

428 Views
makinako
Contributor III

 

This question is targeted to the JCOP Tools plugin team, about the best way to have a Java Card applet target multiple platforms/JCDK's at the same time.

I have an applet (OpenFIPS201) that targets any JC304 platform historically, but is now being FIPS accredited on the P71D600 specifically. This means that I am binding to libraries specific to the JCOP API bundled with the JCOP tools.

Our intention is to keep supporting not just the P71D600, but also generic JC304, JC305 as well as a version bound to the P60SECID and P71D321. I have a basic platform abstraction that is used to provide the platform-specific functionality, but I am having a problem getting this to work in the Eclipse environment and I believe it may be to do with the JCOP plugin, not Eclipse.

The project structure I am trying to make is:

  • src/common/org/openfips201/applet/*.java (the common code making up 95% of codebase)
  • src/platform/p71d600/org/openfips201/applet/Platform.java
  • src/platform/p71d321/org/openfips201/applet/Platform.java
  • src/platform/p60secid/org/openfips201/applet/Platform.java
  • src/platform/jc310/org/openfips201/applet/Platform.java
  • src/platform/jc305/org/openfips201/applet/Platform.java
  • src/platform/jc304/org/openfips201/applet/Platform.java

And then to have a separate Eclipse Java Card project for each platform, which links to both the common and the appropriate platform source folders. 

The issues is that this cannot compile, specifically because when a Java Card project has two src folders, the package id for one will clobber the package id for the other and then you get the error: "AID for package org.openfips201.applet already exists". If I set them differently, it compiles but upon any code change anywhere, one of the package id's gets clobbered again.

I would be interested in what the NXP approach to this, or if anyone out there in the community has had a similar setup?

Labels (2)
Tags (3)
0 Kudos
Reply
2 Replies

403 Views
msjcard
Contributor III

I don't know how do to do this exactly in eclipse, but what I do know you need to do is move the per card source out from under the src tree.  Use something like p72d600-src/org/openfips201/applet/Platform.java instead.

You can then add the card specific source tree as an additional source directory.  I forget where that is in Eclipse, but it is there.

Alternately, you can change the base "src" to "src/common" and the additional source directory to "src/platform/p71d600".

Note that you may actually want to track jcop4 vs jcop45 rather than the part number. 

Lastly, if all you're using are the generic Javacard calls, there's no reason to compile against the NXP libraries.  E.g. jc310, jc305 and jc304 may be sufficient for your needs. 

 

0 Kudos
Reply

389 Views
makinako
Contributor III

I have tried this but what seems to happen is if the platform and common are in two separate directories (any two) that are added separately in the Eclipse project, then you must set the package id separately for each and this is where the problem occurs. 

Noted on jcop4 vs jcop45, and regarding the NXP libraries, because it is a FIPS accreditation for a PIV applet, I make use of the com.nxp.jcopx.piv namespace functionality. This is the main reason for it, although I am looking at additional proprietary functionality to improve security and memory usage for the FIPS build, since I am locked to the platform anyway.

0 Kudos
Reply