Presentation is loading. Please wait.

Presentation is loading. Please wait.

Femto Java Developing Java applications for tiny footprint platforms Eduard de Jong QC Technology B.V. BOF 2187

Similar presentations


Presentation on theme: "Femto Java Developing Java applications for tiny footprint platforms Eduard de Jong QC Technology B.V. BOF 2187"— Presentation transcript:

1 Femto Java Developing Java applications for tiny footprint platforms Eduard de Jong QC Technology B.V. BOF 2187 http://java.net/projects/femto-java

2 This BoF session Learn about a different way to develop Java code for tiny platforms e.g. smart cards – With unit testing of on-platform code – In multiple packages in the same project See it used for Java Card tm platform code 29-09-14Femto Java—BOF 21872 Tiny Java platform: A Java programmable platform with a restricted and/or modified run time Deployment of Java code by optional pre-load processing of class files

3 Eduard de Jong Invented & patented core technology used in Java Card – 1994 Designed Java Card 2.0 – 1996 With the Java Card team at Sun Mircosystems Inc. – Architect for DMDC deployment of smart cards (CAC) – Till 2006 Active in ISO smart card standardization – Since 1994 Designed electronic cash system for smart cards and mobile phones – Implemented in UK with Java for Android and the Java Card Platform – Deployments soon 29-09-14Femto Java—BOF 21873

4 The Plan for this session Background Femto Java basics Femto Java Card Conclusion 29-09-14Femto Java—BOF 21874

5 Progress Background – Java Card vision – Java Card practices – Small Java Femto Java basics Femto Java Card Conclusion 29-09-14Femto Java—BOF 21875

6 Java Card vision Run java applications in a very restricted device – Initial constraints: 8 bit CPU <64K Program <16K Non-volatile memory <1K RAM Specify a framework for smart card application generic operations – IO – Crypto – Memory transactions Develop code for both sides at the same time – Communication code generated from same source Card Applet Card terminal application Bypass explicit use of APDUs 29-09-14Femto Java—BOF 21876

7 JC Development practice IDE project for Java Card platform one package at a time – All tools aimed at single-package development Design choice in Java Card to equate Java Card’s “fire wall” with a Java package No support for unit testing – No test driven development – Marginal support for refactoring No compile on save 29-09-14Femto Java—BOF 21877

8 History of small Java efforts – Java Card (1996) JC 2.0 (1997) – Femto Java I (1997) – Pico Java (1999) – Spotless (1999) KVM Java ME – Femto Java II (2000) – Squawk (2003) – Embedded Java (2011) – Femto Java III (2014) 29-09-14Femto Java—BOF 21878

9 Progress of this session Background Femto Java basics – Femto Java platform – Femto Java Code development process – Net Beans integration Femto Java Card Conclusion 29-09-14Femto Java—BOF 21879

10 Femto Java Femto Java: Principles & tools for developing Java code, programs and libraries, on restricted computing platforms: – Not the full Java runtime environment – Modified runtime functions – Java API with framework dedicated to platform purpose – Written in Java Executed using a Java-like interpreter Executable code created with post-compilation 29-09-14Femto Java—BOF 218710

11 Femto Java Development 29-09-14Femto Java—BOF 218711 Code, Compile & test Target code, unit test code, functional test code, support code Java SE runtime Processes annotations Restricted Platform runtime as library (Unit) tests Functional tests Compile Restricted Platform runtime +java.lang.annotation Reveals Restricted Platform Java subset errors Includes generated code Test on target platform Post compile (convert) Load Function tests Reuse test and support code

12 Femto in NetBeans 29-09-14Femto Java—BOF 218712 Femto core modules Mark packages for sub project type processing Perform Restricted Platform runtime compilation Restricted Platform I e.g. Java card Restricted Platform II e.g. Embedded Java for smart card terminal NB Code development project for Java SE project Code for restricted platform is in one or more ear- marked packages Creates a sub project type within the NB project

13 Progress of this session Background Femto Java basics Femto Java Card – Java Card tools – Java Card emulator Runtime reference Unit test support – Demo Conclusion 29-09-14Femto Java—BOF 218713

14 Femto Java Card tools Tools need to support multiple packages Rethink CAP file Java Card Converter – Wrapper around current tool – Calling order constraints enforced. CAP tools – Load APDU scripts generated in proper package calling order Dependency importer – Recognizes multi-package CAP files On-card platform enhancements – AbstractApplet Overridable initialization code TestApplet – On-card debugging support 29-09-14Femto Java—BOF 218714

15 Femto Java Card emulator Java Card platform API reference library Java Card platform implementation – In Java Implements almost all Java Card features – For (unit) testing Platform runtime environment instantiated per test External access to runtime static data 29-09-14Femto Java—BOF 218715

16 Unit testing The Java card runtime is instantiated at the start of each test. 29-09-14Femto Java—BOF 218716 class ShowFemtoUnitTest { @Before void initJavaCardRuntime() { //Create the runtime for the current test (Thread) JavaCardTestContext.getInstance(); } @Test void aMethodTest(){ //e.g. call a runtime static method byte[] bArr = JCSystem.makeTransientByteArray(10, 1); //Dispatched to the current runtime instance //test code … }

17 APDU Unit testing Explicit reference to Java card runtime to access APDU buffer 29-09-14Femto Java—BOF 218717 class ShowFemtoUnitTest { JavaCardTestContext context; @Before void initJavaCardRuntime() { //Keep reference to runtime context context = JavaCardTestContext.getInstance(); } @Test void aMethodTest(){ //Set the current APDU. APDU apdu = context.makeApdu(10, 0x80, 4, 0, 0, …); //test code … assertEquals(apdu, APDU.getCurrentAPDU()); }

18 APDU level testing The emulated Java Card runtime supports – Loading Java Card Applet instance – Specifying AID for the applet under test. – Specifying Shareable interface implementations – Initiating a session with an Applet With answer to SELECT command – Manufacturing APDUs for Applet session 29-09-14Femto Java—BOF 218718

19 Demo Time Opening a Java SE Project – Project prepared with Femto plugin modules – Marking packages for Java Card processing Run unit tests for Java Card library – Existing Java Card development with deployed code 29-09-14Femto Java—BOF 218719

20 Progress of this session Background Femto Java basics Femto Java Card Conclusion 29-09-14Femto Java—BOF 218720

21 Conclusion With the “Femto” principle development of code for the Java Card platform can benefit from all the powerful present day development tools in an IDE such as unit testing and refactoring. Principle applicable to a range of constrained Java platforms 29-09-14Femto Java—BOF 218721

22 Questions? 29-09-14Femto Java—BOF 218722

23 Thank you for your attention 29-09-14Femto Java—BOF 218723 http://java.net/projects/femto-java Eduard de Jong eduard@dejongfrz.nl


Download ppt "Femto Java Developing Java applications for tiny footprint platforms Eduard de Jong QC Technology B.V. BOF 2187"

Similar presentations


Ads by Google