org.bouncycastle.pqc.crypto.mlkem

## Class MLKEMIndCpa

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

-     class MLKEMIndCpa
      extends Object

  Indistinguishability under Chosen Plaintext Attack (IND-CPA) security for ML-KEM. Provides key generation operations with IND-CPA security guarantees.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `int` | `KyberGenerateMatrixNBlocks`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MLKEMIndCpa(MLKEMEngine engine)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `decrypt(byte[] secretKey, byte[] cipherText)`
    `byte[]` | `encrypt(byte[] publicKeyInput, byte[] msg, byte[] coins)`
    `(package private) byte[][]` | `generateKeyPair(byte[] d)` Generates IndCpa Key Pair
    `void` | `generateMatrix(PolyVec[] aMatrix, byte[] seed, boolean transposed)`
    `byte[]` | `packPublicKey(PolyVec publicKeyPolyVec, byte[] seed)`
    `byte[]` | `packSecretKey(PolyVec secretKeyPolyVec)`
    `byte[]` | `unpackPublicKey(PolyVec publicKeyPolyVec, byte[] publicKey)`
    `void` | `unpackSecretKey(PolyVec secretKeyPolyVec, byte[] secretKey)`

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

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

- - ### Field Detail

    - #### KyberGenerateMatrixNBlocks

          public final int KyberGenerateMatrixNBlocks

  - ### Constructor Detail

    - #### MLKEMIndCpa

          public MLKEMIndCpa(MLKEMEngine engine)

  - ### Method Detail

    - #### decrypt

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

    - #### encrypt

          public byte[] encrypt(byte[] publicKeyInput,
                                byte[] msg,
                                byte[] coins)

    - #### generateKeyPair

          byte[][] generateKeyPair(byte[] d)

      Generates IndCpa Key Pair
      Returns:
        KeyPair where each key is represented as bytes

    - #### generateMatrix

          public void generateMatrix(PolyVec[] aMatrix,
                                     byte[] seed,
                                     boolean transposed)

    - #### packPublicKey

          public byte[] packPublicKey(PolyVec publicKeyPolyVec,
                                      byte[] seed)

    - #### packSecretKey

          public byte[] packSecretKey(PolyVec secretKeyPolyVec)

    - #### unpackPublicKey

          public byte[] unpackPublicKey(PolyVec publicKeyPolyVec,
                                        byte[] publicKey)

    - #### unpackSecretKey

          public void unpackSecretKey(PolyVec secretKeyPolyVec,
                                      byte[] secretKey)