PCSC4Java  0.2
Library PCSC for Java language.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
fr.redbilled.pcscforjava.Card Class Reference
Collaboration diagram for fr.redbilled.pcscforjava.Card:

List of all members.

Public Member Functions

abstract ATR getATR ()
abstract String getProtocol ()
abstract CardChannel getBasicChannel ()
abstract CardChannel openLogicalChannel () throws CardException
abstract void beginExclusive () throws CardException
abstract void endExclusive () throws CardException
abstract byte[] transmitControlCommand (int controlCode, byte[] command) throws CardException
abstract void reconnect (int iShareMode, int iInitialization) throws CardException
abstract void disconnect (int iDisposition) throws CardException
abstract byte[] getAttrib (int iAttribute) throws CardException
abstract void setAttrib (int iAttribute, byte[] pBCommand) throws CardException
byte[] modifyPinDirect (byte[] abyModifyPin) throws CardException
byte[] verifyPinDirect (byte[] abyVerifyPin) throws CardException
abstract int getSharingMode ()

Protected Member Functions

 Card ()
boolean hasFeature (Byte feature) throws CardException
void queryFeatures () throws CardException

Protected Attributes

final int IOCTL_GET_FEATURE_REQUEST = SCARD_CTL_CODE(3400)
Map< Byte, Integer > m_features

Detailed Description

A Smart Card with which a connection has been established. Card objects are obtained by calling CardTerminal.connect().

See also:
CardTerminal
Since:
1.6
Author:
Andreas Sterbenz
JSR 268 Expert Group

Definition at line 42 of file Card.java.


Constructor & Destructor Documentation

Constructs a new Card object.

This constructor is called by subclasses only. Application should call the CardTerminal::connect CardTerminal.connect()} method to obtain a Card object.

Definition at line 52 of file Card.java.


Member Function Documentation

abstract void fr.redbilled.pcscforjava.Card.beginExclusive ( ) throws CardException [pure virtual]

Requests exclusive access to this card.

Once a thread has invoked beginExclusive, only this thread is allowed to communicate with this card until it calls endExclusive. Other threads attempting communication will receive a CardException.

Applications have to ensure that exclusive access is correctly released. This can be achieved by executing the beginExclusive() and endExclusive calls in a try ... finally block.

Exceptions:
SecurityExceptionif a SecurityManager exists and the caller does not have the required CardPermission permission}
CardExceptionif exclusive access has already been set or if exclusive access could not be established
IllegalStateExceptionif this card object has been disposed of via the disconnect disconnect()} method

Here is the caller graph for this function:

abstract void fr.redbilled.pcscforjava.Card.disconnect ( int  iDisposition) throws CardException [pure virtual]

Disconnects the connection with this card. After this method returns, calling methods on this object or in CardChannels associated with this object that require interaction with the card will raise an IllegalStateException.

Parameters:
iDispositionmust be #SCARD_LEAVE_CARD to leave the card in its current state or #SCARD_RESET_CARD to reset the card before the disconnection or #SCARD_UNPOWER_CARD to power off the card before the disconnection or #SCARD_EJECT_CARD to eject the card before the disconnection.
Exceptions:
CardExceptionif the card operation failed
IllegalArgumentExceptionif a parameter is incoherent with this function.
SecurityExceptionif a SecurityManager exists and the caller does not have the required CardPermission permission}

Here is the caller graph for this function:

abstract void fr.redbilled.pcscforjava.Card.endExclusive ( ) throws CardException [pure virtual]

Releases the exclusive access previously established using beginExclusive.

Exceptions:
SecurityExceptionif a SecurityManager exists and the caller does not have the required CardPermission permission}
IllegalStateExceptionif the active Thread does not currently have exclusive access to this card or if this card object has been disposed of via the disconnect disconnect()} method
CardExceptionif the operation failed

Here is the caller graph for this function:

abstract ATR fr.redbilled.pcscforjava.Card.getATR ( ) [pure virtual]

Returns the ATR of this card.

Returns:
the ATR of this card.

Here is the caller graph for this function:

abstract byte [] fr.redbilled.pcscforjava.Card.getAttrib ( int  iAttribute) throws CardException [pure virtual]

Gets an attribute of this card.

Parameters:
iAttributeis the identifier for the attribute to get and must be:

SCARD_ATTR_ATR_STRING

Answer to reset (ATR) string.

SCARD_ATTR_CHANNEL_ID

unsigned long encoded as 0xDDDDCCCC, where DDDD = data channel type and CCCC = channel number: The following encodings are defined for DDDD: 0x01 serial I/O; CCCC is a port number. 0x02 parallel I/O; CCCC is a port number. 0x04 PS/2 keyboard port; CCCC is zero. 0x08 SCSI; CCCC is SCSI ID number. 0x10 IDE; CCCC is device number. 0x20 USB; CCCC is device number. 0xFy vendor-defined interface with y in the range zero through 15; CCCC is vendor defined.

