|
1 <!-- |
|
2 Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. |
|
3 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 |
|
5 This code is free software; you can redistribute it and/or modify it |
|
6 under the terms of the GNU General Public License version 2 only, as |
|
7 published by the Free Software Foundation. Sun designates this |
|
8 particular file as subject to the "Classpath" exception as provided |
|
9 by Sun in the LICENSE file that accompanied this code. |
|
10 |
|
11 This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 version 2 for more details (a copy is included in the LICENSE file that |
|
15 accompanied this code). |
|
16 |
|
17 You should have received a copy of the GNU General Public License version |
|
18 2 along with this work; if not, write to the Free Software Foundation, |
|
19 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
|
21 Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
22 CA 95054 USA or visit www.sun.com if you need additional information or |
|
23 have any questions. |
|
24 --> |
|
25 |
|
26 <html> |
|
27 <body> |
|
28 <h2>Java™ Smart Card I/O API</h2> |
|
29 |
|
30 This specification describes the Java Smart Card I/O API defined by |
|
31 <a href="http://jcp.org/en/jsr/detail?id=268">JSR 268</a>. |
|
32 |
|
33 It defines a Java API for communication with Smart Cards |
|
34 using ISO/IEC 7816-4 APDUs. It thereby allows Java applications to interact with |
|
35 applications running on the Smart Card, to store and retrieve data |
|
36 on the card, etc. |
|
37 |
|
38 <p> |
|
39 The API is defined by classes in the package |
|
40 <code>javax.smartcardio</code>. They can be classified as follows: |
|
41 |
|
42 <dl> |
|
43 <dt>Classes describing the corresponding Smart Card structures |
|
44 <dd> |
|
45 <a href="ATR.html">ATR</a>, |
|
46 <a href="CommandAPDU.html">CommandAPDU</a>, |
|
47 <a href="ResponseAPDU.html">ResponseAPDU</a> |
|
48 |
|
49 <p> |
|
50 <dt>Factory to obtain implementations |
|
51 <dd> |
|
52 <a href="TerminalFactory.html">TerminalFactory</a> |
|
53 |
|
54 <p> |
|
55 <dt>Main classes for card and terminal functions |
|
56 <dd> |
|
57 <a href="CardTerminals.html">CardTerminals</a>, |
|
58 <a href="CardTerminal.html">CardTerminal</a>, |
|
59 <a href="Card.html">Card</a>, |
|
60 <a href="CardChannel.html">CardChannel</a> |
|
61 |
|
62 <p> |
|
63 <dt>Supporting permission and exception classes |
|
64 <dd> |
|
65 <a href="CardPermission.html">CardPermission</a>, |
|
66 <a href="CardException.html">CardException</a>, |
|
67 <a href="CardNotPresentException.html">CardNotPresentException</a> |
|
68 |
|
69 <p> |
|
70 <dt>Service provider interface, not accessed directly by applications |
|
71 <dd> |
|
72 <a href="TerminalFactorySpi.html">TerminalFactorySpi</a> |
|
73 |
|
74 </dl> |
|
75 |
|
76 |
|
77 <h3>API Example</h3> |
|
78 |
|
79 A simple example of using the API is: |
|
80 <pre> |
|
81 // show the list of available terminals |
|
82 TerminalFactory factory = TerminalFactory.getDefault(); |
|
83 List<CardTerminal> terminals = factory.terminals().list(); |
|
84 System.out.println("Terminals: " + terminals); |
|
85 // get the first terminal |
|
86 CardTerminal terminal = terminals.get(0); |
|
87 // establish a connection with the card |
|
88 Card card = terminal.connect("T=0"); |
|
89 System.out.println("card: " + card); |
|
90 CardChannel channel = card.getBasicChannel(); |
|
91 ResponseAPDU r = channel.transmit(new CommandAPDU(c1)); |
|
92 System.out.println("response: " + toString(r.getBytes())); |
|
93 // disconnect |
|
94 card.disconnect(false); |
|
95 </pre> |
|
96 |
|
97 <P> |
|
98 @since 1.6 |
|
99 @author Andreas Sterbenz |
|
100 @author JSR 268 Expert Group |
|
101 |
|
102 </body> |
|
103 </html> |