1 <!-- 2 Copyright (c) 2005, 2006, Oracle and/or its affiliates. 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. Oracle designates this 8 particular file as subject to the "Classpath" exception as provided 9 by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 or visit www.oracle.com if you need additional information or have any 23 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 <dt>Factory to obtain implementations 50 <dd> 51 <a href="TerminalFactory.html">TerminalFactory</a> 52 53 <dt>Main classes for card and terminal functions 54 <dd> 55 <a href="CardTerminals.html">CardTerminals</a>, 56 <a href="CardTerminal.html">CardTerminal</a>, 57 <a href="Card.html">Card</a>, 58 <a href="CardChannel.html">CardChannel</a> 59 60 <dt>Supporting permission and exception classes 61 <dd> 62 <a href="CardPermission.html">CardPermission</a>, 63 <a href="CardException.html">CardException</a>, 64 <a href="CardNotPresentException.html">CardNotPresentException</a> 65 66 <dt>Service provider interface, not accessed directly by applications 67 <dd> 68 <a href="TerminalFactorySpi.html">TerminalFactorySpi</a> 69 70 </dl> 71 72 73 <h3>API Example</h3> 74 75 A simple example of using the API is: 76 <pre> 77 // show the list of available terminals 78 TerminalFactory factory = TerminalFactory.getDefault(); 79 List<CardTerminal> terminals = factory.terminals().list(); 80 System.out.println("Terminals: " + terminals); 81 // get the first terminal 82 CardTerminal terminal = terminals.get(0); 83 // establish a connection with the card 84 Card card = terminal.connect("T=0"); 85 System.out.println("card: " + card); 86 CardChannel channel = card.getBasicChannel(); 87 ResponseAPDU r = channel.transmit(new CommandAPDU(c1)); 88 System.out.println("response: " + toString(r.getBytes())); 89 // disconnect 90 card.disconnect(false); 91 </pre> 92 93 @since 1.6 94 @author Andreas Sterbenz 95 @author JSR 268 Expert Group 96 97 </body> 98 </html>