Oxford University Press 2007. All rights reserved. Java, · PDF fileOxford University Press...
Transcript of Oxford University Press 2007. All rights reserved. Java, · PDF fileOxford University Press...
![Page 1: Oxford University Press 2007. All rights reserved. Java, · PDF fileOxford University Press 2007. All rights reserved. 1 Mobile Application Languages ─ XML, Java, J2ME and JavaCard](https://reader031.fdocuments.in/reader031/viewer/2022022504/5ab53c5d7f8b9a156d8c911e/html5/thumbnails/1.jpg)
© Oxford University Press 2007. All rights reserved. 1
Mobile Application Languages─ XML, Java, J2ME and JavaCard
Lesson 07JavaCard
![Page 2: Oxford University Press 2007. All rights reserved. Java, · PDF fileOxford University Press 2007. All rights reserved. 1 Mobile Application Languages ─ XML, Java, J2ME and JavaCard](https://reader031.fdocuments.in/reader031/viewer/2022022504/5ab53c5d7f8b9a156d8c911e/html5/thumbnails/2.jpg)
© Oxford University Press 2007. All rights reserved. 2
Java Card
• Has CPU with limited processing command and low clock frequency operations
• An IC card─ 4 kB ROM • A microprocessor card with 18 kB flash
read only memory
![Page 3: Oxford University Press 2007. All rights reserved. Java, · PDF fileOxford University Press 2007. All rights reserved. 1 Mobile Application Languages ─ XML, Java, J2ME and JavaCard](https://reader031.fdocuments.in/reader031/viewer/2022022504/5ab53c5d7f8b9a156d8c911e/html5/thumbnails/3.jpg)
© Oxford University Press 2007. All rights reserved. 3
JavaCard (Java for card)
• A micro-edition of Java for the cards• A limited-memory sized edition for cards,
labels, tokens, and similar devices which have limited memory as well as processing capacity
![Page 4: Oxford University Press 2007. All rights reserved. Java, · PDF fileOxford University Press 2007. All rights reserved. 1 Mobile Application Languages ─ XML, Java, J2ME and JavaCard](https://reader031.fdocuments.in/reader031/viewer/2022022504/5ab53c5d7f8b9a156d8c911e/html5/thumbnails/4.jpg)
© Oxford University Press 2007. All rights reserved. 4
JavaCard 2.2.2
• Provides interoperability for cards and APIs for highly memory-efficient applications
• Has multiple communication interfaces for inter card-host contact/contactless (wireless) communication APIs
![Page 5: Oxford University Press 2007. All rights reserved. Java, · PDF fileOxford University Press 2007. All rights reserved. 1 Mobile Application Languages ─ XML, Java, J2ME and JavaCard](https://reader031.fdocuments.in/reader031/viewer/2022022504/5ab53c5d7f8b9a156d8c911e/html5/thumbnails/5.jpg)
© Oxford University Press 2007. All rights reserved. 5
JavaCard 2.2.2
• ISO7816-based Extended length APDU support
• 20 maximum number of logical communication channels
• Provides standard communication with the host using latest SIM cards
![Page 6: Oxford University Press 2007. All rights reserved. Java, · PDF fileOxford University Press 2007. All rights reserved. 1 Mobile Application Languages ─ XML, Java, J2ME and JavaCard](https://reader031.fdocuments.in/reader031/viewer/2022022504/5ab53c5d7f8b9a156d8c911e/html5/thumbnails/6.jpg)
© Oxford University Press 2007. All rights reserved. 6
javacard.security and javacard.crypto
• Supports digital-signature-based message recovery and advanced cryptography class libraries for HMAC-MD5, HMAC-SHA1, and SHA-256
![Page 7: Oxford University Press 2007. All rights reserved. Java, · PDF fileOxford University Press 2007. All rights reserved. 1 Mobile Application Languages ─ XML, Java, J2ME and JavaCard](https://reader031.fdocuments.in/reader031/viewer/2022022504/5ab53c5d7f8b9a156d8c911e/html5/thumbnails/7.jpg)
© Oxford University Press 2007. All rights reserved. 7
Java Card framework (javacard.framework)
• Provides the library functions, Card interfaces, PIN (personal identification number), and ISO 7816 APIs for Card applet
• JCardSystem─ a class in JavaCard, has a method makeTransientArray ( )
• The method creates a transient array and it persists till power is down
![Page 8: Oxford University Press 2007. All rights reserved. Java, · PDF fileOxford University Press 2007. All rights reserved. 1 Mobile Application Languages ─ XML, Java, J2ME and JavaCard](https://reader031.fdocuments.in/reader031/viewer/2022022504/5ab53c5d7f8b9a156d8c911e/html5/thumbnails/8.jpg)
© Oxford University Press 2007. All rights reserved. 8
JavaCard Profile
• A set of limited class libraries• SmartCard Profile─ has a separate
virtual machine called card VM
![Page 9: Oxford University Press 2007. All rights reserved. Java, · PDF fileOxford University Press 2007. All rights reserved. 1 Mobile Application Languages ─ XML, Java, J2ME and JavaCard](https://reader031.fdocuments.in/reader031/viewer/2022022504/5ab53c5d7f8b9a156d8c911e/html5/thumbnails/9.jpg)
© Oxford University Press 2007. All rights reserved. 9
The card VM
• Different for different card OSes
![Page 10: Oxford University Press 2007. All rights reserved. Java, · PDF fileOxford University Press 2007. All rights reserved. 1 Mobile Application Languages ─ XML, Java, J2ME and JavaCard](https://reader031.fdocuments.in/reader031/viewer/2022022504/5ab53c5d7f8b9a156d8c911e/html5/thumbnails/10.jpg)
© Oxford University Press 2007. All rights reserved. 10
JavaCard Executive
• Provides communication I/O streams between the JavaCard APIs and supports interoperability among the cards from different hardware and different card OSes
![Page 11: Oxford University Press 2007. All rights reserved. Java, · PDF fileOxford University Press 2007. All rights reserved. 1 Mobile Application Languages ─ XML, Java, J2ME and JavaCard](https://reader031.fdocuments.in/reader031/viewer/2022022504/5ab53c5d7f8b9a156d8c911e/html5/thumbnails/11.jpg)
© Oxford University Press 2007. All rights reserved. 11
Card virtual machine (CardVM)
• Has an instruction set for a subset of Java language
• Installs applets and libraries into Java Card-based devices
• CardVM does not support weak reference as already mentioned for KVM
![Page 12: Oxford University Press 2007. All rights reserved. Java, · PDF fileOxford University Press 2007. All rights reserved. 1 Mobile Application Languages ─ XML, Java, J2ME and JavaCard](https://reader031.fdocuments.in/reader031/viewer/2022022504/5ab53c5d7f8b9a156d8c911e/html5/thumbnails/12.jpg)
© Oxford University Press 2007. All rights reserved. 12
CardVM
• A virtual machine which has no char• No double precision, or single precision • No floating point mathematical
operations support• supports only Boolean, 8 bit Byte, BCD,
6 bit integer (short) (32 bit integer support optional)
• Limited exceptional handling
![Page 13: Oxford University Press 2007. All rights reserved. Java, · PDF fileOxford University Press 2007. All rights reserved. 1 Mobile Application Languages ─ XML, Java, J2ME and JavaCard](https://reader031.fdocuments.in/reader031/viewer/2022022504/5ab53c5d7f8b9a156d8c911e/html5/thumbnails/13.jpg)
© Oxford University Press 2007. All rights reserved. 13
CardVM
• No object clones• No String class libraries• No automatic garbage collection
(memory freeing)• No native support using JNI (Java native
interface) to use C/C++ application interface with the Java APIs
![Page 14: Oxford University Press 2007. All rights reserved. Java, · PDF fileOxford University Press 2007. All rights reserved. 1 Mobile Application Languages ─ XML, Java, J2ME and JavaCard](https://reader031.fdocuments.in/reader031/viewer/2022022504/5ab53c5d7f8b9a156d8c911e/html5/thumbnails/14.jpg)
© Oxford University Press 2007. All rights reserved. 14
CardVM
• No SecurityManager class libraries• No multi-threading• No ThreadGroup
![Page 15: Oxford University Press 2007. All rights reserved. Java, · PDF fileOxford University Press 2007. All rights reserved. 1 Mobile Application Languages ─ XML, Java, J2ME and JavaCard](https://reader031.fdocuments.in/reader031/viewer/2022022504/5ab53c5d7f8b9a156d8c911e/html5/thumbnails/15.jpg)
© Oxford University Press 2007. All rights reserved. 15
Card applets
• For application execution • Java class libraries of the application
![Page 16: Oxford University Press 2007. All rights reserved. Java, · PDF fileOxford University Press 2007. All rights reserved. 1 Mobile Application Languages ─ XML, Java, J2ME and JavaCard](https://reader031.fdocuments.in/reader031/viewer/2022022504/5ab53c5d7f8b9a156d8c911e/html5/thumbnails/16.jpg)
© Oxford University Press 2007. All rights reserved. 16
Card applets
• Java Card is a technology which supports a secure environment for smart cards and small-devices applets
• Multiple applets can be deployed on a single card and new ones can be added any time at the user end
![Page 17: Oxford University Press 2007. All rights reserved. Java, · PDF fileOxford University Press 2007. All rights reserved. 1 Mobile Application Languages ─ XML, Java, J2ME and JavaCard](https://reader031.fdocuments.in/reader031/viewer/2022022504/5ab53c5d7f8b9a156d8c911e/html5/thumbnails/17.jpg)
© Oxford University Press 2007. All rights reserved. 17
card Applet
• Creates card-specific byte code on compilation
• Java applet has lifecycle starting from initiate, followed by start, stop, and destroy
![Page 18: Oxford University Press 2007. All rights reserved. Java, · PDF fileOxford University Press 2007. All rights reserved. 1 Mobile Application Languages ─ XML, Java, J2ME and JavaCard](https://reader031.fdocuments.in/reader031/viewer/2022022504/5ab53c5d7f8b9a156d8c911e/html5/thumbnails/18.jpg)
© Oxford University Press 2007. All rights reserved. 18
Applet for communication
• Uses select method for selecting the process APDU whether it is a command APDU or response APDU
• Card applet differs from Java applet as it can reside permanently on card
• Objects created by card applet are persistent
• When applet is deselected the transient array disposes
![Page 19: Oxford University Press 2007. All rights reserved. Java, · PDF fileOxford University Press 2007. All rights reserved. 1 Mobile Application Languages ─ XML, Java, J2ME and JavaCard](https://reader031.fdocuments.in/reader031/viewer/2022022504/5ab53c5d7f8b9a156d8c911e/html5/thumbnails/19.jpg)
© Oxford University Press 2007. All rights reserved. 19
Applet for communication
• Command APDU identifies a class for instruction, finds specific instruction from the class, uses two bytes for two parameters of the instruction, and specifies the length of optional data with the APDU
• Response APDU has data (optional) and two byes for status words
![Page 20: Oxford University Press 2007. All rights reserved. Java, · PDF fileOxford University Press 2007. All rights reserved. 1 Mobile Application Languages ─ XML, Java, J2ME and JavaCard](https://reader031.fdocuments.in/reader031/viewer/2022022504/5ab53c5d7f8b9a156d8c911e/html5/thumbnails/20.jpg)
© Oxford University Press 2007. All rights reserved. 20
JCRE (Java Card runtime environment)
• Interprets the card byte codes and implements them using Java Card virtual machine
• Does not support inter-communication between different card applets
• Provides runtime support to the services like selection and de-selection of applets
![Page 21: Oxford University Press 2007. All rights reserved. Java, · PDF fileOxford University Press 2007. All rights reserved. 1 Mobile Application Languages ─ XML, Java, J2ME and JavaCard](https://reader031.fdocuments.in/reader031/viewer/2022022504/5ab53c5d7f8b9a156d8c911e/html5/thumbnails/21.jpg)
© Oxford University Press 2007. All rights reserved. 21
Summary
• JavaCard─ A limited-memory sized edition for cards, labels, tokens, and similar devices which have limited memory as well as processing capacity
• javacard.crypto and javacard.security• Card Profile • Card VM• Card Applet
![Page 22: Oxford University Press 2007. All rights reserved. Java, · PDF fileOxford University Press 2007. All rights reserved. 1 Mobile Application Languages ─ XML, Java, J2ME and JavaCard](https://reader031.fdocuments.in/reader031/viewer/2022022504/5ab53c5d7f8b9a156d8c911e/html5/thumbnails/22.jpg)
© Oxford University Press 2007. All rights reserved. 22
End of Lesson 07JavaCard