Intel

Developer Zone

SecureSession

com.intel.crypto

Interface SecureSession

  • All Known Implementing Classes:
    SslSession


    public interface SecureSession
    This interface represents a secure session. This interface is stateful, and the internal state changes with every call to performHandshake() or destroy()
    • Method Summary

      Methods
      Modifier and Type Method and Description
      void destroy()
      Destroys a session cleaning up its system resources.
      int getFailure()
      Returns the last failure of the secure session
      short getMaxBufferLength()
      Returns the maximum size in bytes allowed for the input buffer to performHandshake()
      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 session
      boolean isEstablished()
      Returns whether the secure session is established
      short performHandshake(byte[] input, short inputIndex, short inputLength, byte[] output, short outputIndex, short outputLength)
      Performs a handshake in order to establish a secure session with the other endpoint.
      The caller should call isEstablished after this call to see whether the session is established.
      This function may be needed to be called more than once, depending on the underlying session type.
    • Method Detail

      • performHandshake

        short performHandshake(byte[] input,
                             short inputIndex,
                             short inputLength,
                             byte[] output,
                             short outputIndex,
                             short outputLength)
                               throws CryptoException
        Performs a handshake in order to establish a secure session with the other endpoint.
        The caller should call isEstablished after this call to see whether the session is established.
        This function may be needed to be called more than once, depending on the underlying session type.
        Parameters:
        input - an array that holds the input data containing the session establishment data. 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 the output array
        Throws:
        IllegalParameterException - one or more of the input parameters is illegal
        NotInitializedException - if a session is not configured correctly
        IllegalUseException - if one of the following occurs
        • destroy() was previously called
        • isEstablished() returns true
        • providing input when hasMoreOutput() returns true
        • the session previously failed with a protocol level error by throwing an OperationFailedException
        OperationFailedException - if the handshake failed due to protocol level error
        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 session
        Returns:
        Returns true if last operation has additional output buffered.
        Throws:
        IllegalUseException - if destroy() was previously called
      • getMaxBufferLength

        short getMaxBufferLength()
        Returns the maximum size in bytes allowed for the input buffer to performHandshake()
        Returns:
        The maximum size in bytes allowed for the input buffer