org.bouncycastle.pqc.crypto.mlkem

## Class MLKEMEngine

- java.lang.Object
- - org.bouncycastle.pqc.crypto.mlkem.MLKEMEngine

-     class MLKEMEngine
      extends Object

  Core engine for ML-KEM (Module-Lattice Key Encapsulation Mechanism) operations. Implements the cryptographic primitives for key generation, encapsulation, and decapsulation.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `KyberN`
    `static int` | `KyberPolyBytes`
    `static int` | `KyberQ`
    `static int` | `KyberQinv`
    `static int` | `KyberSymBytes`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MLKEMEngine(int k)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[][]` | `generateKemKeyPair()`
    `byte[][]` | `generateKemKeyPairInternal(byte[] d, byte[] z)`
    `int` | `getCryptoBytes()`
    `int` | `getCryptoCipherTextBytes()`
    `int` | `getCryptoPublicKeyBytes()`
    `int` | `getCryptoSecretKeyBytes()`
    `int` | `getKyberCipherTextBytes()`
    `int` | `getKyberEta1()`
    `static int` | `getKyberEta2()`
    `int` | `getKyberIndCpaBytes()`
    `static int` | `getKyberIndCpaMsgBytes()`
    `int` | `getKyberIndCpaPublicKeyBytes()`
    `int` | `getKyberIndCpaSecretKeyBytes()`
    `int` | `getKyberK()`
    `int` | `getKyberPolyCompressedBytes()`
    `int` | `getKyberPolyVecBytes()`
    `int` | `getKyberPolyVecCompressedBytes()`
    `int` | `getKyberPublicKeyBytes()`
    `int` | `getKyberSecretKeyBytes()`
    `void` | `getRandomBytes(byte[] buf)`
    `Symmetric` | `getSymmetric()`
    `void` | `init(SecureRandom random)`
    `byte[]` | `kemDecrypt(byte[] secretKey, byte[] cipherText)`
    `byte[]` | `kemDecryptInternal(byte[] secretKey, byte[] cipherText)`
    `byte[][]` | `kemEncrypt(byte[] publicKeyInput, byte[] randBytes)`
    `byte[][]` | `kemEncryptInternal(byte[] publicKeyInput, byte[] randBytes)`

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

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

- - ### Field Detail

    - #### KyberN

          public static final int KyberN

      See Also:
        Constant Field Values

    - #### KyberPolyBytes

          public static final int KyberPolyBytes

      See Also:
        Constant Field Values

    - #### KyberQ

          public static final int KyberQ

      See Also:
        Constant Field Values

    - #### KyberQinv

          public static final int KyberQinv

      See Also:
        Constant Field Values

    - #### KyberSymBytes

          public static final int KyberSymBytes

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### MLKEMEngine

          public MLKEMEngine(int k)

  - ### Method Detail

    - #### generateKemKeyPair

          public byte[][] generateKemKeyPair()

    - #### generateKemKeyPairInternal

          public byte[][] generateKemKeyPairInternal(byte[] d,
                                                     byte[] z)

    - #### getCryptoBytes

          public int getCryptoBytes()

    - #### getCryptoCipherTextBytes

          public int getCryptoCipherTextBytes()

    - #### getCryptoPublicKeyBytes

          public int getCryptoPublicKeyBytes()

    - #### getCryptoSecretKeyBytes

          public int getCryptoSecretKeyBytes()

    - #### getKyberCipherTextBytes

          public int getKyberCipherTextBytes()

    - #### getKyberEta1

          public int getKyberEta1()

    - #### getKyberEta2

          public static int getKyberEta2()

    - #### getKyberIndCpaBytes

          public int getKyberIndCpaBytes()

    - #### getKyberIndCpaMsgBytes

          public static int getKyberIndCpaMsgBytes()

    - #### getKyberIndCpaPublicKeyBytes

          public int getKyberIndCpaPublicKeyBytes()

    - #### getKyberIndCpaSecretKeyBytes

          public int getKyberIndCpaSecretKeyBytes()

    - #### getKyberK

          public int getKyberK()

    - #### getKyberPolyCompressedBytes

          public int getKyberPolyCompressedBytes()

    - #### getKyberPolyVecBytes

          public int getKyberPolyVecBytes()

    - #### getKyberPolyVecCompressedBytes

          public int getKyberPolyVecCompressedBytes()

    - #### getKyberPublicKeyBytes

          public int getKyberPublicKeyBytes()

    - #### getKyberSecretKeyBytes

          public int getKyberSecretKeyBytes()

    - #### getRandomBytes

          public void getRandomBytes(byte[] buf)

    - #### getSymmetric

          public Symmetric getSymmetric()

    - #### init

          public void init(SecureRandom random)

    - #### kemDecrypt

          public byte[] kemDecrypt(byte[] secretKey,
                                   byte[] cipherText)

    - #### kemDecryptInternal

          public byte[] kemDecryptInternal(byte[] secretKey,
                                           byte[] cipherText)

    - #### kemEncrypt

          public byte[][] kemEncrypt(byte[] publicKeyInput,
                                     byte[] randBytes)

    - #### kemEncryptInternal

          public byte[][] kemEncryptInternal(byte[] publicKeyInput,
                                             byte[] randBytes)