Troubleshooting guide
99
5: Using smart cards
private static final String LABEL = “RIM Sample”;
private static final String DISPLAY_SETTINGS = “Show driver properties/settings now”;
private static final String RSA = “RSA”;
/**
* Called on startup of the device. Register this driver with the smart card factory.
* When you do this, you are automatically registered with the user authenticator
* framework.
*/
public static void libMain( String args[] )
{
SmartCardFactory.addSmartCard( new MyCryptoSmartCard() );
}
/**
* Retrieve the session handler for this smart card.
* Implementations of this method should not bring up UI.
*/
protected SmartCardSession openSessionImpl( SmartCardReaderSession readerSession )
throws SmartCardException {
return new MyCryptoSmartCardSession( this, readerSession );
}
/**
* Determine if the file system should use this smart card object
* to communicate with a physical smart card.
* that has the given AnswerToReset.
* The system invokes this method to ascertain which smart card implementation it should
* use to communicate with a physical smart card found in a reader.
*/
protected boolean checkAnswerToResetImpl( AnswerToReset atr )
{
return _myATR.equals( atr );
}
/**
* Retrieve a label associated with this smart card.
* The string should not include the words “smart card”, as the file system uses this
* this method to generate strings such as “Please insert your smart card”.
*/
protected String getLabelImpl()
{
return LABEL;
}
/**
* Retrieves this smart card’s capabilities
*/
protected SmartCardCapabilities getCapabilitiesImpl()
{
return new SmartCardCapabilities( SmartCardCapabilities.PROTOCOL_T0 );
}