McEliecePKCSCipher (Bouncy Castle Library 1.54 API Specification)
Date: 2015-12-29

org.bouncycastle.pqc.crypto.mceliece

## Class McEliecePKCSCipher

- java.lang.Object
- - org.bouncycastle.pqc.crypto.mceliece.McEliecePKCSCipher

- All Implemented Interfaces:
    MessageEncryptor

      public class McEliecePKCSCipher
      extends java.lang.Object
      implements MessageEncryptor

  This class implements the McEliece Public Key cryptosystem (McEliecePKCS). It was first described in R.J. McEliece, "A public key cryptosystem based on algebraic coding theory", DSN progress report, 42-44:114-116, 1978. The McEliecePKCS is the first cryptosystem which is based on error correcting codes. The trapdoor for the McEliece cryptosystem using Goppa codes is the knowledge of the Goppa polynomial used to generate the code.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `int` | `cipherTextSize`
    `int` | `maxPlainTextSize`
    `static java.lang.String` | `OID` The OID of the algorithm.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `McEliecePKCSCipher()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getKeySize(McElieceKeyParameters key)` Return the key size of the given key object.
    `void` | `init(boolean forSigning, CipherParameters param)`
    `void` | `initCipherDecrypt(McEliecePrivateKeyParameters privKey)`
    `void` | `initCipherEncrypt(McEliecePublicKeyParameters pubKey)`
    `byte[]` | `messageDecrypt(byte[] input)` Decrypt a cipher text.
    `byte[]` | `messageEncrypt(byte[] input)` Encrypt a plain text.

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

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

- - ### Field Detail

    - #### OID

          public static final java.lang.String OID

      The OID of the algorithm.
      See Also:
        Constant Field Values

    - #### maxPlainTextSize

          public int maxPlainTextSize

    - #### cipherTextSize

          public int cipherTextSize

  - ### Constructor Detail

    - #### McEliecePKCSCipher

          public McEliecePKCSCipher()

  - ### Method Detail

    - #### init

          public void init(boolean forSigning,
                  CipherParameters param)

      Specified by:
        `init` in interface `MessageEncryptor`
      Parameters:
        `forSigning` - true if we are encrypting a signature, false otherwise.
        `param` - key parameters for encryption or decryption.

    - #### getKeySize

          public int getKeySize(McElieceKeyParameters key)

      Return the key size of the given key object.
      Parameters:
        `key` - the McElieceKeyParameters object
      Returns:
        the keysize of the given key object

    - #### initCipherEncrypt

          public void initCipherEncrypt(McEliecePublicKeyParameters pubKey)

    - #### initCipherDecrypt

          public void initCipherDecrypt(McEliecePrivateKeyParameters privKey)

    - #### messageEncrypt

          public byte[] messageEncrypt(byte[] input)

      Encrypt a plain text.
      Specified by:
        `messageEncrypt` in interface `MessageEncryptor`
      Parameters:
        `input` - the plain text
      Returns:
        the cipher text

    - #### messageDecrypt

          public byte[] messageDecrypt(byte[] input)
                                throws java.lang.Exception

      Decrypt a cipher text.
      Specified by:
        `messageDecrypt` in interface `MessageEncryptor`
      Parameters:
        `input` - the cipher text
      Returns:
        the plain text
      Throws:
        `java.lang.Exception` - if the cipher text is invalid.