| |
|
| java.lang.Object com.sun.io.j2me.apdu.APDUManager
APDUManager | public class APDUManager (Code) | | This class provides an interface to the low level APDU protocol
details as described below:
1. Manage Card power up/reset.
2. APDU scheduler-Can assign priorities to APDUs to synchronize card
access. Synchronization is required between APDUs being sent by native
telecom software and APDUs sent by J2ME application. The reference
implementation will only have APDUs sent by the J2ME application which
would all have the same priority.
3. APDU Dispatcher-Support APDU exchange with the card. It has transaction
capabilities to receive the APDUs from applications on the consumer device
and return the responses to the corresponding application.
4. J2ME applications are oblivious of the logical channel information.
Getting the logical channel for communicating with the smart card
application is the responsibility of the APDUManager which sends
appropriate APDUs to the card to get the logical channels
assigned for a new connection or close channels when the connection is
closed.
|
Field Summary | |
static Slot[] | slots Contains references to all supported slots. |
Method Summary | |
public static void | checkSlotNumber(int slot) Verifies that slot number is correct. | public static void | closeConnection(Handle h) Closes the connection. | public static byte[] | exchangeAPDU(Handle h, byte[] apduData) This public method takes in the command APDU in the form of
a byte array and calls the native exchangeAPDU0 method
to send the APDU to the card. | public static byte[] | getATR(int slot) This method returns the ATR received from the card.
Parameters: slot - the slot number ATR information received from the card at startup orreset. | public static int | getSlotCount() Returns the number of slots.
the number of slots. | public static void | initACL(int slot) Initializes ACL for the slot (if needed). | public static boolean | isSatSlot(int slot) Checks if this slot is SAT slot. | public static Handle | openACLConnection(byte[] apdu, int slot) Opens a connection to a smart card for reading of ACL. | static Handle | openSATConnection(int slot) Creates SAT connection. | public static int | parseDottedBytes(String src, byte[] dest, int offset) Parses string that contains hexadecimal byte values separated by
dots. | public static Handle | selectApplication(byte[] selectAPDU, int slot) The public method which should be called when application
selection is required. |
slots | static Slot[] slots(Code) | | Contains references to all supported slots.
|
closeConnection | public static void closeConnection(Handle h) throws IOException(Code) | | Closes the connection.
Parameters: h - connection handle exception: IOException - if there are any IO problems |
exchangeAPDU | public static byte[] exchangeAPDU(Handle h, byte[] apduData) throws IOException(Code) | | This public method takes in the command APDU in the form of
a byte array and calls the native exchangeAPDU0 method
to send the APDU to the card. If there are no errors, this method
gets the response APDU data from the card and returns that.
Parameters: h - connection handle Parameters: apduData - APDU data in byte array form response APDU data in byte array form exception: IOException - if there are any IO problems |
getATR | public static byte[] getATR(int slot)(Code) | | This method returns the ATR received from the card.
Parameters: slot - the slot number ATR information received from the card at startup orreset. In case of I/O troubles returns null. |
getSlotCount | public static int getSlotCount()(Code) | | Returns the number of slots.
the number of slots. If error occured it returns 0. |
initACL | public static void initACL(int slot)(Code) | | Initializes ACL for the slot (if needed). This method is invoked
when an establishment of new connection is being performed.
Parameters: slot - The slot number |
isSatSlot | public static boolean isSatSlot(int slot) throws IOException(Code) | | Checks if this slot is SAT slot.
Parameters: slot - the slot number SAT check result throws: IOException - If an error occured. |
openACLConnection | public static Handle openACLConnection(byte[] apdu, int slot) throws IOException(Code) | | Opens a connection to a smart card for reading of ACL.
This method is called from reset
method, so it does not need synchronized
statement.
Parameters: apdu - The APDU that will be used for opening Parameters: slot - Slot number new connection handle exception: IOException - when a card is not present orconnection cannot be established with the card. |
openSATConnection | static Handle openSATConnection(int slot) throws IOException(Code) | | Creates SAT connection.
Parameters: slot - Slot number new connection handle exception: IOException - when SIM is not present orconnection cannot be established with the card. |
parseDottedBytes | public static int parseDottedBytes(String src, byte[] dest, int offset)(Code) | | Parses string that contains hexadecimal byte values separated by
dots. May throw runtime exceptions.
Parameters: src - source string Parameters: dest - destination array Parameters: offset - target offset number of bytes parsed |
selectApplication | public static Handle selectApplication(byte[] selectAPDU, int slot) throws IOException(Code) | | The public method which should be called when application
selection is required. Calls an internal method.
Parameters: selectAPDU - byte encoded selection APDU Parameters: slot - slot number new connection handle exception: IOException - when selection is not successful |
|
|
|