/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import javax.smartcardio.*;
/**
* Card implementation.
*
* @since 1.6
* @author Andreas Sterbenz
*/
// the terminal that created this card
// the native SCARDHANDLE
final long cardId;
// atr of this card
// protocol in use, one of SCARD_PROTOCOL_T0 and SCARD_PROTOCOL_T1
final int protocol;
// the basic logical channel (channel 0)
// state of this card connection
// thread holding exclusive access to the card, or null
int sharingMode = SCARD_SHARE_SHARED;
int connectProtocol;
// testing
connectProtocol = 0;
} else {
}
byte[] status = new byte[2];
}
void checkState() {
if (s == State.DISCONNECTED) {
throw new IllegalStateException("Card has been disconnected");
throw new IllegalStateException("Card has been removed");
}
}
boolean isValid() {
return false;
}
// ping card via SCardStatus
try {
return true;
} catch (PCSCException e) {
return false;
}
}
}
}
if (e.code == SCARD_W_REMOVED_CARD) {
}
}
return atr;
}
switch (protocol) {
case SCARD_PROTOCOL_T0:
return "T=0";
case SCARD_PROTOCOL_T1:
return "T=1";
default:
// should never occur
return "Unknown protocol " + protocol;
}
}
checkSecurity("getBasicChannel");
checkState();
return basicChannel;
}
private static int getSW(byte[] b) {
if (b.length < 2) {
return -1;
}
}
checkSecurity("openLogicalChannel");
checkState();
try {
byte[] response = SCardTransmit
throw new CardException
("openLogicalChannel() failed, card response: "
}
} catch (PCSCException e) {
handleError(e);
throw new CardException("openLogicalChannel() failed", e);
}
}
Thread t = exclusiveThread;
if (t == null) {
return;
}
if (t != Thread.currentThread()) {
throw new CardException("Exclusive access established by another Thread");
}
}
checkSecurity("exclusive");
checkState();
if (exclusiveThread != null) {
throw new CardException
("Exclusive access has already been assigned to Thread "
+ exclusiveThread.getName());
}
try {
} catch (PCSCException e) {
handleError(e);
throw new CardException("beginExclusive() failed", e);
}
}
checkState();
throw new IllegalStateException
("Exclusive access not assigned to current Thread");
}
try {
} catch (PCSCException e) {
handleError(e);
throw new CardException("endExclusive() failed", e);
} finally {
}
}
throws CardException {
checkSecurity("transmitControl");
checkState();
throw new NullPointerException();
}
try {
return r;
} catch (PCSCException e) {
handleError(e);
throw new CardException("transmitControlCommand() failed", e);
}
}
if (reset) {
checkSecurity("reset");
}
return;
}
try {
} catch (PCSCException e) {
throw new CardException("disconnect() failed", e);
} finally {
}
}
}
try {
}
} finally {
super.finalize();
}
}
}