SCARD_ATTR_CHARACTERISTICS

unsigned long indicating which mechanical characteristics are supported. If zero, no special characteristics are supported. Note that multiple bits can be set: 0x00000001 Card swallowing mechanism 0x00000002 Card ejection mechanism 0x00000004 Card capture mechanism All other values are reserved for future use (RFU).

SCARD_ATTR_CURRENT_BWT

Current block waiting time.

SCARD_ATTR_CURRENT_CLK

Current clock rate, in kHz.

SCARD_ATTR_CURRENT_CWT

Current character waiting time.

SCARD_ATTR_CURRENT_D

Bit rate conversion factor.

SCARD_ATTR_CURRENT_EBC_ENCODING

Current error block control encoding. 0 = longitudinal redundancy check (LRC) 1 = cyclical redundancy check (CRC)

SCARD_ATTR_CURRENT_F

Clock conversion factor.

SCARD_ATTR_CURRENT_IFSC

Current byte size for information field size card.

SCARD_ATTR_CURRENT_IFSD

Current byte size for information field size device.

SCARD_ATTR_CURRENT_N

Current guard time.

SCARD_ATTR_CURRENT_PROTOCOL_TYPE

unsigned long encoded as 0x0rrrpppp where rrr is RFU and should be 0x000. pppp encodes the current protocol type. Whichever bit has been set indicates which ISO protocol is currently in use. (For example, if bit zero is set, T=0 protocol is in effect.)

SCARD_ATTR_CURRENT_W

Current work waiting time.

SCARD_ATTR_DEFAULT_CLK

Default clock rate, in kHz.

SCARD_ATTR_DEFAULT_DATA_RATE

Default data rate, in bps.

SCARD_ATTR_DEVICE_FRIENDLY_NAME

Reader's display name.

SCARD_ATTR_DEVICE_IN_USE

Reserved for future use.

SCARD_ATTR_DEVICE_SYSTEM_NAME

Reader's system name.

SCARD_ATTR_DEVICE_UNIT

Instance of this vendor's reader attached to the computer. The first instance will be device unit 0, the next will be unit 1 (if it is the same brand of reader) and so on. Two different brands of readers will both have zero for this value.

SCARD_ATTR_ICC_INTERFACE_STATUS

Single byte. Zero if smart card electrical contact is not active; nonzero if contact is active.

SCARD_ATTR_ICC_PRESENCE

Single byte indicating smart card presence: 0 = not present 1 = card present but not swallowed (applies only if reader supports smart card swallowing) 2 = card present (and swallowed if reader supports smart card swallowing) 4 = card confiscated.

SCARD_ATTR_ICC_TYPE_PER_ATR

Single byte indicating smart card type: 0 = unknown type 1 = 7816 Asynchronous 2 = 7816 Synchronous Other values RFU.

SCARD_ATTR_MAX_CLK

Maximum clock rate, in kHz.

SCARD_ATTR_MAX_DATA_RATE

Maximum data rate, in bps.

SCARD_ATTR_MAX_IFSD

Maximum bytes for information file size device.

SCARD_ATTR_POWER_MGMT_SUPPORT

Zero if device does not support power down while smart card is inserted. Nonzero otherwise.

SCARD_ATTR_PROTOCOL_TYPES

unsigned long encoded as 0x0rrrpppp where rrr is RFU and should be 0x000. pppp encodes the supported protocol types. A '1' in a given bit position indicates support for the associated ISO protocol, so if bits zero and one are set, both T=0 and T=1 protocols are supported.

SCARD_ATTR_VENDOR_IFD_SERIAL_NO

Vendor-supplied interface device serial number.

SCARD_ATTR_VENDOR_IFD_TYPE

Vendor-supplied interface device type (model designation of reader).

SCARD_ATTR_VENDOR_IFD_VERSION

Vendor-supplied interface device version (DWORD in the form 0xMMmmbbbb where MM = major version, mm = minor version, and bbbb = build number).

SCARD_ATTR_VENDOR_NAME

Vendor name.

Returns:
the attribute requested.
Exceptions:
CardExceptionif the card operation failed
IllegalArgumentExceptionif a parameter is incoherent with this function.
SecurityExceptionif a SecurityManager exists and the caller does not have the required CardPermission permission}

Returns the CardChannel for the basic logical channel. The basic logical channel has a channel number of 0.

Exceptions:
SecurityExceptionif a SecurityManager exists and the caller does not have the required CardPermission permission}
IllegalStateExceptionif this card object has been disposed of via the disconnect disconnect()} method

Here is the caller graph for this function:

abstract String fr.redbilled.pcscforjava.Card.getProtocol ( ) [pure virtual]

Returns the protocol in use for this card.

Returns:
the protocol in use for this card, for example "T=0" or "T=1"

Here is the caller graph for this function:

