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 toperformHandshake()
ordestroy()
-
-
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 sessionshort
getMaxBufferLength()
Returns the maximum size in bytes allowed for the input buffer toperformHandshake()
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 sessionboolean
isEstablished()
Returns whether the secure session is establishedshort
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 callisEstablished
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 callisEstablished
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 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 the output array
- Throws:
IllegalParameterException
- one or more of the input parameters is illegalNotInitializedException
- if a session is not configured correctlyIllegalUseException
- if one of the following occursdestroy()
was previously calledisEstablished()
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 errorCryptoException
- if an internal error occurred
-
isEstablished
boolean isEstablished() throws CryptoException
Returns whether the secure session is established- Returns:
- Whether the secure session is established
- Throws:
IllegalUseException
- ifdestroy()
was previously calledCryptoException
-
getFailure
int getFailure() throws CryptoException
Returns the last failure of the secure session- Returns:
- The last failure of the secure session or -1 if no failure occurred
- Throws:
IllegalUseException
- ifdestroy()
was previously calledCryptoException
- if an internal error occurred
-
destroy
void destroy() throws CryptoException
Destroys a session cleaning up its system resources. Must be called when the session is no longer required.- Throws:
IllegalUseException
- ifdestroy()
was previously calledCryptoException
- 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
- ifdestroy()
was previously called
-
getMaxBufferLength
short getMaxBufferLength()
Returns the maximum size in bytes allowed for the input buffer toperformHandshake()
- Returns:
- The maximum size in bytes allowed for the input buffer
-
-