Using smart cards with Java SE
JNI wrappers
Access to native PKCS#11 providers. Requires JNI and necessary host-side software.
- OpenSC-Java https://www.opensc-project.org/opensc-java/browser/trunk/pkcs11
- IAIK http://jce.iaik.tugraz.at/sic/Products/Core-Crypto-Toolkits/PKCS-11-Wrapper
- Sun PKCS#11 in 1.5+ http://java.sun.com/j2se/1.5.0/docs/guide/security/p11guide.html
Access to PC/SC for Java versions before 1.6. Should not be used for new applications, use Java 1.6 and javax.smartcardio instead
javax.smartcardio in 1.6+
- Low level PC/SC bridge (replaces and obsoletes jPCSC) http://java.sun.com/javase/6/docs/jre/api/security/smartcardio/spec/javax/smartcardio/package-summary.html
- PKCS#15 support (OpenSC-Java)
- GPJ http://sourceforge.net/projects/gpj/
- scuba http://scuba.sourceforge.net/
- OpenCard Framework http://www.openscdp.org/ocf/
Tips
- On Mac OS X 10.6 run the JRE with -d32 to force it into 32bit mode, otherwise smart card events won't work.
- Applets and out-of-browser windows: http://my.opera.com/daniel/blog/2010/05/31/new-opera-with-ns4-javaplugin
PKCS#15 in Java
Similar to the PKCS#15 generation/parsing software in OpenSC, but implemented in Java. Both use Bouncy Castle for actual ASN.1 encoding/decoding. Both use javax.smartcardio instead of the pcsc/openct/ctapi layer of OpenSC.
- in OpenSC-Java https://www.opensc-project.org/opensc-java/browser/trunk/pkcs15
- In javacardsign http://javacardsign.svn.sourceforge.net/viewvc/javacardsign/pkihostapi/src/net/sourceforge/javacardsign/iso7816_15/
- Alternative: use Java ASN.1 compiler instead.
GlobalPlatform in Java
GlobalPlatform deals with loading and managing JavaCard applets. There are currently two known implementations of GlobalPlatform specific functionality:
- GPJ (see above) uses javax.smartcardio and does not provide a GUI. Ideal for integrating purposes.
- jcManager http://www.brokenmill.com/2010/03/java-secure-card-manager/ uses jPCSC (see above) and provides a rudimentary GUI.