Java Card Platform - Oracle

[Pages:134]Java CardTM Platform

Runtime Environment Specification, Classic Edition

Version 3.1

February 2021

Java Card Platform Runtime Environment Specification, Classic Edition Version 3.1

Copyright ? 1998, 2021, Oracle and/or its affiliates. All rights reserved.

The Specification provided herein is provided to you only under the Oracle Technology Network Developer License included herein as Annex A - Oracle Technology Network Developer License Terms.

License Restrictions Warranty/Consequential Damages Disclaimer

This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited.

Warranty Disclaimer

The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing.

Restricted Rights Notice

If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, then the following notice is applicable:

U.S. GOVERNMENT END USERS: Oracle programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, delivered to U.S. Government end users are "commercial computer software" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, use, duplication, disclosure, modification, and adaptation of the programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, shall be subject to license terms and license restrictions applicable to the programs. No other rights are granted to the U.S. Government.

Hazardous Applications Notice

This software or hardware is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications that may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software or hardware in dangerous applications.

Trademark Notice

Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group.

Page 2

Java Card Platform Runtime Environment Specification, v3.1

Third-Party Content, Products, and Services Disclaimer

This software or hardware and documentation may provide access to or information about content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services unless otherwise set forth in an applicable agreement between you and Oracle. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services, except as set forth in an applicable agreement between you and Oracle.

Documentation Accessibility

For information about Oracle's commitment to accessibility, visit the Oracle Accessibility Program website at .

Access to Oracle Support

Oracle customers that have purchased support have access to electronic support through My Oracle Support. For information, visit or visit if you are hearing impaired.

Java Card Platform Runtime Environment Specification, v3.1

Page 3

Page 4

Java Card Platform Runtime Environment Specification, v3.1

Contents

Preface .......................................................................................................................................... 14 Who Should Use This Specification......................................................................................................... 14 Before You Read This Specification......................................................................................................... 14 Shell Prompts .......................................................................................................................................... 14 Typographic Conventions ....................................................................................................................... 15 Related Documentation .......................................................................................................................... 15 Third-Party Web Sites ............................................................................................................................. 15 Documentation Accessibility................................................................................................................... 16 Access to Oracle Support ........................................................................................................................ 16 Oracle Welcomes Your Comments ......................................................................................................... 16

1 Introduction .............................................................................................................................. 17 2 Lifetime of the Java Card Virtual Machine ................................................................................ 19

2.1 Initialization....................................................................................................................................... 19 3 Java Card Applet Lifetime.......................................................................................................... 21

3.1 install Method............................................................................................................................ 21 3.2 select Method .............................................................................................................................. 22 3.3 process Method............................................................................................................................ 22 3.4 deselect Method(s) ..................................................................................................................... 23 3.5 uninstall Method ....................................................................................................................... 23 3.6 Power Loss and Reset ....................................................................................................................... 23

3.6.1 Concurrent Operations Over Multiple Interfaces ...................................................................... 24 4 Logical Channels and Applet Selection ..................................................................................... 27

4.1 Logical Channels Overview ............................................................................................................... 27 4.2 Default Applets ................................................................................................................................. 30

4.2.1 Card Reset Behavior................................................................................................................... 30 4.2.2 Proximity Card (PICC) Activation Behavior ................................................................................ 31 4.2.3 Default Applet Selection Behavior on Opening a New Channel ................................................ 31 4.3 Multiselectable Applets .................................................................................................................... 32

Java Card Platform Runtime Environment Specification, v3.1

Page 5

4.4 Forwarding APDU Commands To a Logical Channel......................................................................... 34 4.5 Opening and Closing Logical Channels.............................................................................................. 36

4.5.1 MANAGE CHANNEL Command Processing ................................................................................ 36 4.6 Applet Selection ................................................................................................................................ 37

4.6.1 Applet Selection with MANAGE CHANNEL OPEN ...................................................................... 37 4.6.2 Applet Selection with SELECT FILE ............................................................................................. 39 4.7 Applet Deselection ............................................................................................................................ 41 4.7.1 MANAGE CHANNEL CLOSE Command ........................................................................................... 42 4.8 Other Command Processing ............................................................................................................. 42 5 Memory Model ......................................................................................................................... 45 5.1 Transient Objects .............................................................................................................................. 46 5.1.1 Transient Objects Characteristics .............................................................................................. 46 5.1.2 Events That Clear Transient Objects .......................................................................................... 46 5.2 Temporary Objects............................................................................................................................ 47 5.3 Array views........................................................................................................................................ 48 5.3.1 Characteristics of an Array View ................................................................................................ 48 5.3.2 Creating and Using an Array View ............................................................................................. 49 6 Applet Isolation and Object Sharing ......................................................................................... 51 6.1 Applet Firewall .................................................................................................................................. 51 6.1.1 Firewall Protection ..................................................................................................................... 51 6.1.2 Contexts and Context Switching ................................................................................................ 51

