Bouncy Castle Cryptography 1.50

org.bouncycastle.pqc.crypto.ntru
Class NTRUEncryptionPrivateKeyParameters

java.lang.Object
  extended by org.bouncycastle.crypto.params.AsymmetricKeyParameter
      extended by org.bouncycastle.pqc.crypto.ntru.NTRUEncryptionKeyParameters
          extended by org.bouncycastle.pqc.crypto.ntru.NTRUEncryptionPrivateKeyParameters
All Implemented Interfaces:
CipherParameters

public class NTRUEncryptionPrivateKeyParameters
extends NTRUEncryptionKeyParameters

A NtruEncrypt private key is essentially a polynomial named f which takes different forms depending on whether product-form polynomials are used, and on fastP
The inverse of f modulo p is precomputed on initialization.


Field Summary
 IntegerPolynomial fp
           
 IntegerPolynomial h
           
 Polynomial t
           
 
Fields inherited from class org.bouncycastle.pqc.crypto.ntru.NTRUEncryptionKeyParameters
params
 
Constructor Summary
NTRUEncryptionPrivateKeyParameters(byte[] b, NTRUEncryptionParameters params)
          Converts a byte array to a polynomial f and constructs a new private key
NTRUEncryptionPrivateKeyParameters(java.io.InputStream is, NTRUEncryptionParameters params)
          Reads a polynomial f from an input stream and constructs a new private key
NTRUEncryptionPrivateKeyParameters(IntegerPolynomial h, Polynomial t, IntegerPolynomial fp, NTRUEncryptionParameters params)
          Constructs a new private key from a polynomial
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 byte[] getEncoded()
          Converts the key to a byte array
 int hashCode()
           
 void writeTo(java.io.OutputStream os)
          Writes the key to an output stream
 
Methods inherited from class org.bouncycastle.pqc.crypto.ntru.NTRUEncryptionKeyParameters
getParameters
 
Methods inherited from class org.bouncycastle.crypto.params.AsymmetricKeyParameter
isPrivate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

t

public Polynomial t

fp

public IntegerPolynomial fp

h

public IntegerPolynomial h
Constructor Detail

NTRUEncryptionPrivateKeyParameters

public NTRUEncryptionPrivateKeyParameters(IntegerPolynomial h,
                                          Polynomial t,
                                          IntegerPolynomial fp,
                                          NTRUEncryptionParameters params)
Constructs a new private key from a polynomial

Parameters:
h - the public polynomial for the key.
t - the polynomial which determines the key: if fastFp=true, f=1+3t; otherwise, f=t
fp - the inverse of f
params - the NtruEncrypt parameters to use

NTRUEncryptionPrivateKeyParameters

public NTRUEncryptionPrivateKeyParameters(byte[] b,
                                          NTRUEncryptionParameters params)
                                   throws java.io.IOException
Converts a byte array to a polynomial f and constructs a new private key

Parameters:
b - an encoded polynomial
params - the NtruEncrypt parameters to use
Throws:
java.io.IOException
See Also:
getEncoded()

NTRUEncryptionPrivateKeyParameters

public NTRUEncryptionPrivateKeyParameters(java.io.InputStream is,
                                          NTRUEncryptionParameters params)
                                   throws java.io.IOException
Reads a polynomial f from an input stream and constructs a new private key

Parameters:
is - an input stream
params - the NtruEncrypt parameters to use
Throws:
java.io.IOException
See Also:
writeTo(OutputStream)
Method Detail

getEncoded

public byte[] getEncoded()
Converts the key to a byte array

Returns:
the encoded key
See Also:
NTRUEncryptionPrivateKeyParameters(byte[], NTRUEncryptionParameters)

writeTo

public void writeTo(java.io.OutputStream os)
             throws java.io.IOException
Writes the key to an output stream

Parameters:
os - an output stream
Throws:
java.io.IOException
See Also:
NTRUEncryptionPrivateKeyParameters(InputStream, NTRUEncryptionParameters)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

Bouncy Castle Cryptography 1.50