Top Description Fields Constructors Methods
org.bouncycastle.pqc.legacy.crypto.mceliece

public Class McElieceCipher

extends Object
implements MessageEncryptor
Class Inheritance
All Implemented Interfaces
org.bouncycastle.pqc.crypto.MessageEncryptor
Imports
java.security.SecureRandom, org.bouncycastle.crypto.CipherParameters, .CryptoServicesRegistrar, .InvalidCipherTextException, org.bouncycastle.crypto.params.ParametersWithRandom, org.bouncycastle.pqc.crypto.MessageEncryptor, org.bouncycastle.pqc.legacy.math.linearalgebra.GF2Matrix, .GF2Vector, .GF2mField, .GoppaCode, .Permutation, .PolynomialGF2mSmallM, .Vector

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

Modifier and TypeField and Description
public int
private boolean
private int
k

private McElieceKeyParameters
public int
private int
n

public static final String
OID

The OID of the algorithm.

private SecureRandom
private int
t

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private byte[]
private GF2Vector
public int

Returns:

the keysize of the given key object
getKeySize
(McElieceKeyParameters
the McElieceKeyParameters object
key
)

Return the key size of the given key object.

public void
init(boolean
true if we are encrypting a signature, false otherwise.
forEncryption
,
CipherParameters
key parameters for encryption or decryption.
param
)

Implements org.bouncycastle.pqc.crypto.MessageEncryptor.init.

private void
private void
public byte[]

Returns:

the plain text
messageDecrypt
(byte[]
the cipher text
input
)

Implements org.bouncycastle.pqc.crypto.MessageEncryptor.messageDecrypt.

Decrypt a cipher text.
public byte[]

Returns:

the cipher text
messageEncrypt
(byte[]
the plain text
input
)

Implements org.bouncycastle.pqc.crypto.MessageEncryptor.messageEncrypt.

Encrypt a plain text.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cipherTextSizeback to summary
public int cipherTextSize
forEncryptionback to summary
private boolean forEncryption
kback to summary
private int k
keyback to summary
private McElieceKeyParameters key
maxPlainTextSizeback to summary
public int maxPlainTextSize
nback to summary
private int n
OIDback to summary
public static final String OID

The OID of the algorithm.

srback to summary
private SecureRandom sr
tback to summary
private int t

Constructor Detail

McElieceCipherback to summary
public McElieceCipher()

Method Detail

computeMessageback to summary
private byte[] computeMessage(GF2Vector mr) throws InvalidCipherTextException
computeMessageRepresentativeback to summary
private GF2Vector computeMessageRepresentative(byte[] input)
getKeySizeback to summary
public int getKeySize(McElieceKeyParameters key)

Return the key size of the given key object.

Parameters
key:McElieceKeyParameters

the McElieceKeyParameters object

Returns:int

the keysize of the given key object

initback to summary
public void init(boolean forEncryption, CipherParameters param)

Implements org.bouncycastle.pqc.crypto.MessageEncryptor.init.

Parameters
forEncryption:boolean

Doc from org.bouncycastle.pqc.crypto.MessageEncryptor.init.

true if we are encrypting a signature, false otherwise.

param:CipherParameters

Doc from org.bouncycastle.pqc.crypto.MessageEncryptor.init.

key parameters for encryption or decryption.

initCipherDecryptback to summary
private void initCipherDecrypt(McEliecePrivateKeyParameters privKey)
initCipherEncryptback to summary
private void initCipherEncrypt(McEliecePublicKeyParameters pubKey)
messageDecryptback to summary
public byte[] messageDecrypt(byte[] input) throws InvalidCipherTextException

Implements org.bouncycastle.pqc.crypto.MessageEncryptor.messageDecrypt.

Decrypt a cipher text.

Parameters
input:byte[]

the cipher text

Returns:byte[]

the plain text

Exceptions
InvalidCipherTextException:
if the cipher text is invalid.
messageEncryptback to summary
public byte[] messageEncrypt(byte[] input)

Implements org.bouncycastle.pqc.crypto.MessageEncryptor.messageEncrypt.

Encrypt a plain text.

Parameters
input:byte[]

the plain text

Returns:byte[]

the cipher text