com.cryptware.jscapi
Class SmartCard

java.lang.Object
  extended by com.cryptware.jscapi.SmartCard

public class SmartCard
extends java.lang.Object

Implements a Smart Card interface

Author:
Ugo Chirico

Field Summary
static java.lang.String PROTOCOL_DEFAULT
          Use the default transmission parameters / card clock freq.
static java.lang.String PROTOCOL_RAW
          Raw Protocol
static java.lang.String PROTOCOL_T0
          T=0 Protocol
static java.lang.String PROTOCOL_T1
          T=1 Protocol
static java.lang.String PROTOCOL_Tx
          This is the mask of ISO defined transmission protocols (T=0, T=1)
 
Method Summary
 void disconnect(boolean reset)
          Disconnects from this smart card
 byte[] getATR()
          Gets the ATR of this smart card
 java.lang.String getProtocol()
          Gets the protocol of this smart card
 Reader getReader()
          Get the reader that contains this smart card /**
 boolean isPresent()
          Check if the smart card is still present in the reader
 ResponseAPDU send(CommandAPDU apdu)
          Sends a command APDU to the smart card
 byte[] sendControl(int controlCode, byte[] data)
          Sends a control command to the smart card
 boolean WaitForSmartCardRemoved()
          Stops execution and waits for smart card removal
 boolean WaitForSmartCardRemoved(int timeout)
          Stops execution and waits for smart card removal in the given timeout
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROTOCOL_T0

public static final java.lang.String PROTOCOL_T0
T=0 Protocol

See Also:
Constant Field Values

PROTOCOL_T1

public static final java.lang.String PROTOCOL_T1
T=1 Protocol

See Also:
Constant Field Values

PROTOCOL_RAW

public static final java.lang.String PROTOCOL_RAW
Raw Protocol

See Also:
Constant Field Values

PROTOCOL_Tx

public static final java.lang.String PROTOCOL_Tx
This is the mask of ISO defined transmission protocols (T=0, T=1)

See Also:
Constant Field Values

PROTOCOL_DEFAULT

public static final java.lang.String PROTOCOL_DEFAULT
Use the default transmission parameters / card clock freq.

See Also:
Constant Field Values
Method Detail

getATR

public byte[] getATR()
Gets the ATR of this smart card

Returns:
the ATR

getProtocol

public java.lang.String getProtocol()
Gets the protocol of this smart card

Returns:
the protocol

getReader

public Reader getReader()
Get the reader that contains this smart card /**

Returns:
the reader that contains this smart card

isPresent

public boolean isPresent()
Check if the smart card is still present in the reader

Returns:
true if the smart card is present, false otherwise

disconnect

public void disconnect(boolean reset)
Disconnects from this smart card

Parameters:
reset - specifies if the smart card must be reset

WaitForSmartCardRemoved

public boolean WaitForSmartCardRemoved()
Stops execution and waits for smart card removal

Returns:
true if the smart card has been removed in the given interval

WaitForSmartCardRemoved

public boolean WaitForSmartCardRemoved(int timeout)
Stops execution and waits for smart card removal in the given timeout

Parameters:
timeout -
Returns:
true if the smart card has been removed in the given interval

sendControl

public byte[] sendControl(int controlCode,
                          byte[] data)
Sends a control command to the smart card

Parameters:
controlCode - The control code
data - The data to send
Returns:
the result from the smart card

send

public ResponseAPDU send(CommandAPDU apdu)
Sends a command APDU to the smart card

Parameters:
apdu - the command APDU to send
Returns:
the response APDU from the smart card