java.lang.Object
com.southernstorm.noise.protocol.CipherStatePair
- All Implemented Interfaces:
Destroyable
Class that contains a pair of CipherState objects. CipherState pairs typically arise when HandshakeState.split() is called.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate CipherStateCipher protecting incoming messages.private CipherStateCipher protecting outgoing messages.Constructor Summary
ConstructorsConstructorDescriptionCipherStatePair(CipherState sender, CipherState receiver) Constructs a pair of CipherState objects.Method Summary
All MethodsModifier and TypeMethodDescriptionvoiddestroy()Destroys all sensitive state in the current object.Gets the CipherState to use to receive packets from the remote party.Gets the CipherState to use to send packets to the remote party.voidDestroys the sending CipherState and retains only the receiving CipherState.voidDestroys the receiving CipherState and retains only the sending CipherState.voidswap()Swaps the sender and receiver.
Field Details
send
Cipher protecting outgoing messages.recv
Cipher protecting incoming messages.
Constructor Details
CipherStatePair
Constructs a pair of CipherState objects.- Parameters:
sender- The CipherState to use to send packets to the remote party.receiver- The CipherState to use to receive packets from the remote party.
Method Details
getSender
Gets the CipherState to use to send packets to the remote party.- Returns:
- The sending CipherState.
getReceiver
Gets the CipherState to use to receive packets from the remote party.- Returns:
- The receiving CipherState.
senderOnly
public void senderOnly()Destroys the receiving CipherState and retains only the sending CipherState. This function is intended for use with one-way handshake patterns.receiverOnly
public void receiverOnly()Destroys the sending CipherState and retains only the receiving CipherState. This function is intended for use with one-way handshake patterns.swap
public void swap()Swaps the sender and receiver.destroy
public void destroy()Description copied from interface:DestroyableDestroys all sensitive state in the current object.- Specified by:
destroyin interfaceDestroyable