net.rim.device.api.crypto
Interface BlockFormatterEngine

All Known Implementing Classes:
OAEPFormatterEngine, PKCS1FormatterEngine, PKCS5FormatterEngine

public interface BlockFormatterEngine

The BlockFormatterEngine interface formats input by inserting padding into the data. This interface allows for block ciphers that use specific forms of padding.

The BlockUnformatterEngine removes specific padding from data.

Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

Method Summary
Category: Signed  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.
Category: Signed  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.
Category: Signed  String getAlgorithm()
          Returns the name of this algorithm, eg "PKCS5".
Category: Signed  int getInputBlockLength()
          Returns the length of an input block in bytes.
Category: Signed  int getOutputBlockLength()
          Returns the length of an output block in bytes.
 



Method Detail

formatAndEncrypt

int formatAndEncrypt(byte[] input,
                     int inputOffset,
                     int inputLength,
                     byte[] output,
                     int outputOffset,
                     boolean lastBlock)
                     throws MessageTooLongException,
                            CryptoTokenException
Formats the input into the proper format and then encrypts it.

Parameters:
input - 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.
Returns:
The actual number of bytes encrypted and inserted into the output array.
Throws:
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.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

formatAndEncrypt

int formatAndEncrypt(byte[] input,
                     int inputOffset,
                     int inputLength,
                     byte[] output,
                     int outputOffset)
                     throws MessageTooLongException,
                            CryptoTokenException
Formats the input into the proper format and then encrypts it, assuming this is not the last block to be encrypted.

Parameters:
input - 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.
Returns:
The actual number of bytes encrypted and placed into the output array.
Throws:
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.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getInputBlockLength

int getInputBlockLength()
Returns the length of an input block in bytes.

Returns:
An integer that represents the length of a block in bytes.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getOutputBlockLength

int getOutputBlockLength()
Returns the length of an output block in bytes.

Returns:
An integer that represents the output block length in bytes.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getAlgorithm

String getAlgorithm()
Returns the name of this algorithm, eg "PKCS5".

Returns:
A String representing the name of the algorithm.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0





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