Intel

Developer Zone

SequentialCipher


com.intel.crypto
Interface SequentialCipher

All Superinterfaces:
Cipher
All Known Implementing Classes:
SymmetricBlockCipherAlg

public interface SequentialCipher
extends Cipher

This interface is an extension to the basic cipher interface. This interface adds support for sequential operations where the data is processed in chunks by calling the interface several times (see the encryptUpdate and decryptUpdate methods).


Method Summary
short decryptComplete(byte[] input, short inputIndex, short inputLength, byte[] output, short outputIndex)
Decrypts the provided input data using the key currently stored by the instance.
short decryptUpdate(byte[] input, short inputIndex, short inputLength, byte[] output, short outputIndex)
Decrypts the provided input data, using the key currently stored by the instance, and maintains the instance state for the next operation.
short encryptComplete(byte[] input, short inputIndex, short inputLength, byte[] output, short outputIndex)
Encrypts the provided input data using the key currently stored by the instance.
short encryptUpdate(byte[] input, short inputIndex, short inputLength, byte[] output, short outputIndex)
Encrypts the provided input data, using the key currently stored by the instance, and maintains the instance state for the next operation.

Method Detail

encryptUpdate

short encryptUpdate(byte[] input,
                    short inputIndex,
                    short inputLength,
                    byte[] output,
                    short outputIndex)
                    throws CryptoException
Encrypts the provided input data, using the key currently stored by the instance, and maintains the instance state for the next operation. The encryptComplete method must be called to complete the encryption operations sequence and clear the internal state maintained by the instance.

Parameters:
input - the input data to encrypt
inputIndex - index in the input array
inputLength - input data length
output - an array to hold the output data (if any number of complete blocks was encrypted)
outputIndex - index in the output array
Returns:
The number of bytes returned in output array.
Throws:
NotInitializedException - if a required encryption parameter is not configured (for example, key for non-Platform Binding algorithms, IV for CTR ciphers, etc.)
CryptoException

decryptUpdate

short decryptUpdate(byte[] input,
                    short inputIndex,
                    short inputLength,
                    byte[] output,
                    short outputIndex)
                    throws CryptoException
Decrypts the provided input data, using the key currently stored by the instance, and maintains the instance state for the next operation. The decryptComplete method must be called to complete the decryption operations sequence and clear the internal state maintained by the instance.

Parameters:
input - the input data to decrypt
inputIndex - index in the input array
inputLength - input data length
output - an array to hold the decrypted data (if any number of complete blocks was decrypted)
outputIndex - index in the output array
Returns:
The number of bytes returned in output array.
Throws:
NotInitializedException - if a required decryption parameter is not configured (for example, key for non-Platform Binding algorithms, IV for CTR ciphers, etc.)
CryptoException

encryptComplete

short encryptComplete(byte[] input,
                      short inputIndex,
                      short inputLength,
                      byte[] output,
                      short outputIndex)
                      throws CryptoException
Encrypts the provided input data using the key currently stored by the instance.

Specified by:
encryptComplete in interface Cipher
Parameters:
input - the input data to encrypt
inputIndex - index in the input array
inputLength - input data length
output - an array to hold the output data
outputIndex - index in the output array
Returns:
The number of bytes returned in output array.
Throws:
IllegalUseException - if data was not provided via this method or the update methods, or when the input length is illegal (for example, the input is not the block size defined for block ciphers)
NotInitializedException - if a required encryption parameter is not configured (for example, the key to be used for encryption)
IllegalParameterException - when one or more of the input parameters are illegal
CryptoException - if an internal error occurred

decryptComplete

short decryptComplete(byte[] input,
                      short inputIndex,
                      short inputLength,
                      byte[] output,
                      short outputIndex)
                      throws CryptoException
Decrypts the provided input data using the key currently stored by the instance.

Specified by:
decryptComplete in interface Cipher
Parameters:
input - the input data to decrypt
inputIndex - index in the input array
inputLength - input data length
output - an array to hold the decrypted data
outputIndex - index in the output array
Returns:
The number of bytes returned in output array.
Throws:
IllegalUseException - if data was not provided via this method or the update methods, or when the input length is illegal (for example, the input is not the block size defined for block ciphers)
NotInitializedException - if a required decryption parameter is not configured (for example, the key to be used for decryption)
IllegalParameterException - when one or more of the input parameters are illegal
CryptoException - if an internal error occurred