Package net.spy.memcached
Class TLSConnectionHandler
java.lang.Object
net.spy.memcached.TLSConnectionHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ByteBufferThe ByteBuffer holds this peer's application data in plaintext.protected ByteBufferThe ByteBuffer holds this peer's TLS encrypted data.protected ByteBufferThe ByteBuffer holds the other peer's application data in plaintext.protected ByteBufferThe ByteBuffer holds other peer's TLS encrypted data. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDecrypt the next TLS data record to plain text data.booleandoTlsHandshake(long timeoutInMillis) Initial handshake (for establishing cipher suite and key exchange between client and server).intencryptNextTLSDataRecord(ByteBuffer obuf, ByteBuffer wbuf) Convert plain text data record to encrypted data.
-
Field Details
-
myAppData
The ByteBuffer holds this peer's application data in plaintext. -
myNetData
The ByteBuffer holds this peer's TLS encrypted data. -
peerAppData
The ByteBuffer holds the other peer's application data in plaintext. -
peerNetData
The ByteBuffer holds other peer's TLS encrypted data.
-
-
Constructor Details
-
TLSConnectionHandler
-
-
Method Details
-
doTlsHandshake
Initial handshake (for establishing cipher suite and key exchange between client and server).- Parameters:
timeoutInMillis- the amount of time to wait for TLS handshake finish before timeout.- Returns:
- true if handshake is successful, false if handshake is unsuccessful.
- Throws:
IOException- if there is an error occurred during read/write to the socket channel.SSLException- if a problem was encountered while signaling the SSLEngine to begin a new handshake or if a problem was encountered while processing the data that caused the SSLEngine to abort.IllegalStateException- if the client/server mode has not yet been set.IllegalArgumentException- if the handshake status is invalid.OperationTimeoutException- if global operation timeout is exceeded
-
encryptNextTLSDataRecord
Convert plain text data record to encrypted data.- Returns:
- the number of bytes produced if successfully encrypted plain text data record, -1 if the encryption fails with BUFFER_OVERFLOW error, 0 if not encrypt any data record.
- Throws:
IOException
-
decryptNextTLSDataRecord
Decrypt the next TLS data record to plain text data.- Parameters:
rbuf- the buffer that contains TLS data record which will be decrypted.- Returns:
- buffer contains plain text data, null if unable to decrypt the data contained in the given buffer
- Throws:
IOException
-