|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.crypto.RC2CryptoToken
public abstract class RC2CryptoToken
Implements the RC2 CryptoToken
interface.
Note: This class must be extended in order to override the default implementation.
Note: It is considered good practice to implement the equals and hashCode methods when extending this class. Otherwise, odd behaviour can occur.
Details on implementing for smart cards.
Constructor Summary | ||
---|---|---|
|
protected |
RC2CryptoToken()
Creates an RC2CryptoToken object. |
Method Summary | ||
---|---|---|
|
CryptoTokenSymmetricKeyData |
createKey(int bitLength,
int effectiveBitLength)
Creates a new key given the bit length and the effective bit length for the key. |
|
void |
decrypt(CryptoTokenCipherContext context,
byte[] ciphertext,
int ciphertextOffset,
byte[] plaintext,
int plaintextOffset)
Decrypts data given an array of plaintext and a context. |
|
void |
deleteKey(CryptoTokenSymmetricKeyData data)
Delete the specified key on the crypto token. |
|
void |
encrypt(CryptoTokenCipherContext context,
byte[] plaintext,
int plaintextOffset,
byte[] ciphertext,
int ciphertextOffset)
Encrypts data given an array of plaintext and a context. |
|
byte[] |
extractKeyData(CryptoTokenSymmetricKeyData data)
Extracts the key data from the crypto token and returns it in a byte array. |
|
int |
extractKeyDataLength(CryptoTokenSymmetricKeyData data)
Returns the key data length. |
|
int |
extractKeyEffectiveBitLength(CryptoTokenSymmetricKeyData data)
Returns the effective bit length of the key. |
|
String |
getAlgorithm()
Returns the algorithm supported by this token, ie "RC2". |
|
CryptoTokenCipherContext |
initializeDecrypt(CryptoTokenSymmetricKeyData data)
Initializes the crypto token for decryption. |
|
CryptoTokenCipherContext |
initializeEncrypt(CryptoTokenSymmetricKeyData data)
Initializes the crypto token for encryption. |
|
CryptoTokenSymmetricKeyData |
injectKey(byte[] key,
int offset,
int bitLength,
int effectiveBitLength)
Inserts the specified key onto the crypto token. |
|
boolean |
providesUserAuthentication()
Returns true if the token provides its own user authentication checks, eg a smartcard will prompt for a password before allowing access to the keys. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected RC2CryptoToken()
RC2CryptoToken
object.
This constructor is not used.
Method Detail |
---|
public final String getAlgorithm()
getAlgorithm
in interface CryptoToken
public boolean providesUserAuthentication()
providesUserAuthentication
in interface CryptoToken
public CryptoTokenCipherContext initializeEncrypt(CryptoTokenSymmetricKeyData data) throws CryptoTokenException, CryptoUnsupportedOperationException
data
- The symmetric key data associated with the crypto token.
CryptoTokenCipherContext
.
CryptoTokenException
- Thrown when an error occurs with a crypto
token or the crypto token is invalid.
CryptoUnsupportedOperationException
- Thrown when a call is made to
an unsupported operation.public void encrypt(CryptoTokenCipherContext context, byte[] plaintext, int plaintextOffset, byte[] ciphertext, int ciphertextOffset) throws CryptoTokenException
context
- The cipher context.plaintext
- A byte array containing the plaintext.plaintextOffset
- The offset, or initial position, of the plaintext data
within the array.ciphertext
- A byte array containing the ciphertext.ciphertextOffset
- The offset, or initial position, of the
ciphertext within the array.
CryptoTokenException
- Thrown if an error occurs with a crypto
token or the crypto token is invalid.public CryptoTokenCipherContext initializeDecrypt(CryptoTokenSymmetricKeyData data) throws CryptoTokenException, CryptoUnsupportedOperationException
data
- The symmetric key data associated with the crypto token.
CryptoTokenCipherContext
.
CryptoTokenException
- Thrown when an error occurs with a crypto
token or the crypto token is invalid.
CryptoUnsupportedOperationException
- Thrown when a call is made to
an unsupported operation.public void decrypt(CryptoTokenCipherContext context, byte[] ciphertext, int ciphertextOffset, byte[] plaintext, int plaintextOffset) throws CryptoTokenException
context
- The cipher context.ciphertext
- A byte array containing the ciphertext.ciphertextOffset
- The offset, or initial position, of the
ciphertext within the array.plaintext
- A byte array to contain the plaintext.plaintextOffset
- The offset, or initial position, of the plaintext data
within the array.
CryptoTokenException
- Thrown if an error occurs with a crypto
token or the crypto token is invalid.public int extractKeyDataLength(CryptoTokenSymmetricKeyData data) throws CryptoTokenException, CryptoUnsupportedOperationException
data
- The symmetric key data.
CryptoTokenException
- Thrown if an error occurs with the crypto
token or the crypto token is invalid.
CryptoUnsupportedOperationException
- Thrown if a call is made to
an unsupported operation.public byte[] extractKeyData(CryptoTokenSymmetricKeyData data) throws CryptoTokenException, CryptoUnsupportedOperationException
data
- The symmetric key data contained within the token.
CryptoTokenException
- Thrown if an error occurs with a crypto
token or the crypto token is invalid.
CryptoUnsupportedOperationException
- Thrown if a call is made to
an unsupported operation.public int extractKeyEffectiveBitLength(CryptoTokenSymmetricKeyData data) throws CryptoTokenException, CryptoUnsupportedOperationException
data
- The symmetric key data.
CryptoTokenException
- Thrown if an error occurs with the crypto
token or the crypto token is invalid.
CryptoUnsupportedOperationException
- Thrown if a call is made to
an unsupported operation.public CryptoTokenSymmetricKeyData createKey(int bitLength, int effectiveBitLength) throws CryptoTokenException, CryptoUnsupportedOperationException
bitLength
- The bit length of the key.effectiveBitLength
- The effective bit length of the key.
CryptoTokenException
- Thrown if an error occurs with the crypto
token or the crypto token is invalid.
CryptoUnsupportedOperationException
- Thrown if a call is made to
an unsupported operation.public CryptoTokenSymmetricKeyData injectKey(byte[] key, int offset, int bitLength, int effectiveBitLength) throws CryptoTokenException, CryptoUnsupportedOperationException
key
- A byte array containing the key data to be injected.offset
- The offset, or start position, of the key data within the
array.bitLength
- The bit length of the key.effectiveBitLength
- The effective bit length of the key.
CryptoTokenException
- Thrown if an error occurs with a crypto
token or the crypto token is invalid.
CryptoUnsupportedOperationException
- Thrown if a call is made to
an unsupported operation.public void deleteKey(CryptoTokenSymmetricKeyData data) throws CryptoTokenException, CryptoUnsupportedOperationException
data
- The symmetric key data contained within the token.
CryptoTokenException
- Thrown if an error occurs with a crypto
token or the crypto token is invalid.
CryptoUnsupportedOperationException
- Thrown if a call is made to
an unsupported operation.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal