net.rim.device.api.smartcard
Class SmartCard

java.lang.Object
  extended by net.rim.device.api.smartcard.SmartCard
All Implemented Interfaces:
Persistable
Direct Known Subclasses:
CryptoSmartCard

public abstract class SmartCard
extends Object
implements Persistable

Represents a kind (or model or family) of a physical smart card, as opposed to one unique smart card. As such, the SmartCard and SmartCardSession objects embody only the mechanisms or protocols to communicate with one kind of smart card. Therefore, there is only one SmartCard object instantiated on the device per kind of smart card.

To communicate with the smart card, the developer must call openSession(). Once a session has been opened, it is assumed that some card unique data (perhaps a serial number, see ) may be extracted to identify a particular smart card.

Note to implementators: Most, if not all, UI functionality has been implemented in the base class. Typically, subclasses should not need to implement any UI. Subclasses should implement Persistable, and must not contain any state information ( member variables ).

For information on implementing smart cards, see Adding smart card drivers to the SmartCard API. This tutorial describes the process of adding support for new smart cards and smart card drivers to the API.

Sub-classes must explicitly implement the Persistable interface if they are going to be registered as a smart card driver with the SmartCardFactory.

See Also:
SmartCardFactory, SmartCardSession, SmartCardID, Persistable
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0

Constructor Summary
Category: Signed protected SmartCard()
          Constructs a new SmartCard.
 
Method Summary
Category: Signed  boolean checkAnswerToReset(AnswerToReset atr)
          Returns true if this SmartCard implementation should be used to communicate with a physical smart card that has the given AnswerToReset.
Category: Signed protected abstract  boolean checkAnswerToResetImpl(AnswerToReset atr)
          Returns true if this SmartCard implementation should be used to communicate with a physical smart card that has the given AnswerToReset.
Category: Signed  void displaySettings(Object context)
          Allows the driver to display some settings or properties.
Category: Signed protected  void displaySettingsImpl(Object context)
          Allows the driver to display some settings or properties.
Category: Signed  boolean equals(Object obj)
          This method returns true if this smart card object is equal to the obj parameter.
Category: Signed  SmartCardCapabilities getCapabilities()
          Returns the SmartCardCapabilities of the smart card.
Category: Signed protected abstract  SmartCardCapabilities getCapabilitiesImpl()
          Returns the SmartCardCapabilities of the smart card.
Category: Signed  String getLabel()
          Returns a label associated with the kind of smart card.
Category: Signed protected abstract  String getLabelImpl()
          Returns a label associated with the kind of smart card.
Category: Signed  int hashCode()
          Returns a hash code value for the object.
Category: Signed  boolean isBuiltInReaderSupported()
          Returns whether or not this Smart Card expects to use any built-in Smart Card Readers.
Category: Signed protected  boolean isBuiltInReaderSupportedImpl()
          Returns whether or not this Smart Card expects to use any built-in Smart Card Readers.
Category: Signed  boolean isDisplaySettingsAvailable(Object context)
          Allows the driver to indicate if they support displaying settings.
Category: Signed protected  boolean isDisplaySettingsAvailableImpl(Object context)
          Allows the driver to indicate if they support displaying settings.
Category: Signed  boolean isFingerprintSupportAvailable()
          Determine if this smart card driver can extract fingerprints from the smart card.
Category: Signed protected  boolean isFingerprintSupportAvailableImpl()
          Determine if this smart card driver can extract fingerprints from the smart card.
Category: Signed  SmartCardSession openSession(SmartCardReaderSession readerSession)
          Returns a session through which an application may communicate with a physical SmartCard.
Category: Signed protected abstract  SmartCardSession openSessionImpl(SmartCardReaderSession readerSession)
          Returns the appropriate subclass of SmartCardSession.
Category: Signed  String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 



Constructor Detail

SmartCard

protected SmartCard()
Constructs a new SmartCard.

Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0


Method Detail

openSession

public final SmartCardSession openSession(SmartCardReaderSession readerSession)
                                   throws SmartCardException
Returns a session through which an application may communicate with a physical SmartCard. A SmartCardReaderSession may only have one SmartCardSession associated with it.

Note: sessions should be closed promptly when no longer needed.

Parameters:
readerSession - An open communication session with a reader. Must be non null.
Returns:
The newly opened communications session with the SmartCard.
Throws:
SmartCardException - Thrown if an error occurs while reading the smart card.
SmartCardSessionAlreadyOpenException - Thrown if the reader session already has an open smart card session associated with it.
SmartCardSessionClosedException - Thrown if the reader session is closed.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0

openSessionImpl

protected abstract SmartCardSession openSessionImpl(SmartCardReaderSession readerSession)
                                             throws SmartCardException
Returns the appropriate subclass of SmartCardSession.

Implementations of this method should not bring up UI.

Parameters:
readerSession - An open communication session with a reader. Will be non-null.
Returns:
The newly opened communications session with the SmartCard.
Throws:
SmartCardException - Thrown if an error occurs while reading the smart card.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0

getCapabilities

public final SmartCardCapabilities getCapabilities()
Returns the SmartCardCapabilities of the smart card.

Returns:
The capabilities of the smart card.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0

getCapabilitiesImpl

protected abstract SmartCardCapabilities getCapabilitiesImpl()
Returns the SmartCardCapabilities of the smart card.

