|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.rim.device.api.crypto.AESCryptoToken
public abstract class AESCryptoToken
Represents an Advanced Encryption System (AES) crypto token. For more information visit the NIST web page.
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.
(@link AESKey More information on the AES key.)
Details on implementing for smart cards.
| Constructor Summary | ||
|---|---|---|
|
protected |
AESCryptoToken()
Creates a new AESCryptoToken object. |
| Method Summary | ||
|---|---|---|
|
CryptoTokenSymmetricKeyData |
createKey(int bitLength)
Create a key for the crypto token. |
|
void |
decrypt(CryptoTokenCipherContext context,
byte[] ciphertext,
int ciphertextOffset,
byte[] plaintext,
int plaintextOffset)
Decrypts an array of ciphertext using the crypto token. |
|
void |
decryptCBC(CryptoTokenCipherContext context,
byte[] ciphertext,
int ciphertextOffset,
byte[] plaintext,
int plaintextOffset,
int numBlocks,
byte[] iv)
Decrypts an array of ciphertext using the crypto token applying CBC mode to the blocks. |
|
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 an array of plaintext using the crypto token. |
|
void |
encryptCBC(CryptoTokenCipherContext context,
byte[] plaintext,
int plaintextOffset,
byte[] ciphertext,
int ciphertextOffset,
int numBlocks,
byte[] iv)
Encrypts an array of plaintext using the crypto token applying CBC mode to the blocks. |
|
byte[] |
extractKeyData(CryptoTokenSymmetricKeyData data)
Returns the key data contained in the crypto token. |
|
int |
extractKeyDataLength(CryptoTokenSymmetricKeyData data)
Returns the key data length. |
|
String |
getAlgorithm()
Returns the algorithm supported by this token, ie "AES". |
|
CryptoTokenCipherContext |
initializeDecrypt(CryptoTokenSymmetricKeyData data,
int blockLength)
Initializes the token for decryption. |
|
CryptoTokenCipherContext |
initializeDecrypt(CryptoTokenSymmetricKeyData data,
int blockLength,
boolean useCPAProtection)
Initializes the token for decryption. |
|
CryptoTokenCipherContext |
initializeEncrypt(CryptoTokenSymmetricKeyData data,
int blockLength)
Initializes the token for encryption. |
|
CryptoTokenCipherContext |
initializeEncrypt(CryptoTokenSymmetricKeyData data,
int blockLength,
boolean useCPAProtection)
Initializes the token for encryption. |
|
CryptoTokenSymmetricKeyData |
injectKey(byte[] key,
int offset,
int bitLength)
Inserts the key onto the crypto token. |
|
boolean |
providesUserAuthentication()
Indicates whether the token provides its own user authentication checks. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected AESCryptoToken()
AESCryptoToken object.
This constructor is not used.
| Method Detail |
|---|
public final String getAlgorithm()
getAlgorithm in interface CryptoTokenpublic boolean providesUserAuthentication()
true if the token provides its own user authentication checks;
for example, a smartcard will prompt for a password before allowing access to the keys.
This default implementation returns false.
providesUserAuthentication in interface CryptoToken
public CryptoTokenCipherContext initializeEncrypt(CryptoTokenSymmetricKeyData data,
int blockLength)
throws CryptoTokenException,
CryptoUnsupportedOperationException
data - The symmetric key data contained on the crypto token.blockLength - The block length of the encryption cipher.
CryptoTokenException - If an error occurs with a crypto
token or the crypto token is invalid.
CryptoUnsupportedOperationException - If a call is made to
an unsupported operation.
public CryptoTokenCipherContext initializeEncrypt(CryptoTokenSymmetricKeyData data,
int blockLength,
boolean useCPAProtection)
throws CryptoTokenException,
CryptoUnsupportedOperationException
data - The symmetric key data contained on the crypto token.blockLength - The block length of the encryption cipher.useCPAProtection - If true, enable cryptographic power analysis(CPA) protection
and use a strong but slow AES implementation; otherwise, use the fastest version available on the device.
CryptoTokenException - If an error occurs with a crypto
token or the crypto token is invalid.
CryptoUnsupportedOperationException - If 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 crypto token context.plaintext - An array containing the plaintext to be encrypted.plaintextOffset - The offset, or start position, of the plaintext
data within the array.ciphertext - An array to contain the ciphertext.ciphertextOffset - The offset, or starting bit, of the new cipher text
data within the array.
CryptoTokenException - Thrown if an error occurs with the crypto
token or the crypto token is invalid.
public void encryptCBC(CryptoTokenCipherContext context,
byte[] plaintext,
int plaintextOffset,
byte[] ciphertext,
int ciphertextOffset,
int numBlocks,
byte[] iv)
throws CryptoTokenException,
CryptoUnsupportedOperationException
context - The crypto token context.plaintext - An array containing the plaintext to be encrypted.plaintextOffset - The offset, or start position, of the plaintext
data within the array.ciphertext - An array to contain the ciphertext.ciphertextOffset - The offset, or starting bit, of the new cipher text
data within the array.numBlocks - The number of blocks to encrypt.iv - The initialization vector.
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 CryptoTokenCipherContext initializeDecrypt(CryptoTokenSymmetricKeyData data,
int blockLength)
throws CryptoTokenException,
CryptoUnsupportedOperationException
data - The symmetric key data contained on the crypto token.blockLength - The block length of the decryption cipher.
CryptoTokenException - If an error occurs with a crypto
token or the crypto token is invalid.
CryptoUnsupportedOperationException - If a call is made to
an unsupported operation.
public CryptoTokenCipherContext initializeDecrypt(CryptoTokenSymmetricKeyData data,
int blockLength,
boolean useCPAProtection)
throws CryptoTokenException,
CryptoUnsupportedOperationException
data - The symmetric key data contained on the crypto token.blockLength - The block length of the decryption cipher.useCPAProtection - If true, enable cryptographic power analysis(CPA)
protection and use a strong but slow AES implementation; otherwise, use the fastest version available on the device.
CryptoTokenException - If an error occurs with a crypto
token or the crypto token is invalid.
CryptoUnsupportedOperationException - If 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 crypto token context.ciphertext - An array containing the ciphertext to decrypt.ciphertextOffset - The offset, or starting bit, of the ciphertext
data within the array.plaintext - An array to contain the plaintext.plaintextOffset - The offset, or start position, of the plaintext
data within the array.
CryptoTokenException - If an error occurs with the crypto
token or the crypto token is invalid.
public void decryptCBC(CryptoTokenCipherContext context,
byte[] ciphertext,
int ciphertextOffset,
byte[] plaintext,
int plaintextOffset,
int numBlocks,
byte[] iv)
throws CryptoTokenException,
CryptoUnsupportedOperationException
context - The crypto token context.ciphertext - An array containing the ciphertext to decrypt.ciphertextOffset - The offset, or starting bit, of the ciphertext
data within the array.plaintext - An array to contain the plaintext.plaintextOffset - The offset, or start position, of the plaintext
data within the array.numBlocks - The number of blocks to decrypt.iv - The initialization vector.
CryptoTokenException - If an error occurs with the crypto
token or the crypto token is invalid.
CryptoUnsupportedOperationException - If a call is made to
an unsupported operation.
public int extractKeyDataLength(CryptoTokenSymmetricKeyData data)
throws CryptoTokenException,
CryptoUnsupportedOperationException
data - The symmetric key data.
CryptoTokenException - If an error occurs with a crypto
token or the crypto token is invalid.
CryptoUnsupportedOperationException - If a call is made to
an unsupported operation.
public byte[] extractKeyData(CryptoTokenSymmetricKeyData data)
throws CryptoTokenException,
CryptoUnsupportedOperationException
data - The symmetric data contained on the crypto token.
CryptoTokenException - If an error occurs with a crypto
token or the crypto token is invalid.
CryptoUnsupportedOperationException - If a call is made to
an unsupported operation.
public CryptoTokenSymmetricKeyData createKey(int bitLength)
throws CryptoTokenException,
CryptoUnsupportedOperationException
bitLength - An integer representing the length of the key in bits.
CryptoTokenException - If an error occurs with a crypto
token or the crypto token is invalid.
CryptoUnsupportedOperationException - If a call is made to
an unsupported operation.
public CryptoTokenSymmetricKeyData injectKey(byte[] key,
int offset,
int bitLength)
throws CryptoTokenException,
CryptoUnsupportedOperationException
key - A byte array containing the key.offset - The offset, or start position, of the key data within the
array.bitLength - The length of the key in bits.
CryptoTokenException - If an error occurs with a crypto
token or the crypto token is invalid.
CryptoUnsupportedOperationException - 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 - If an error occurs with a crypto
token or the crypto token is invalid.
CryptoUnsupportedOperationException - 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