abstract int fr.redbilled.pcscforjava.Card.getSharingMode ( ) [pure virtual]
boolean fr.redbilled.pcscforjava.Card.hasFeature ( Byte  feature) throws CardException [protected]

Allows to know if a feature is supported by the terminal.

Parameters:
featurethe feature.
Returns:
true if supported.
Exceptions:
XiCardExceptionif a card oepration failed.

Definition at line 388 of file Card.java.

Here is the call graph for this function:

Here is the caller graph for this function:

byte [] fr.redbilled.pcscforjava.Card.modifyPinDirect ( byte[]  abyModifyPin) throws CardException

Transmits a modifyPinDirect to the terminal device using the transmitControlCommand} method.

Parameters:
abyModifyPinthe modify pin command.
Returns:
response to this command.
Exceptions:
XiCardExceptionif a card operation failed.

Definition at line 353 of file Card.java.

Here is the call graph for this function:

Opens a new logical channel to the card and returns it. The channel is opened by issuing a MANAGE CHANNEL command that should use the format [00 70 00 00 01].

Exceptions:
SecurityExceptionif a SecurityManager exists and the caller does not have the required CardPermission permission}
CardExceptionis a new logical channel could not be opened
IllegalStateExceptionif this card object has been disposed of via the disconnect disconnect()} method

Retrieves the available features and put it in a hashmap.

Exceptions:
XiCardExceptionif a card operation failed.

Definition at line 402 of file Card.java.

Here is the call graph for this function:

Here is the caller graph for this function:

abstract void fr.redbilled.pcscforjava.Card.reconnect ( int  iShareMode,
int  iInitialization 
) throws CardException [pure virtual]

Reestablish the connection with this card. After this method returns, the connection with the card has been reseted. The reestablishment can be of type WARM_RESET (i.e power on the card without power off it) or COLD_RESET (i.e power on the card after have perfoming a power off).

Parameters:
iShareModemust be #SCARD_SHARE_SHARED if the reader must be in share mode or #SCARD_SHARE_EXCLUSIVE if the reader must be in exclusive mode.
iInitializationmust be #SCARD_LEAVE_CARD to leave the card in its current state or #SCARD_RESET_CARD to perform a WARM_RESET to the card of #SCARD_UNPOWER_CARD to perform a COLD_RESET to the card.
Exceptions:
CardExceptionif the card operation failed
IllegalArgumentExceptionif a parameter is incoherent with this function.
IllegalStateExceptionif this card object has been disposed of via the disconnect disconnect()} method
SecurityExceptionif a SecurityManager exists and the caller does not have the required CardPermission permission}

Here is the caller graph for this function:

abstract void fr.redbilled.pcscforjava.Card.setAttrib ( int  iAttribute,
byte[]  pBCommand 
) throws CardException [pure virtual]

Sets an attribute of this card.

Parameters:
iAttributeis the identifier for the attribute to set and must be:

SCARD_ATTR_SUPRESS_T1_IFS_REQUEST

Suppress sending of T=1 IFSD packet from the reader to the card. (Can be used if the currently inserted card does not support an IFSD request.)

Parameters:
pBCommandthe new attribute for the identifier request.
Exceptions:
CardExceptionif the card operation failed
IllegalArgumentExceptionif a parameter is incoherent with this function.
SecurityExceptionif a SecurityManager exists and the caller does not have the required CardPermission permission}
abstract byte [] fr.redbilled.pcscforjava.Card.transmitControlCommand ( int  controlCode,
byte[]  command 
) throws CardException [pure virtual]

Transmits a control command to the terminal device.

This can be used to, for example, control terminal functions like a built-in PIN pad or biometrics.

Parameters:
controlCodethe control code of the command
commandthe command data
Exceptions:
SecurityExceptionif a SecurityManager exists and the caller does not have the required CardPermission permission}
NullPointerExceptionif command is null
CardExceptionif the card operation failed
IllegalStateExceptionif this card object has been disposed of via the disconnect disconnect()} method

Here is the caller graph for this function:

byte [] fr.redbilled.pcscforjava.Card.verifyPinDirect ( byte[]  abyVerifyPin) throws CardException

Transmits a verifyPinDirect to the terminal device using the transmitControlCommand} method.

Parameters:
abyVerifyPinthe verify pin command.
Returns:
response to this command.
Exceptions:
XiCardExceptionif a card operation failed.

Definition at line 371 of file Card.java.

Here is the call graph for this function:


Member Data Documentation

final int fr.redbilled.pcscforjava.Card.IOCTL_GET_FEATURE_REQUEST = SCARD_CTL_CODE(3400) [protected]

IOCTL for GET_FEATURE_REQUEST

Definition at line 339 of file Card.java.

Map<Byte, Integer> fr.redbilled.pcscforjava.Card.m_features [protected]

Hashmap containing the IOCTL keys and values.

Definition at line 344 of file Card.java.


The documentation for this class was generated from the following file: