Bouncy Castle Cryptography Library 1.79

org.bouncycastle.pqc.legacy.crypto.mceliece
Class McElieceCipher

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

public class McElieceCipher
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
 int cipherTextSize
           
 int maxPlainTextSize
           
static java.lang.String OID
          The OID of the algorithm.
 
Constructor Summary
McElieceCipher()
           
 
Method Summary
 int getKeySize(McElieceKeyParameters key)
          Return the key size of the given key object.
 void init(boolean forEncryption, CipherParameters param)
           
 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.

maxPlainTextSize

public int maxPlainTextSize

cipherTextSize

public int cipherTextSize
Constructor Detail

McElieceCipher

public McElieceCipher()
Method Detail

init

public void init(boolean forEncryption,
                 CipherParameters param)
Specified by:
init in interface MessageEncryptor
Following copied from interface: org.bouncycastle.pqc.crypto.MessageEncryptor
Parameters:
forEncrypting - 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.

Bouncy Castle Cryptography Library 1.79