6.1.2.1 Active Contexts in the VM .................................................................................................. 52 6.1.2.2 Context Switching in the VM............................................................................................... 53 6.1.3 Object Ownership ...................................................................................................................... 53 6.1.4 Object Access ............................................................................................................................. 54 6.1.5 Transient Objects and Contexts ................................................................................................. 55 6.1.6 Static Fields and Methods.......................................................................................................... 56 6.1.6.1 Optional Static Access Checks............................................................................................. 56 6.2 Object Access Across Contexts ......................................................................................................... 56 6.2.1 Java Card RE Entry Point Objects ............................................................................................... 56 6.2.2 Sharing Arrays ............................................................................................................................ 57

Page 6

Java Card Platform Runtime Environment Specification, v3.1

6.2.2.1 Sharing using Global Arrays ................................................................................................ 58 6.2.2.2 Sharing using Array Views................................................................................................... 58 6.2.3 Java Card RE Privileges ............................................................................................................... 58 6.2.4 Shareable Interfaces .................................................................................................................. 59 6.2.4.1 Server Applet A Builds a Shareable Interface Object.......................................................... 59 6.2.4.2 Client Applet B Obtains the Shareable Interface Object..................................................... 60 6.2.4.3 Client Applet B Requests Services from Applet A ............................................................... 60 6.2.5 Determining the Previous Context............................................................................................. 61 6.2.5.1 Java Card RE Context........................................................................................................... 61 6.2.6 Shareable Interface Details ........................................................................................................ 61 6.2.6.1 Java Card API Shareable Interface ...................................................................................... 61 6.2.7 Obtaining Shareable Interface Objects ...................................................................................... 62 6.2.7.1 Applet.getShareableInterfaceObject(AID, byte) Method ................... 62 6.2.7.2 JCSystem.getAppletShareableInterfaceObject Method .......................... 62 6.2.8 Class and Object Access Behavior .............................................................................................. 63 6.2.8.1 Accessing Static Class Fields................................................................................................ 63 6.2.8.2 Accessing Array Objects ...................................................................................................... 64 6.2.8.3 Accessing Class Instance Object Fields ............................................................................... 64 6.2.8.4 Accessing Class Instance Object Methods .......................................................................... 64 6.2.8.5 Accessing Standard Interface Methods .............................................................................. 65 6.2.8.6 Accessing Shareable Interface Methods ............................................................................. 65 6.2.8.7 Throwing Exception Objects ............................................................................................... 65 6.2.8.8 Accessing Classes ................................................................................................................ 65 6.2.8.9 Accessing Standard Interfaces ............................................................................................ 66 6.2.8.10 Accessing Shareable Interfaces......................................................................................... 66 6.2.8.11 Accessing Array Object Methods ...................................................................................... 66 7 Transactions and Atomicity....................................................................................................... 67 7.1 Atomicity ........................................................................................................................................... 67 7.2 Transactions ...................................................................................................................................... 67 7.3 Transaction Duration ........................................................................................................................ 68 7.4 Nested Transactions.......................................................................................................................... 68

Java Card Platform Runtime Environment Specification, v3.1

Page 7

7.5 Tear or Reset Transaction Failure ..................................................................................................... 68 7.6 Aborting a Transaction...................................................................................................................... 68

7.6.1 Programmatic Abortion ............................................................................................................. 69 7.6.2 Abortion by the Java Card RE..................................................................................................... 69 7.6.3 Cleanup Responsibilities of the Java Card RE............................................................................. 69 7.7 Transient Objects and Global Arrays................................................................................................. 69 7.8 Commit Capacity ............................................................................................................................... 69 7.9 Context Switching ............................................................................................................................. 70 8 Remote Method Invocation ...................................................................................................... 71 8.1 Java Card Platform RMI..................................................................................................................... 71 8.1.1 Remote Objects.......................................................................................................................... 71

8.1.1.1 Parameters and Return Values ........................................................................................... 71 8.1.1.2 Exceptions ........................................................................................................................... 72 8.1.1.3 Functional Limitations......................................................................................................... 72 8.2 RMI Messages ................................................................................................................................... 72 8.2.1 Applet Selection ......................................................................................................................... 73 8.2.2 Method Invocation..................................................................................................................... 73 8.3 Data Formats..................................................................................................................................... 73 8.3.1 Remote Object Identifier ........................................................................................................... 74 8.3.2 Remote Object Reference Descriptor ........................................................................................ 74 8.3.3 Method Identifier....................................................................................................................... 76 8.3.4 Parameter Encoding................................................................................................................... 76 8.3.4.1 Primitive Data Type Parameter Encoding ........................................................................... 77 8.3.4.2 Array Parameter Encoding .................................................................................................. 77 8.3.5 Return Value Encoding............................................................................................................... 78 8.3.5.1 Normal Response Encoding ................................................................................................ 78 8.3.5.2 Exception Response Encoding ............................................................................................ 79 8.3.5.3 Error Response Encoding .................................................................................................... 80 8.4 APDU Command Formats ................................................................................................................. 80 8.4.1 SELECT FILE Command ............................................................................................................... 80 8.4.2 INVOKE Command ..................................................................................................................... 82

Page 8

Java Card Platform Runtime Environment Specification, v3.1

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download