Package com.southernstorm.noise.protocol
Class CipherStatePair
- java.lang.Object
-
- com.southernstorm.noise.protocol.CipherStatePair
-
- All Implemented Interfaces:
Destroyable
public final class CipherStatePair extends Object implements Destroyable
Class that contains a pair of CipherState objects. CipherState pairs typically arise when HandshakeState.split() is called.
-
-
Constructor Summary
Constructors Constructor Description CipherStatePair(CipherState sender, CipherState receiver)
Constructs a pair of CipherState objects.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
Destroys all sensitive state in the current object.CipherState
getReceiver()
Gets the CipherState to use to receive packets from the remote party.CipherState
getSender()
Gets the CipherState to use to send packets to the remote party.void
receiverOnly()
Destroys the sending CipherState and retains only the receiving CipherState.void
senderOnly()
Destroys the receiving CipherState and retains only the sending CipherState.void
swap()
Swaps the sender and receiver.
-
-
-
Constructor Detail
-
CipherStatePair
public CipherStatePair(CipherState sender, CipherState receiver)
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 Detail
-
getSender
public CipherState getSender()
Gets the CipherState to use to send packets to the remote party.- Returns:
- The sending CipherState.
-
getReceiver
public 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:Destroyable
Destroys all sensitive state in the current object.- Specified by:
destroy
in interfaceDestroyable
-
-