|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.rim.device.api.crypto.PKCS5FormatterEngine
public final class PKCS5FormatterEngine
Provides the PKCS5 encoding functionality on a block by block basis. The block length is the block length of the encryptor engine used.
We implemented the PKCS5 formatting as per PKCS #5 version 2.0 ( March 1999 ).
For a code sample using the PKCS5 formatter engine, click here.
For information on cryptographic algorithms, see Crypto Algorithms.
PKCS5UnformatterEngine| Constructor Summary | ||
|---|---|---|
|
PKCS5FormatterEngine(BlockEncryptorEngine encryptorEngine)
Creates a PKCS5FormatterEngine using a given
BlockEncryptorEngine object
for encrypting the plaintext. |
|
| Method Summary | ||
|---|---|---|
|
int |
formatAndEncrypt(byte[] input,
int inputOffset,
int inputLength,
byte[] output,
int outputOffset)
Formats the input into the proper format and then encrypts it, assuming this is not the last block to be encrypted. |
|
int |
formatAndEncrypt(byte[] input,
int inputOffset,
int inputLength,
byte[] output,
int outputOffset,
boolean lastBlock)
Formats the input into the proper format and then encrypts it. |
|
String |
getAlgorithm()
Returns the name of the algorithm used, ie BlockEncryptorEngine.getAlgorithm() + "/PKCS5". |
|
int |
getInputBlockLength()
Returns the length of an input block in bytes. |
|
int |
getOutputBlockLength()
Returns the length of an output block in bytes. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PKCS5FormatterEngine(BlockEncryptorEngine encryptorEngine)
PKCS5FormatterEngine using a given
BlockEncryptorEngine object
for encrypting the plaintext.
encryptorEngine - The engine used to encrypt the padded
plaintext.| Method Detail |
|---|
public String getAlgorithm()
BlockEncryptorEngine.getAlgorithm() + "/PKCS5".
getAlgorithm in interface BlockFormatterEnginepublic int getInputBlockLength()
BlockFormatterEngine
getInputBlockLength in interface BlockFormatterEnginepublic int getOutputBlockLength()
BlockFormatterEngine
getOutputBlockLength in interface BlockFormatterEngine
public int formatAndEncrypt(byte[] input,
int inputOffset,
int inputLength,
byte[] output,
int outputOffset,
boolean lastBlock)
throws MessageTooLongException,
CryptoTokenException
BlockFormatterEngine
formatAndEncrypt in interface BlockFormatterEngineinput - A byte array containing the data to be encrypted.inputOffset - The offset, or initial bit position, of the data within the byte array.inputLength - The amount of data to encrypt.output - A byte array to hold the encoded and encrypted data.outputOffset - The offset, or initial bit position, of the data within the byte array.lastBlock - A boolean that indicates the last block
to be encrypted.
MessageTooLongException - Thrown if the input is too long to be encoded
with the given encoding scheme.
CryptoTokenException - Thrown when a problem occurs with a crypto token or the crypto token is invalid.
public int formatAndEncrypt(byte[] input,
int inputOffset,
int inputLength,
byte[] output,
int outputOffset)
throws MessageTooLongException,
CryptoTokenException
BlockFormatterEngine
formatAndEncrypt in interface BlockFormatterEngineinput - A byte array containing the data to be encrypted.inputOffset - The offset, or initial bit position, of the data within the byte array.inputLength - The amount of data to encrypt.output - A byte array to hold the encoded and encrypted data.outputOffset - The offset, or initial bit position, of the data within the byte array.
MessageTooLongException - Thrown if the input is too long to be encoded
with the given encoding scheme.
CryptoTokenException - Thrown when a problem occurs with a 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-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.