Intel

Developer Zone

StreamCipher

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()
      Returns the maximum size in bytes allowed for the input buffer to encrypt() and decrypt()
      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 exceed getMaxBufferLength() bytes
        inputIndex - index in the input array
        inputLength - input data length - must be zero if hasMoreOutput() returns true
        output - an array to hold the output data
        outputIndex - index in the output array
        outputLength - output data length
        Returns:
        The number of bytes returned in output array
        Throws:
        IllegalParameterException - when one or more of the parameters is illegal
        NotInitializedException - 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 it hasMoreOutput() returns true
        CryptoException - 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 exceed getMaxBufferLength() bytes
        inputIndex - index in the input array
        inputLength - input data length - must be zero if hasMoreOutput() returns true
        output - an array to hold the output data
        outputIndex - index in the output array
        outputLength - output data length
        Returns:
        The number of bytes returned in output array
        Throws:
        IllegalParameterException - when one or more of the parameters are illegal
        NotInitializedException - 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 it hasMoreOutput() returns true
        CryptoException - 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 to encrypt() and decrypt()
        Returns:
        The maximum size in bytes allowed for the input buffer