Smart Card Application Development
Comprehensive smart card application implementing secure wallet functionality using Java Card technology. Features APDU communication, PIN verification, and transaction processing with advanced security protocols.
Dual application architecture with secure smart card and host communication
Secure wallet applet running on the smart card with comprehensive financial transaction capabilities.
Desktop application providing user interface and communication bridge to the smart card applet.
Watch the complete Java Card application in action with secure transactions
Now let's study the fundamentals of Java Card technology.
When a Java Card applet is installed an instance is created and registered with the (Java card runtime environment) JCRE's registry table. The host application sets up the connection to the port 9025 to communicate with the applet. The JCRE selects an applet on the card based on the incoming select commands. Each applet is identified and selected by using its application identifier (AID). Commands such as selection command are formatted and transmitted in the form of application protocol data units (APDUs). Applets reply to each APDU command with a status word (SW) that indicates the result of the operation. An applet can optionally reply to an APDU command with other data.
A smart card size of credit card stores and processes information through the electronic circuits embedded in silicon in the plastic substrate of its body. An intelligent smart card contains a microprocessor and offers read, write, and calculating capability, like a small microcomputer. A smart card does not contain its own power supply, display, or keyboard. It interacts with a Card Acceptance Device (CAD) through using a communication interface, provided by a collection of eight electrical or optical contact points, as shown in fig,

A Java Card is a smart card that is capable of running Java programs. The applications are devoloped in java using Java Card APIs. According to java card specification it supports only few primitive data types from Java programming language: byte, short, int and boolean. A byte is an 8-bit signed two’s complement number with a possible range of values between -128 to 127. A short is a 16-bit signed two’s complement number with a possible range of values between -32768 to 32767. Internally, Java Card technology represents the boolean type as a byte. The Java Card platform does not support threads because current smart card central processing units (CPUs) cannot support efficient multitasking. As a result, none of the thread keywords are supported. There is also no support for synchronized or volatile on the Java Card platform.
The Java Card Virtual Machine (VM) provides bytecode execution environment and Java language support, including exception handling. The Java Card Runtime Environment (JCRE) includes a virtual machine (VM) and core classes to support APDU routing, ISO communication protocols, and transaction-based processing. Java Card VM executes bytecode, manages classes and objects, enforces separation between applications (firewalls), and enables secure data sharing.

When two computers communicate with each other, they exchange data packets, which are constructed following a set of protocols. Similarly, smart cards speak to the outside world using their own data packets -- called APDU (Application Protocol Data Units). Smart cards are reactive communicators—that is, they never initiate communications, they only respond to APDUs from the CAD (Card acceptance device). The communication model is command-response based—that is, the card receives a command APDU, performs the processing requested by the command, and returns a response APDU.
The following tables illustrate command and response APDU formats, respectively. APDU structure shown below is as described in ISO-7816.

CLA: Class byte. In many smart cards, this byte is used to identify an application.
INS: Instruction byte. This byte indicates the instruction code.
P1-P2: Parameter bytes. These provide further qualification to the APDU command.
Lc denotes the number of bytes in the data field of the command APDU.
Le denotes the maximum number of bytes expected in the data field of the following response APDU.

Off-the-shelf Java technology development tools can be used to create and compile the source code for Java Card applets. For my project I used the tools,
1. NetBeans IDE 8.0.2
2. Java card development kit 3.0.2 Connected Edition
Once the Java software source code is compiled into a class file, a post-processed version of the applet, suitable for loading on Java technology smart cards is created using the Java Card Converter tool. An instance of applet is created and registered with the JCRE

If you are new to Java Card and you really want to develop an application using java card, I suggest you having a look at Java Card Development Quick Start Guide and Writing a Java Card Applet. It will teach you how to start with java card and also it might be useful to follow this post and the code.
Applet receives APDU commands and data as an input and executes piece of code for the desired operation.
Applet outputs response APDU by setting the status words and data field (optional) in the APDU to indicate processing state of the card to termainal application.
Understanding the foundations of smart card application development
Smart cards are credit card-sized devices containing embedded microprocessors and memory. They store and process information through electronic circuits in silicon substrates, offering read, write, and calculating capabilities like miniature computers.
Java Cards run Java programs using specialized APIs. The platform supports primitive data types (byte, short, int, boolean) with specific ranges and limitations. No thread support due to CPU constraints, focusing on security and efficiency.
Virtual Machine and runtime architecture for secure applet execution
Bytecode execution environment with Java language support and exception handling
Command routing system directing APDUs to appropriate applet instances
Application separation and secure data sharing mechanisms
Atomic operation support with rollback capabilities
Professional tools and workflow for Java Card application development
Integrated development environment with Java Card support and project templates
Version 3.0.2 Connected Edition with converter tools and runtime environment
Post-processing tool creating deployable CAP files from compiled class files