|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.rim.device.api.crypto.AESCBCEncryptorEngine
public final class AESCBCEncryptorEngine
Creates an Advanced Encryption Standard (AES) encryption engine. AES is also known as Rijndael. For more information, visit the NIST web page. The implementation of AES used here is defined in FIPS 197.
The AES cipher has a variable key length of 128, 192 or 256 bits. The block length is also variable but defaults to 128 bits. The other valid block lengths are 192 and 256 bits.
This encryptor engine implements the CBC mode of operation as well.
AESCBCDecryptorEngine,
CBCDecryptorEngine,
AESDecryptorEngine,
AESKey| Field Summary | ||
|---|---|---|
|
static int |
BLOCK_LENGTH_DEFAULT
The default block length of an AES key. |
| Constructor Summary | ||
|---|---|---|
|
AESCBCEncryptorEngine(AESKey key,
int blockLength,
boolean useCPAProtection,
boolean useFIPSMode,
InitializationVector iv)
Creates an instance of the AESCBCEncryptorEngine class given
the AES key. |
|
|
AESCBCEncryptorEngine(AESKey key,
int blockLength,
boolean useCPAProtection,
InitializationVector iv)
Creates an instance of the AESCBCEncryptorEngine class given
the AES key. |
|
|
AESCBCEncryptorEngine(AESKey key,
int blockLength,
InitializationVector iv)
Creates an instance of the AESCBCEncryptorEngine class given
the AES key. |
|
|
AESCBCEncryptorEngine(AESKey key,
InitializationVector iv)
Creates an instance of the AESCBCEncryptorEngine class given
the AES key with a default block length of 16 bytes. |
|
| Method Summary | ||
|---|---|---|
|
void |
encrypt(byte[] plaintext,
int plaintextOffset,
byte[] ciphertext,
int ciphertextOffset)
Encrypts a block of the given plaintext into a block of ciphertext. |
|
void |
encrypt(byte[] plaintext,
int plaintextOffset,
byte[] ciphertext,
int ciphertextOffset,
int numBlocks)
Encrypts a series of blocks of the given plaintext into a series of blocks of ciphertext. |
|
String |
getAlgorithm()
Returns the name of the algorithm along with key and block lengths; for example, "AES_128_128/CBC" ( "AES_" + keyBitLength + "_" + blockBitLength + "/CBC"). |
|
int |
getBlockLength()
Returns the block length that the engine uses when encrypting data. |
|
InitializationVector |
getIV()
Returns the initialization vector associated with this encryptor engine. |
|
int |
getKeyLength()
Returns the length of the key in bytes. |
|
void |
setIV(InitializationVector iv)
Sets the initialization vector associated with this encryptor engine. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int BLOCK_LENGTH_DEFAULT
| Constructor Detail |
|---|
public AESCBCEncryptorEngine(AESKey key,
InitializationVector iv)
throws CryptoTokenException,
CryptoUnsupportedOperationException
AESCBCEncryptorEngine class given
the AES key with a default block length of 16 bytes.
key - The AESKey that will be used by the cipher to encrypt data.iv - An initialization vector used for seeding the engine.
CryptoTokenException - If a problem occurs with a crypto token or the crypto token is invalid.
CryptoUnsupportedOperationException - If a call is made to an unsupported operation.
public AESCBCEncryptorEngine(AESKey key,
int blockLength,
InitializationVector iv)
throws CryptoTokenException,
CryptoUnsupportedOperationException
AESCBCEncryptorEngine class given
the AES key.
key - The AESKey that will be used by the cipher to encrypt data.blockLength - The block length of the cipher in bytes. The valid lengths are 16, 24 and 32.iv - An initialization vector used for seeding the engine.
CryptoTokenException - If a problem occurs with a crypto token or the crypto token is invalid.
CryptoUnsupportedOperationException - If a call is made to an unsupported operation.
public AESCBCEncryptorEngine(AESKey key,
int blockLength,
boolean useCPAProtection,
InitializationVector iv)
throws CryptoTokenException,
CryptoUnsupportedOperationException
AESCBCEncryptorEngine class given
the AES key.
key - The AESKey that will be used by the cipher to encrypt data.blockLength - The block length of the cipher in bytes. The valid lengths are 16, 24 and 32.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.iv - An initialization vector used for seeding the engine.
CryptoTokenException - If a problem occurs with a crypto token or the crypto token is invalid.
CryptoUnsupportedOperationException - If a call is made to an unsupported operation.
public AESCBCEncryptorEngine(AESKey key,
int blockLength,
boolean useCPAProtection,
boolean useFIPSMode,
InitializationVector iv)
throws CryptoTokenException,
CryptoUnsupportedOperationException
AESCBCEncryptorEngine class given
the AES key.
key - The AESKey that will be used by the cipher to encrypt data.blockLength - The block length of the cipher in bytes. The valid lengths are 16, 24 and 32.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.useFIPSMode - If true, use a FIPS-validated version of AES implementation; otherwise, use the fastest version available on the device.iv - An initialization vector used for seeding the engine.
CryptoTokenException - If a problem occurs with a crypto token or the crypto token is invalid.
CryptoUnsupportedOperationException - If a call is made to an unsupported operation.| Method Detail |
|---|
public String getAlgorithm()
"AES_" + keyBitLength + "_" + blockBitLength + "/CBC").
getAlgorithm in interface BlockEncryptorEnginepublic void setIV(InitializationVector iv)
iv - An initialization vector used for seeding the engine.AESCBCEncryptorEngine.getIV()public InitializationVector getIV()
AESCBCEncryptorEngine.setIV(net.rim.device.api.crypto.InitializationVector)public int getKeyLength()
public int getBlockLength()
getBlockLength in interface BlockEncryptorEngine
public void encrypt(byte[] plaintext,
int plaintextOffset,
byte[] ciphertext,
int ciphertextOffset)
throws CryptoTokenException
BlockEncryptorEngine
encrypt in interface BlockEncryptorEngineplaintext - A byte array containing the input that is to be encrypted.plaintextOffset - The starting offset, or initial byte position, of
the data within the input array.ciphertext - A byte array to hold the ciphertext output from the method.ciphertextOffset - The starting offset, or initial byte position, of
the data within the output array.
CryptoTokenException - Thrown when an problem occurs with the
crypto token or the crypto token is invalid.
public void encrypt(byte[] plaintext,
int plaintextOffset,
byte[] ciphertext,
int ciphertextOffset,
int numBlocks)
throws CryptoTokenException
BlockEncryptorEngineExt
encrypt in interface BlockEncryptorEngineExtplaintext - A byte array containing the input that is to be encrypted.plaintextOffset - The starting offset, or initial byte position, of
the data within the input array.ciphertext - A byte array to hold the ciphertext output from the method.ciphertextOffset - The starting offset, or initial byte position, of
the data within the output array.numBlocks - The number of blocks to encrypt.
CryptoTokenException - Thrown when an problem occurs with the
crypto token or the crypto token is invalid.
|
|||||||||
| 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