Returns:
The capabilities of the smart card.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0

checkAnswerToReset

public final boolean checkAnswerToReset(AnswerToReset atr)
Returns true if this SmartCard implementation should be used to communicate with a physical smart card that has the given AnswerToReset. This function is called when the system is trying to ascertain which SmartCard implementation should be used to communicate with a physical SmartCard found in a reader.

For Advanced Security SD (ASSD) cards (smart cards embedded in media cards like microSD), the AnswerToReset cannot be retrieved. As such, the AnswerToReset passed into this method is created using information in the Card IDentification (CID) register of the smart card, as follows:

Parameters:
atr - The AnswerToReset of the smart card. Must be non-null.
Returns:
A boolean that determines if the smart card implementation should be used to communicate with the physical smart card.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0

checkAnswerToResetImpl

protected abstract boolean checkAnswerToResetImpl(AnswerToReset atr)
Returns true if this SmartCard implementation should be used to communicate with a physical smart card that has the given AnswerToReset. This function is called when the system is trying to ascertain which SmartCard implementation should be used to communicate with a physical SmartCard found in a reader.

Parameters:
atr - The AnswerToReset of the smart card. Will be non-null.
Returns:
A boolean that determines if the smart card implementation should be used to communicate with the physical smart card.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0

getLabel

public final String getLabel()
Returns a label associated with the kind of smart card.

The String should not include the words "smart card", as this method will be used to generate strings such as ( "Please insert your %s smart card", getLabel() )

Returns:
A String representing the label of the smart card.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0

getLabelImpl

protected abstract String getLabelImpl()
Returns a label associated with the kind of smart card.

The String should not include the words "smart card", as this method will be used to generate strings such as ( "Please insert your %s smart card", getLabel() )

Returns:
A String representing the label of the smart card.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0

displaySettings

public final void displaySettings(Object context)
Allows the driver to display some settings or properties. This method will be invoked from the smart card options screen when the user selects the driver and chooses to view the settings of that driver. This method could be called from the event thread. The driver should not block the event thread for long periods of time.

Parameters:
context - Reserved for future use.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0

displaySettingsImpl

protected void displaySettingsImpl(Object context)
Allows the driver to display some settings or properties. This method will be invoked from the smart card options screen when the user selects the driver and chooses to view the settings of that driver. This method could be called from the event thread. The driver should not block the event thread for long periods of time.

Parameters:
context - Reserved for future use.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0

isDisplaySettingsAvailable

public final boolean isDisplaySettingsAvailable(Object context)
Allows the driver to indicate if they support displaying settings. If this method returns true, then the method displaySettings maybe called to show settings to the user.

Parameters:
context - Reserved for future use.
Returns:
true if the driver supports displaying settings, false otherwise.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0

isDisplaySettingsAvailableImpl

protected boolean isDisplaySettingsAvailableImpl(Object context)
Allows the driver to indicate if they support displaying settings. If this method returns true, then the method displaySettings maybe called to show settings to the user.

Parameters:
context - Reserved for future use.
Returns:
true if the driver supports displaying settings, false otherwise.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0

isFingerprintSupportAvailable

public final boolean isFingerprintSupportAvailable()
Determine if this smart card driver can extract fingerprints from the smart card.

If this driver can extract fingerprints from the card, it can be used in the smart card fingerprint authenticator.

Returns:
True if this driver can extract fingerprints from the smart card; otherwise, false.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 5.0.0

isFingerprintSupportAvailableImpl

protected boolean isFingerprintSupportAvailableImpl()
Determine if this smart card driver can extract fingerprints from the smart card.

If your driver supports retrieval of fingerprints from the smart card, you should implement this method to return true. If you do so you should also implement the corresponding SmartCardSession#getFingerprintsImp.

Returns:
False by default; implementors should return true if their driver implementation can support this functionality.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 5.0.0

isBuiltInReaderSupported

public final boolean isBuiltInReaderSupported()
Returns whether or not this Smart Card expects to use any built-in Smart Card Readers. Currently only the Media Card Smart Card Reader falls into this category.

Returns:
True if this driver expects to read smart cards from built-in readers; otherwise, false.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 5.0.0

isBuiltInReaderSupportedImpl

protected boolean isBuiltInReaderSupportedImpl()
Returns whether or not this Smart Card expects to use any built-in Smart Card Readers. Currently only the Media Card Smart Card Reader falls into this category.

Returns:
False by default; implementors should return true if their driver implementation expects to read smart cards from built-in readers.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 5.0.0

toString

public String toString()
Description copied from class: Object
Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Overrides:
toString in class Object
Returns:
a string representation of the object.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0

equals

public boolean equals(Object obj)
This method returns true if this smart card object is equal to the obj parameter.

Overrides:
equals in class Object
Parameters:
obj - the reference object with which to compare.
Returns:
if this smart card object is equal to the Object parameter.
Throws:
NullPointerException - if obj is null.
See Also:
Boolean.hashCode(), Hashtable
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.2.0

hashCode

public int hashCode()
Description copied from class: Object
Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.

The general contract of hashCode is:

As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)

Overrides:
hashCode in class Object
Returns:
a hash code value for this object.
See Also:
Object.equals(java.lang.Object), Hashtable
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.2.0





Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.