ExchangePair (Bouncy Castle Library 1.85 API Specification)
Date: 2026-07-12

org.bouncycastle.pqc.crypto

## Class ExchangePair

- java.lang.Object
- - org.bouncycastle.pqc.crypto.ExchangePair

-     public class ExchangePair
      extends java.lang.Object

  Pair for a value exchange algorithm where the responding party has no private key, such as NewHope.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExchangePair(AsymmetricKeyParameter publicKey, byte[] shared)` Base constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `AsymmetricKeyParameter` | `getPublicKey()` Return the responding party's public key.
    `byte[]` | `getSharedValue()` Return the shared value calculated with public key.

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

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

- - ### Constructor Detail

    - #### ExchangePair

          public ExchangePair(AsymmetricKeyParameter publicKey,
                              byte[] shared)

      Base constructor.
      Parameters:
        `publicKey` - The responding party's public key.
        `shared` - the calculated shared value.

  - ### Method Detail

    - #### getPublicKey

          public AsymmetricKeyParameter getPublicKey()

      Return the responding party's public key.
      Returns:
        the public key calculated for the exchange.

    - #### getSharedValue

          public byte[] getSharedValue()

      Return the shared value calculated with public key.
      Returns:
        the shared value.