Class McElieceCipher
java.lang.Object
org.bouncycastle.pqc.legacy.crypto.mceliece.McElieceCipher
- All Implemented Interfaces:
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
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.
-
Field Details
-
OID
The OID of the algorithm.- See Also:
-
maxPlainTextSize
public int maxPlainTextSize -
cipherTextSize
public int cipherTextSize
-
-
Constructor Details
-
McElieceCipher
public McElieceCipher()
-
-
Method Details
-
init
- Specified by:
init
in interfaceMessageEncryptor
- Parameters:
forEncryption
- true if we are encrypting a signature, false otherwise.param
- key parameters for encryption or decryption.
-
getKeySize
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 interfaceMessageEncryptor
- Parameters:
input
- the plain text- Returns:
- the cipher text
-
messageDecrypt
Decrypt a cipher text.- Specified by:
messageDecrypt
in interfaceMessageEncryptor
- Parameters:
input
- the cipher text- Returns:
- the plain text
- Throws:
InvalidCipherTextException
- if the cipher text is invalid.
-