• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

fidesmo/gradle-javacard

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

fidesmo/gradle-javacard

开源软件地址(OpenSource Url):

https://github.com/fidesmo/gradle-javacard

开源编程语言(OpenSource Language):

Groovy 100.0%

开源软件介绍(OpenSource Introduction):

Compiling javacard applets with gradle

Build Status

This plugins allows for translation of compiled class files to the converted archive format. These files can be used for installation on smart and sim cards supporting SUN/Oracle JavaCard Technology.

Features

  • convert a package of class files into a cap file
  • specify multiple classes implementing Applet for later installation
  • add external EXP files to build
  • optional support for testing with jcardsim

Usage

Include the new version of the plugin from OSS Sonatype snapshot by adding the following to your build.gradle:

apply plugin: 'javacard'

buildscript {

    repositories {
        maven { url 'http://releases.marmeladburk.fidesmo.com/' }
    }

    dependencies {
        classpath 'com.fidesmo:gradle-javacard:0.2.7'
    }
}

javacard {
    /* Specify which version of the JavaCard SDK should be used
       to build this project. Supported: 2.2.? and 3.0.? */
    sdkVersion = "3.0.4"

    cap {
        aid = '0x12:0x34:0x00:0x00:0x00:0x01'
        packageName = 'com.example.my.jc.code'
        applet {
            aid = '0x12:0x34:0x00:0x00:0x00:0x01:0x01'
            className = 'ClassImplementingApplet'
        }
        version = '1.0'
    }
}

Installing the Java Card Development Kit

Before compiling you need to download the JavaCard SDK. The current implementation is tested using Linux and the Java Card Development Kit 2.2.2. It is supposed to work also for all other Java Card Development Kit 2.x.x under MacOSx, Windows and Linux. The development kit can be downloaded on the Oracle Website and must be unpacked

 # Assumes file to be downloaded as java_card_kit-2_2_2-linux.zip
 unzip java_card_kit-2_2_2-linux.zip
 cd java_card_kit-2_2_2/
 unzip java_card_kit-2_2_2-rr-bin-linux-do.zip
 unzip java_card_kit-2_2_2-rr-ant-tasks.zip
 export JC_HOME="${PWD}/java_card_kit-2_2_2"

Convert applications to Java Card

The specified package is converted from jvm byte code to javaCard byte code, by running the convertJavaCard task.

 # ensure JC_HOME is set correctly
 gradle convertJavacard

Add exp files from vendors or other projects

To add external exp files to your build, add a dependencies section to your gradle.build and add the corresponding paths to the javacardExport configuration. Usually you also will need to add some classes in order to compile your java code to class files.

 dependencies {
     compile files('../path/to/class/files/dir')
     javacardExport files('../path/to/exp/files/dir')
 }

Support for testing with jcardsim

The java card plugin doesn't include a testing framework, but it contains several mechanisms to make testing with jcardsim easier. To properly setup testing with jcardsim you have to add the central maven repositories to your build.gradle and configure the testCompile configuration to include jcardsim in the version you want.

repositories {
    mavenCentral()
}

dependencies {
    testCompile 'com.licel:jcardsim:2.2.2'
}

If you follow the above the plugin will filter the runtime classpath of the test source set (usually the classes you have under /src/test). The aim is to remove the lib/api.jar from the javacard sdk in order to prevent clashes between the official javacard api and one provided by jcardsim.

Building without javacard sdk

In case you want to run the build and the test one a continuous integration system, you can do so without providing a javacard sdk. If no sdk is detected but jcardsim has been added the plugin compiles you applet against the javacard api provided by jcardsim.

Converting the java code to java card applet is not supported without javacard sdk.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap