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

org.bouncycastle.crypto.kems.cmce

## Class CMCEEngine

- java.lang.Object
- - org.bouncycastle.crypto.kems.cmce.CMCEEngine

-     public class CMCEEngine
      extends java.lang.Object

  The Classic McEliece KEM as standardised in ISO/IEC 18033-2:2006/Amd 2:2026, Clause 13. A single engine implements both the non-pc construction (Encapsulation 13.12.2 / Decapsulation 13.13.2) and the pc ("plaintext confirmation") construction (13.12.3 / 13.13.3), selected by the `pc` flag: when pc, a 32-byte confirmation C1 = Hash(2, e) is appended to the ciphertext and the session key is hashed over the full C0 || C1. The semi-systematic "f" key-generation variant is selected by the `usePivots` flag.

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getCipherTextSize()`
    `static CMCEEngine` | `getInstance(CMCEParameters params)`
    `int` | `getPrivateKeySize()`
    `int` | `getPublicKeySize()`
    `int` | `getSessionKeySize()`
    `int` | `kem_dec(byte[] key, byte[] cipher_text, byte[] sk)`
    `int` | `kem_enc(byte[] cipher_text, byte[] key, byte[] pk, java.security.SecureRandom random)`
    `void` | `kem_keypair(byte[] pk, byte[] sk, java.security.SecureRandom random)`

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

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

- - ### Method Detail

    - #### getPrivateKeySize

          public int getPrivateKeySize()

    - #### getPublicKeySize

          public int getPublicKeySize()

    - #### getCipherTextSize

          public int getCipherTextSize()

    - #### getInstance

          public static CMCEEngine getInstance(CMCEParameters params)

    - #### kem_keypair

          public void kem_keypair(byte[] pk,
                                  byte[] sk,
                                  java.security.SecureRandom random)

    - #### kem_enc

          public int kem_enc(byte[] cipher_text,
                             byte[] key,
                             byte[] pk,
                             java.security.SecureRandom random)

    - #### kem_dec

          public int kem_dec(byte[] key,
                             byte[] cipher_text,
                             byte[] sk)

    - #### getSessionKeySize

          public int getSessionKeySize()