25
3: Code samples
/**
* Determine if this token supports the chosen operation using the provided system.
*
* @param cryptoSystem Crypto System to check against.
* @param operation Operation to check: either KEY_GENERATION,
* PUBLIC_KEY_OPERATION, PRIVATE_KEY_OPERATION,* or some other value
* specific to the crypto system that indicates the operation to check.
*/
public boolean isSupported( CryptoSystem cryptoSystem, int operation )
{
return ( operation == PRIVATE_KEY_OPERATION );
}
/**
* Determines if the given key and crypto system
* support RSA encryption.
*
* @return True if the token supports RSA encryption.
*
* @param cryptoSystem Crypto system to check.
* @param privateKeyData Private key data.
*
* @throws CryptoTokenException If an error occurs with a crypto
* token or the crypto token is invalid.
*/
public boolean isSupportedDecryptRSA( RSACryptoSystem cryptoSystem,
CryptoTokenPrivateKeyData privateKeyData )throws CryptoTokenException
{
return privateKeyData instanceof MyCryptoTokenData;
}
/**
* Perform RSA decryption of unprocessed data.
*
* <p>
* Notes: To reveal the plaintext bytes, the RSACryptoToken should perform a raw RSA
* private key operation on the input data.
* The plaintext bytes are typically padded with the type of padding dependent on the
* application that encrypted the data.
*
* Typically Public-Key Cryptography Standards (PKCS) #1 version 2.0 is used to pad the
data, however other schemes
* such as OAEP can also be used.
*
* If the RSACryptoToken removes the padding in the input data, this method must re-add
* the same type of padding before the method completes its operations.
*
* Data encrypted using the BlackBerry S/MIME implementation currently uses Public-Key
Cryptography Standards (PKCS) #1
* padding but may use other padding methods in the future.
* <p>
*
* @param cryptoSystem Crypto system associated with the token.
* @param privateKeyData RSA private key.
Содержание 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...