Code Sample: Enabling A Cryptotoken Object For Rsa Operations Using A Private Key - Blackberry JAVA DEVELOPMENT ENVIRONMENT - - CRYPTOGRAPHIC SMART CARD DRIVER - DEVELOPMENT GUIDE Manual

Cryptographic smart card driver
Table of Contents

Advertisement

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;
}
24

Advertisement

Table of Contents
loading

This manual is also suitable for:

Java development environment 4.6.0

Table of Contents