com.intel.crypto
Interface StreamCipher
-
- All Known Implementing Classes:
- SslSession
public interface StreamCipher
This interface represents a stream encryption algorithm. Encryption data is passed as a stream of data, until processing is complete. Output data is buffered until read completely. The entire input and output sizes are not always known in advance, thus the caller doesn't need to allocate the entire length of the input or output, and can provide partial input or read partial output. The state should be handled internally by the cipher.
-
-
Method Summary
Methods Modifier and Type Method and Description short
decrypt(byte[] input, short inputIndex, short inputLength, byte[] output, short outputIndex, short outputLength)
Decrypts the provided input data using the key currently stored by the instance.short
encrypt(byte[] input, short inputIndex, short inputLength, byte[] output, short outputIndex, short outputLength)
Encrypts the provided input data using the key currently stored by the instance.short
getMaxBufferLength()
boolean
hasMoreOutput()
Returns whether the last operation has additional output buffered IMPORTANT: while the return value is true no further input can be provided to the cipher
-
-
-
Method Detail
-
encrypt
short encrypt(byte[] input, short inputIndex, short inputLength, byte[] output, short outputIndex, short outputLength) throws CryptoException
Encrypts the provided input data using the key currently stored by the instance.- Parameters:
input
- the input data to encrypt. Can't be null if inputLength > 0 and inputLength can't exceedgetMaxBufferLength()
bytesinputIndex
- index in the input arrayinputLength
- input data length - must be zero ifhasMoreOutput()
returns trueoutput
- an array to hold the output dataoutputIndex
- index in the output arrayoutputLength
- output data length- Returns:
- The number of bytes returned in output array
- Throws:
IllegalParameterException
- when one or more of the parameters is illegalNotInitializedException
- if a required encryption parameter is not configured (for example, the key to be used for encryption)IllegalUseException
- if providing input when the state doesn't allow ithasMoreOutput()
returns trueCryptoException
- if an internal error occurred
-
decrypt
short decrypt(byte[] input, short inputIndex, short inputLength, byte[] output, short outputIndex, short outputLength) throws CryptoException
Decrypts the provided input data using the key currently stored by the instance.- Parameters:
input
- the input data to decrypt. Can't be null if inputLength > 0 and inputLength can't exceedgetMaxBufferLength()
bytesinputIndex
- index in the input arrayinputLength
- input data length - must be zero ifhasMoreOutput()
returns trueoutput
- an array to hold the output dataoutputIndex
- index in the output arrayoutputLength
- output data length- Returns:
- The number of bytes returned in output array
- Throws:
IllegalParameterException
- when one or more of the parameters are illegalNotInitializedException
- if a required encryption parameter is not configured (for example, the key to be used for encryption)IllegalUseException
- if providing input when the state doesn't allow ithasMoreOutput()
returns trueCryptoException
- if an internal error occurred
-
hasMoreOutput
boolean hasMoreOutput()
Returns whether the last operation has additional output buffered IMPORTANT: while the return value is true no further input can be provided to the cipher- Returns:
- Returns true if last operation has additional output buffered.
-
getMaxBufferLength
short getMaxBufferLength()
- Returns:
- The maximum size in bytes allowed for the input buffer
-
-