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

org.bouncycastle.crypto.agreement

## Class SM2KeyExchange

- java.lang.Object
- - org.bouncycastle.crypto.agreement.SM2KeyExchange

-     public class SM2KeyExchange
      extends java.lang.Object

  SM2 Key Exchange protocol - based on https://tools.ietf.org/html/draft-shen-sm2-ecdsa-02

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SM2KeyExchange()`
    `SM2KeyExchange(Digest digest)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `calculateKey(int kLen, CipherParameters pubParam)`
    `byte[][]` | `calculateKeyWithConfirmation(int kLen, byte[] confirmationTag, CipherParameters pubParam)`
    `void` | `init(CipherParameters privParam)`

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

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

- - ### Constructor Detail

    - #### SM2KeyExchange

          public SM2KeyExchange()

    - #### SM2KeyExchange

          public SM2KeyExchange(Digest digest)

  - ### Method Detail

    - #### init

          public void init(CipherParameters privParam)

    - #### calculateKey

          public byte[] calculateKey(int kLen,
                                     CipherParameters pubParam)

    - #### calculateKeyWithConfirmation

          public byte[][] calculateKeyWithConfirmation(int kLen,
                                                       byte[] confirmationTag,
                                                       CipherParameters pubParam)