Blackberry Java Development Environment 4.6.0 Podręcznik - Strona 20
Przeglądaj online lub pobierz pdf Podręcznik dla Oprogramowanie Blackberry Java Development Environment 4.6.0. Blackberry Java Development Environment 4.6.0 36 stron. Cryptographic smart card driver
Cryptographic Smart Card Driver Development Guide
* authentication for unlocking a BlackBerry device.
* In the BlackBerry Integrated Development Environment, in the settings for the smart
* card driver project, make sure the project type is set to Library.
* Make sure to select the auto-run on startup setting.
*/
public static void libMain( String args[] )
{
try{
SmartCardFactory.addSmartCard( new MyCryptoSmartCard() );}
catch(ControlledAccessException cae)
{
// Application control may not allow your driver to be used with the user authenticator
// framework, in which case it will throw a ControlledAccessException.
// Your driver was registered with the smart card API framework and can still
// be used for importing certificates and signing/decrypting messages.
}
}
/**
* 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 BlackBerry Smart Card Reader.
*/
protected boolean checkAnswerToResetImpl( AnswerToReset atr )
{
// If this method returns false, the cryptographic smart card driver will not be used to
// perform additional operations on a particular smart card.
// This method should only return true if you support the particular ATR. If this method
// returns true when there is no support for the smart card that corresponds to the ATR,
// this may prevent other cryptographic smart card drivers from functioning correctly.
// The AnswerToReset parameter contains the full ATR from the smart card.
// Your implementation of this method may check the entire ATR or just parts of
// the ATR, as long as the cryptographic smart card driver supports the
corresponding smart card.
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;
}
16