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 and Description
    `CipherStatePair(CipherState sender, CipherState receiver)` Constructs a pair of CipherState objects.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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

    - #### destroy

          public void destroy()

      Description copied from interface: `Destroyable`
      Destroys all sensitive state in the current object.
      Specified by:
        `destroy` in interface `Destroyable`

    - #### getReceiver

          public CipherState getReceiver()

      Gets the CipherState to use to receive packets from the remote party.
      Returns:
        The receiving CipherState.

    - #### getSender

          public CipherState getSender()

      Gets the CipherState to use to send packets to the remote party.
      Returns:
        The sending CipherState.

    - #### 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.

    - #### 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.

    - #### swap

          public void swap()

      Swaps the sender and receiver.