19
3: Code samples
/**
* Construct a new MyCryptoSmartCardSession object.
*
* @param smartCard Smart card associated with this session
* @param readerSession Reader session commands sent to this smart card.
*/
protected MyCryptoSmartCardSession( SmartCard smartCard, SmartCardReaderSession
readerSession )
{
super( smartCard, readerSession );
}
/**
* Close this cryptographic smart card session.
*
* Implementations should not close the underlying SmartCardReaderSession. Use this
* method for cleaning up the session prior to its closure.
*/
protected void closeImpl()
{
// Do any session cleanup needed here.
}
/**
* Retrieve the maximum number of allowed login attempts.
* The method returns Integer.MAX_VALUE if an infinite number of attempts are allowed.
*/
protected int getMaxLoginAttemptsImpl() throws SmartCardException
{
return 5;
}
/**
* Retrieve the remaining number of login attempts allowed (before the smart card will
* lock, or Integer.MAX_VALUE if the smart card will not lock.)
*/
protected int getRemainingLoginAttemptsImpl() throws SmartCardException
{
return 4;
}
/**
* Log into the smart card with the given password.
* This method should not bring up the UI.
*/
protected boolean loginImpl( String password ) throws SmartCardException
{
// Create a CommandAPDU which your smart card will understand
CommandAPDU command = new CommandAPDU( (byte)0x00, (byte)0x20, (byte)0x00,
(byte)0x00 );
command.setLcData( password.getBytes() );
ResponseAPDU response = new ResponseAPDU();
sendAPDU( command, response );
Содержание JAVA DEVELOPMENT ENVIRONMENT - - CRYPTOGRAPHIC SMART CARD DRIVER - DEVELOPMENT GUIDE
Страница 4: ......
Страница 6: ......
Страница 14: ...10 Cryptographic Smart Card Driver Development Guide...
Страница 17: ...13 2 Testing a cryptographic smart card driver...
Страница 18: ...14 Cryptographic Smart Card Driver Development Guide...
Страница 34: ...30 Cryptographic Smart Card Driver Development Guide...
Страница 35: ......
Страница 36: ...2007 Research In Motion Limited Published in Canada...