Class McElieceCipher

java.lang.Object
org.bouncycastle.pqc.legacy.crypto.mceliece.McElieceCipher
All Implemented Interfaces:
MessageEncryptor

public class McElieceCipher extends 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 Details

    • OID

      public static final String OID
      The OID of the algorithm.
      See Also:
    • maxPlainTextSize

      public int maxPlainTextSize
    • cipherTextSize

      public int cipherTextSize
  • Constructor Details

    • McElieceCipher

      public McElieceCipher()
  • Method Details

    • init

      public void init(boolean forEncryption, CipherParameters param)
      Specified by:
      init in interface MessageEncryptor
      Parameters:
      forEncryption - 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
    • 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 InvalidCipherTextException
      Decrypt a cipher text.
      Specified by:
      messageDecrypt in interface MessageEncryptor
      Parameters:
      input - the cipher text
      Returns:
      the plain text
      Throws:
      InvalidCipherTextException - if the cipher text is invalid.