Giter Club home page Giter Club logo

globalplatformpro's Introduction

GlobalPlatformPro from javacard.pro

Load and manage applets on compatible JavaCards from command line or from your Java project with a Do What I Mean approach.

Provides an easy to use and high level interface that most of the time JustWorks(TM), is flexible and 100% open source!

Jump to ...

Get it now!

  • Download latest pre-built .JAR or .EXE from release area
  • Or fetch from GitHub and build it yourself, it is really easy:
git clone https://github.com/martinpaljak/GlobalPlatformPro
cd GlobalPlatformPro
ant

NEWS

Build status

  • Travis - Build Status
  • Coverity - Coverity status

Usage

Beware: until v0.5 is released, both command line and Java API are subject to change without notice. Check back often.

Warning about correct keying

Command line samples assume default test keys of 40..4F. If you need custom keys, specify them with any or all of the following options: -keyid -keyver and -enc -mac -kek or -key (for a single master key). You need to know the details or ask your card provider. Some cards require key diversification with -emv or -visa2 (you should be notified if that's the case).

  • Show some basic information about a card (failsafe):

     java -jar gp.jar -info
    
    • On Windows just replace java -jar gp.jar with gp.exe like this:

         gp.exe -info
      
    • On Linux it is easier to add an alias to the shell like this:

         alias gp="java -jar $PWD/gp.jar"
         # Now you can avoid typing java -jar and gp works from any folder
         gp -h
      

List / install / delete applets

  • List applets (this and following commands open the secure channel and thus can brick your card with wrong keys!):

     gp -list # or gp -l
    
  • Delete current default applet:

     gp -delete -default
    
  • Delete module D27600012401 and all applets from it:

     gp -delete D27600012401 -deletedeps
    
  • Install applet.cap as default applet (with AID information from the CAP):

     gp -install applet.cap -default
    
  • Install applet.cap (with AID information from the CAP):

     gp -install applet.cap
    
  • Unistall applet.cap (with AID information from the CAP):

     gp -uninstall applet.cap
    

Lock / unlock usage

  • Set 010B0371D78377B801F2D62AFC671D95 key to a card with default 40..4F keys:

     gp -lock 010B0371D78377B801F2D62AFC671D95
    
  • Set default 40..4F keys to card that was previously locked with key 010B0371D78377B801F2D62AFC671D95:

     gp -key 010B0371D78377B801F2D62AFC671D95 -unlock
    
  • Set the default 40..4F keys to a card that uses EMV diversification (like G&D):

     gp -emv -unlock
    

    * note that you will have to use --relax option after this operation to get rid of the warning about probably needed diversification, which is not true any more.

  • Set the default 40..4F keys to a card that uses VISA2 diversification with the well-known mother key on a Gemalto card:

     gp -visa2 -key 47454D5850524553534F53414D504C45 -unlock -mode clr
    

Debugging options

  • Show APDU-s sent to the card:

    add -debug or -d to your command

  • Be more verbose about decisions and conditions:

    add -verbose or -v to your command

  • Don't use MAC on commands (plain GlobalPlatform syntax):

    add -mode clr to your command (not supported on all cards)

  • Show all options recognized by gp utility:

    add -help or -h or --help to your gp command

Usage from Java

  • For now consult the command line utility source code
  • Rudimentary Javadoc
  • General rules:
    • Expect RuntimeException-s when things go unexpectedly wrong
    • CardException-s when link layer fails
    • GPException-s when protocol layer fails

Supported cards

History

The ancestor of this code is GPJ (Global Platform for SmartCardIO) which is (still) available from http://gpj.sourceforge.net. I started the project because I felt that messing with cryptic script files was not nice and I wanted to have a simple, open source, usable and native-to-the-rest-of-development-environment (Java) toolchain.

Credits (from GPJ):

Similar projects

Upcoming releases and major new features

  • NEW! Have a look at milestones
  • T+1 (v0.2.5)
    • Re-written command line utility
    • Windows .exe for ease of use
    • -lock and -unlock commands for changing secure channel keys
  • T+2 (v0.3.0)
    • SCP03 v1.1.1 and GP2.2.1
  • T+X (wishlist)
    • Support for storing card management keys in PKCS#11 tokens (HSM)
    • GPShell-style scripts (instead of Java)
    • Simple GUI for basic operations/browsing

Design principles

  • focus on real life and practical daily use cases
  • KISS, YAGNI, DWIM, no-NIH
  • APDU-chat over javax.smartcardio to (most probably real) tokens
  • thin and self-contained, re-usable, easy to integrate
  • easily readable, auditable and secure codebase (less is more)

About OpenKMS

The promise of OpenKMS is similar* to OpenSSL:

Why buy a smart card software kit as a black box when you can get an open one for free?

In regard to GlobalPlatform, the goal is to make simple operations like installing and removing applets and locking the card with new keys as easy as next-next-done - you don't have to know the whole Global Platform specification by heart for that or buy a piece of proprietary software for a few hundred euros! For all those features that are not described in the GlobalPlatform specification that actually make your card work... you still have to use those proprietary commands, but OpenKMS GlobalPlatformPro toolkit's flexibility (and its license) should allow you to do that as well.

* With the difference that OpenKMS thrives for a easily usable and pleasantly readable, auditable and secure codebase. And yes, you have probably already sold your soul to the devil...

License

  • LGPL 3.0 for derived code and MIT/LGPL3 for original code.

Included/used open source projects

  • BouncyCastle for OID parsing and NIST SP 800-108/NIST SP 800-38B (MIT)
  • JOpt Simple for parsing command line (MIT)
  • Launch4j for generating the .exe (BSD/MIT)
  • apdu4j for APDU access/logging/replaying (MIT)

Contact

Legal disclaimer

The casual: trademarks to their owners, copyrights to authors, software patents to hell, legal letters to /dev/null PGP key 0x307E3452. Everything is provided AS-IS AND THERE IS A CONSTANT RISK OF DEATH FROM SUDDEN LIGHTNING. Writing in all caps made it look like serious, didn't it?


OpenKMS - open source key management - openkms.org / JavaCard.pro

globalplatformpro's People

Contributors

martinpaljak avatar robertbachmann avatar koluch avatar

Watchers

James Cloos avatar NyoikeThuo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.