24
Cryptographic Smart Card Driver Development Guide
Code sample: Enabling a CryptoToken object for RSA
operations using a private key
Example: MyRSACryptoToken.java
/**
* MyRSACryptoToken.java
* Copyright (C) 2001-2007 Research In Motion Limited. All rights reserved.
*/
package com.rim.samples.device.smartcard;
import net.rim.device.api.smartcard.*;
import net.rim.device.api.crypto.*;
import net.rim.device.api.crypto.keystore.*;
import net.rim.device.api.util.*;
import net.rim.device.api.crypto.certificate.x509.*;
import net.rim.device.api.crypto.certificate.*;
import net.rim.device.api.crypto.asn1.*;
import net.rim.device.api.compress.*;
import net.rim.device.api.i18n.*;
/**
* This class describes an implmentation of an RSA cryptographic token.
*
* The RIM Crypto API will use this object to perform a private key RSA operation.
* This object should delegate the operation to the smart card.
*/
final class MyRSACryptoToken extends RSACryptoToken implements Persistable
{
private static final String DECRYPT_DESC = “The private key will be used to decrypt
encrypted data.”;
private static final String SIGN_DESC = “The private key will be used to generate a
digital signature.”;
/**
* Constructs a new MyRSACryptoToken object.
*/
MyRSACryptoToken()
{
}
/**
* Determine if this token does the user authentication for the system.
*
* If not the KeyStore will prompt for the key store password when the user
* tries to access the private key.
*
* @return True if this token will prompt for the necessary
* user authentication when private key access is requested.
*/
public boolean providesUserAuthentication()
{
return true;
}
Summary of Contents for JAVA DEVELOPMENT ENVIRONMENT - - CRYPTOGRAPHIC SMART CARD DRIVER - DEVELOPMENT GUIDE
Page 4: ......
Page 6: ......
Page 14: ...10 Cryptographic Smart Card Driver Development Guide...
Page 17: ...13 2 Testing a cryptographic smart card driver...
Page 18: ...14 Cryptographic Smart Card Driver Development Guide...
Page 34: ...30 Cryptographic Smart Card Driver Development Guide...
Page 35: ......
Page 36: ...2007 Research In Motion Limited Published in Canada...