{"id":15284713,"url":"https://github.com/bertrandmartel/javacard-gradle-plugin","last_synced_at":"2025-05-07T03:45:30.797Z","repository":{"id":94808472,"uuid":"100190951","full_name":"bertrandmartel/javacard-gradle-plugin","owner":"bertrandmartel","description":":key: Gradle plugin for JavaCard development","archived":false,"fork":false,"pushed_at":"2018-11-06T21:51:37.000Z","size":149,"stargazers_count":33,"open_issues_count":11,"forks_count":16,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-05-07T03:45:18.943Z","etag":null,"topics":["gradle","gradle-plugin","groovy","javacard","javacard-applet","javacard-project","jcardsim","smartcard"],"latest_commit_sha":null,"homepage":"","language":"Groovy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bertrandmartel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-13T16:50:19.000Z","updated_at":"2025-03-25T08:55:52.000Z","dependencies_parsed_at":"2023-03-14T21:01:33.777Z","dependency_job_id":null,"html_url":"https://github.com/bertrandmartel/javacard-gradle-plugin","commit_stats":{"total_commits":65,"total_committers":2,"mean_commits":32.5,"dds":0.06153846153846154,"last_synced_commit":"fc72e078e9c4a3926336713848d091afb55f6fc6"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertrandmartel%2Fjavacard-gradle-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertrandmartel%2Fjavacard-gradle-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertrandmartel%2Fjavacard-gradle-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertrandmartel%2Fjavacard-gradle-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bertrandmartel","download_url":"https://codeload.github.com/bertrandmartel/javacard-gradle-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252810273,"owners_count":21807759,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gradle","gradle-plugin","groovy","javacard","javacard-applet","javacard-project","jcardsim","smartcard"],"created_at":"2024-09-30T14:59:39.783Z","updated_at":"2025-05-07T03:45:30.778Z","avatar_url":"https://github.com/bertrandmartel.png","language":"Groovy","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JavaCard Gradle plugin\n\n[![Build Status](https://travis-ci.org/bertrandmartel/javacard-gradle-plugin.svg?branch=master)](https://travis-ci.org/bertrandmartel/javacard-gradle-plugin)\n[![Download](https://api.bintray.com/packages/bertrandmartel/maven/gradle-javacard/images/download.svg) ](https://bintray.com/bertrandmartel/maven/gradle-javacard/_latestVersion)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/fr.bmartel/gradle-javacard/badge.svg)](https://maven-badges.herokuapp.com/maven-central/fr.bmartel/gradle-javacard)\n[![Coverage Status](https://coveralls.io/repos/github/bertrandmartel/javacard-gradle-plugin/badge.svg?branch=master)](https://coveralls.io/github/bertrandmartel/javacard-gradle-plugin?branch=master)\n[![Javadoc](http://javadoc-badge.appspot.com/fr.bmartel/gradle-javacard.svg?label=javadoc)](http://javadoc-badge.appspot.com/fr.bmartel/gradle-javacard)\n[![License](http://img.shields.io/:license-mit-blue.svg)](LICENSE.md)\n\nA Gradle plugin for building JavaCard applets.\n\nThis plugin is a wrapper on [ant-javacard](https://github.com/martinpaljak/ant-javacard) and [Global Platform Pro](https://github.com/martinpaljak/GlobalPlatformPro), it is inspired by [gradle-javacard](https://github.com/fidesmo/gradle-javacard)\n\n## Features\n\n* build JavaCard applets (with the same capabilities as [ant-javacard](https://github.com/martinpaljak/ant-javacard))\n* install cap files\n* list applets\n* write quick testing scripts used to send apdu in a configurable way\n* expose `GpExec` task type that enables usage of [Global Platform Pro](https://github.com/martinpaljak/GlobalPlatformPro) tool inside Gradle\n* include [jcardsim 3.0.4](https://github.com/licel/jcardsim) and [JUnit 4.12](http://junit.org/junit4/) test dependency (clear distinction between JavaCard SDK \u0026 jcardsim SDK) \n* ability to specify key for delete/install/list tasks\n* possibility to add dependency between modules (exp \u0026 jar imported automatically)\n\n## Usage \n\n```groovy\nbuildscript {\n    repositories {\n        jcenter()\n    }\n    dependencies {\n        classpath 'fr.bmartel:gradle-javacard:1.5.6'\n    }\n}\n\napply plugin: 'javacard'\n\ndependencies {\n    compile 'com.github.martinpaljak:globalplatformpro:18.09.14'\n}\n\njavacard {\n\n    config {\n        \n        cap {\n            packageName 'fr.bmartel.javacard'\n            version '0.1'\n            aid '01:02:03:04:05:06:07:08:09'\n            output 'applet.cap'\n            applet {\n                className 'fr.bmartel.javacard.HelloWorld'\n                aid '01:02:03:04:05:06:07:08:09:01:02'\n            }\n        }\n    }\n          \n    scripts {\n        script {\n            name 'select'\n            apdu '00:A4:04:00:0A:01:02:03:04:05:06:07:08:09:01:00'\n        }\n        script {\n            name 'hello'\n            apdu '00:40:00:00:00'\n        }\n        task {\n            name 'sendHello'\n            scripts 'select', 'hello'\n        }\n    }\n}\n```\n\nplugin is available from `jcenter()` or `mavenCentral()`\n\nCheck [this project](https://github.com/bertrandmartel/javacard-tutorial) for more usage examples\n\n## JavaCard SDK path\n\nThe path to JavaCard SDK can be specified through : \n\n* use `jc.home` properties in `local.properties` file located in your project root (in the same way as Android projects) : \n  * in project root : `echo \"jc.home=$PWD/oracle_javacard_sdks/jc222_kit\" \u003e\u003e local.properties`\n* using `jckit` attribute (see [ant-javacard](https://github.com/martinpaljak/ant-javacard#syntax))\n* `JC_HOME` global environment variable, for instance using : `export JC_HOME=\"$PWD/sdks/jck222_kit\"`\n\n## Tasks\n\n| task name    | description   |\n|--------------|---------------|\n| buildJavaCard | build JavaCard cap files |\n| installJavaCard | delete existing aid \u0026 install all JavaCard cap files (`gp --delete XXXX --install file.cap`) |\n| listJavaCard | list applets (`gp -l`) |\n\nIt's possible to create custom tasks that will send series of custom apdu :\n\n```groovy\nscripts {\n    script {\n        name 'select'\n        apdu '00:A4:04:00:0A:01:02:03:04:05:06:07:08:09:01:00'\n    }\n    script {\n        name 'hello'\n        apdu '00:40:00:00:00'\n    }\n    task {\n        name 'sendHello'\n        scripts 'select', 'hello'\n    }\n}\n```\n\nThe above will create task `sendHello` that will select applet ID `01:02:03:04:05:06:07:08:09:01` and send the apdu `00:40:00:00:00`.  \nThe order of the scripts's apdu in `task.scripts` is respected.  \n`00:A4:04:00:0A:01:02:03:04:05:06:07:08:09:01:00` or `'00A404000A0102030405060708090100'` are valid apdu.\n\n## Custom Global Platform Pro task\n\nYou can build custom tasks that launch [Global Platform Pro](https://github.com/martinpaljak/GlobalPlatformPro) tool :\n\n```groovy\ntask displayHelp(type: fr.bmartel.javacard.gp.GpExec) {\n    description = 'display Global Platform pro help'\n    group = 'help'\n    args '-h'\n}\n```\n\n## More complex example\n\n```groovy\napply plugin: 'javacard'\n\ndependencies {\n    compile 'com.github.martinpaljak:globalplatformpro:18.09.14'\n}\n\nrepositories {\n    maven {\n        url 'http://dl.bintray.com/bertrandmartel/maven'\n    }\n}\n\njavacard {\n\n    config {\n        jckit '../oracle_javacard_sdks/jc222_kit'\n        cap {\n            packageName 'fr.bmartel.javacard'\n            version '0.1'\n            aid '01:02:03:04:05:06:07:08:09'\n            output 'applet1.cap'\n            applet {\n                className 'fr.bmartel.javacard.HelloSmartcard'\n                aid '01:02:03:04:05:06:07:08:09:01:02'\n            }\n            applet {\n                className 'fr.bmartel.javacard.GoodByeSmartCard'\n                aid '01:02:03:04:05:06:07:08:09:01:03'\n            }\n        }\n        cap {\n            packageName 'fr.bmartel.javacard'\n            version '0.1'\n            aid '01:02:03:04:05:06:07:08:0A'\n            output 'applet2.cap'\n            applet {\n                className 'fr.bmartel.javacard.SomeOtherClass'\n                aid '01:02:03:04:05:06:07:08:09:01:04'\n            }\n            dependencies {\n                local {\n                    jar '/path/to/dependency.jar'\n                    exps '/path/to/expfolder'\n                }\n                remote 'fr.bmartel:gplatform:2.1.1'\n            }\n        }\n    }\n    \n    defaultKey '40:41:42:43:44:45:46:47:48:49:4A:4B:4C:4D:4E:4F'\n    // or \n    /*\n    key {\n        enc '40:41:42:43:44:45:46:47:48:49:4A:4B:4C:4D:4E:4F'\n        kek '40:41:42:43:44:45:46:47:48:49:4A:4B:4C:4D:4E:4F' \n        mac '40:41:42:43:44:45:46:47:48:49:4A:4B:4C:4D:4E:4F' \n    }\n    */\n\n    scripts {\n        script {\n            name 'select'\n            apdu '00:A4:04:00:0A:01:02:03:04:05:06:07:08:09:01:00'\n        }\n        script {\n            name 'hello'\n            apdu '00:40:00:00:00'\n        }\n        task {\n            name 'sendHello'\n            scripts 'select', 'hello'\n        }\n    }\n}\n```\n\nNote1 : the `remote` dependency will automatically download the `jar` (the `jar` file must include the `exp` file)  \nNote2 : you can add as many `local` or `remote` dependency as you want\n\n## Syntax\n\n* javacard [Closure]\n  * config [Closure] - object that holds build configuration **Required**\n    * jckit [String] - path to the JavaCard SDK that is used if individual cap does not specify one. Optional if cap defines one, required otherwise. The path is relative to the module\n    * logLevel [String] - log level of ant-javacard task (\"VERBOSE\",\"DEBUG\",\"INFO\",\"WARN\",\"ERROR\"). default : \"INFO\"\n    * cap [Closure] - construct a CAP file **Required**\n      * jckit [String] - path to the JavaCard SDK to be used for this CAP. *Optional if javacard defines one, required otherwise*\n      * sources [String] - path to Java source code, to be compiled against the current JavaCard SDK. **Required**\n      * findSources [boolean] - default:true, if true the sources are determined automatically. The first existing source dir in source sets is taken\n      * defaultSources [boolean] - default:true, if true the first source dir from the source set is used. Otherwise the most recet (last)\n      * classes [String] - path to pre-compiled class files to be assembled into a CAP file. If both classes and sources are specified, compiled class files will be put to classes folder, which is created if missing\n      * packageName [String] - name of the package of the CAP file. Optional - set to the parent package of the applet class if left unspecified.\n      * version [String] - version of the package. Optional - defaults to 0.0 if left unspecified.\n      * aid [String] - AID (hex) of the package. Recommended - or set to the 5 first bytes of the applet AID if left unspecified.\n      * output [String] - path where to save the generated CAP file. if a filename or a non-absolute path is referenced, the output will be in `build/javacard/{output}` **Required**\n      * export [String] - path (folder) where to place the JAR and generated EXP file. Default output directory is `build/javacard`. Filename depends on `output` filename if referenced. Optional.\n      * jca [String] - path where to save the generated JavaCard Assembly (JCA) file. Default output directory is `build/javacard`. Filename depends on `output` filename if referenced. Optional.\n      * verify [boolean] - if set to false, disables verification of the resulting CAP file with offcardeverifier. Optional.\n      * debug [boolean] - if set to true, generates debug CAP components. Optional.\n      * ints [boolean] - if set to true, enables support for 32 bit int type. Optional.\n      * applet [Closure] - for creating an applet inside the CAP\n        * className [String] - class of the Applet where install() method is defined. **Required**\n        * aid [String] - AID (hex) of the applet. Recommended - or set to package aid+i where i is index of the applet definition in the build.xml instruction\n      * dependencies [Closure] - for linking against external components/libraries, like GPSystem or OPSystem\n        * local [Closure] local dependencies must include absolute path to exp/jar\n          * exps [String] - path to the folder keeping .exp files. Required\n          * jar [String] - path to the JAR file for compilation. Optional - only required if using sources mode and not necessary with classes mode if java code is already compiled\n        * remote [String] remote dependencies (ex: \"group:module:1.0\").the remote repository (maven repo) must be included in the project\n  * key [Closure] key configuration (if not defined the default keys will be used)\n    * enc [String] ENC key\n    * kek [String] KEK key\n    * mac [String] MAC key\n  * defaultKey [String] default key used (will be used for enc, kek and mac key if not specified in key closure)\n  * scripts [Closure] - object that holds the configurable scripts to send apdu\n     * script [Closure] - a script referenced by name/apdu value to be sent\n       * name [String] - script name (ex: select)\n       * apdu [String] - apdu value to be sent (it can hold \":\" to separate bytes)\n     * task [Closure] - gradle task to create that will map the specified list of apdu to send\n       * name [String] - task name\n       * scripts [String...] - list of script's name\n  * test [Closure] - additional configuration for tests(*)\n     * dependencies [Closure] - holds test dependencies\n       * compile [String] - add a dependencies (ex: 'junit:junit:4.12')\n\n(*) If you specify at least one dependency, jcardsim \u0026 junit won't be automatically added so you will need to add them manually if you need them for example :\n\n```groovy\ntest {\n    dependencies {\n        compile 'junit:junit:4.12'\n        compile 'com.licel:jcardsim:3.0.4'\n    }\n}\n```\n\n## Compatibility\n\nThis plugin has been tested on following IDE : \n\n* IntelliJ IDEA\n* Android Studio\n* Eclipse\n\nRecommended IDE : IntelliJ IDEA or Android Studio\n\n## License\n\nThe MIT License (MIT) Copyright (c) 2017-2018 Bertrand Martel\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbertrandmartel%2Fjavacard-gradle-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbertrandmartel%2Fjavacard-gradle-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbertrandmartel%2Fjavacard-gradle-plugin/lists"}