Bouncy Castle Cryptography Library 1.48

org.bouncycastle.crypto.engines
Class NTRUEngine

java.lang.Object
  extended by org.bouncycastle.crypto.engines.NTRUEngine
All Implemented Interfaces:
AsymmetricBlockCipher

public class NTRUEngine
extends java.lang.Object
implements AsymmetricBlockCipher

Encrypts, decrypts data and generates key pairs.
The parameter p is hardcoded to 3.


Constructor Summary
NTRUEngine()
          Constructs a new instance with a set of encryption parameters.
 
Method Summary
protected  org.bouncycastle.math.ntru.polynomial.IntegerPolynomial decrypt(org.bouncycastle.math.ntru.polynomial.IntegerPolynomial e, org.bouncycastle.math.ntru.polynomial.Polynomial priv_t, org.bouncycastle.math.ntru.polynomial.IntegerPolynomial priv_fp)
           
protected  org.bouncycastle.math.ntru.polynomial.IntegerPolynomial encrypt(org.bouncycastle.math.ntru.polynomial.IntegerPolynomial m, org.bouncycastle.math.ntru.polynomial.TernaryPolynomial r, org.bouncycastle.math.ntru.polynomial.IntegerPolynomial pubKey)
           
 int getInputBlockSize()
          returns the largest size an input block can be.
 int getOutputBlockSize()
          returns the maximum size of the block produced by this cipher.
 void init(boolean forEncryption, CipherParameters parameters)
          initialise the cipher.
 byte[] processBlock(byte[] in, int inOff, int len)
          process the block of len bytes stored in in from offset inOff.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NTRUEngine

public NTRUEngine()
Constructs a new instance with a set of encryption parameters.

Method Detail

init

public void init(boolean forEncryption,
                 CipherParameters parameters)
Description copied from interface: AsymmetricBlockCipher
initialise the cipher.

Specified by:
init in interface AsymmetricBlockCipher
Parameters:
forEncryption - if true the cipher is initialised for encryption, if false for decryption.
parameters - the key and other data required by the cipher.

getInputBlockSize

public int getInputBlockSize()
Description copied from interface: AsymmetricBlockCipher
returns the largest size an input block can be.

Specified by:
getInputBlockSize in interface AsymmetricBlockCipher
Returns:
maximum size for an input block.

getOutputBlockSize

public int getOutputBlockSize()
Description copied from interface: AsymmetricBlockCipher
returns the maximum size of the block produced by this cipher.

Specified by:
getOutputBlockSize in interface AsymmetricBlockCipher
Returns:
maximum size of the output block produced by the cipher.

processBlock

public byte[] processBlock(byte[] in,
                           int inOff,
                           int len)
                    throws InvalidCipherTextException
Description copied from interface: AsymmetricBlockCipher
process the block of len bytes stored in in from offset inOff.

Specified by:
processBlock in interface AsymmetricBlockCipher
Parameters:
in - the input data
inOff - offset into the in array where the data starts
len - the length of the block to be processed.
Returns:
the resulting byte array of the encryption/decryption process.
Throws:
InvalidCipherTextException - data decrypts improperly.

encrypt

protected org.bouncycastle.math.ntru.polynomial.IntegerPolynomial encrypt(org.bouncycastle.math.ntru.polynomial.IntegerPolynomial m,
                                                                          org.bouncycastle.math.ntru.polynomial.TernaryPolynomial r,
                                                                          org.bouncycastle.math.ntru.polynomial.IntegerPolynomial pubKey)

decrypt

protected org.bouncycastle.math.ntru.polynomial.IntegerPolynomial decrypt(org.bouncycastle.math.ntru.polynomial.IntegerPolynomial e,
                                                                          org.bouncycastle.math.ntru.polynomial.Polynomial priv_t,
                                                                          org.bouncycastle.math.ntru.polynomial.IntegerPolynomial priv_fp)
Parameters:
e -
priv_t - a polynomial such that if fastFp=true, f=1+3*priv_t; otherwise, f=priv_t
priv_fp -
Returns:

Bouncy Castle Cryptography Library 1.48