Class NTRUEncryptionKeyGenerationParameters
java.lang.Object
org.bouncycastle.crypto.KeyGenerationParameters
org.bouncycastle.pqc.legacy.crypto.ntru.NTRUEncryptionKeyGenerationParameters
- All Implemented Interfaces:
Cloneable
public class NTRUEncryptionKeyGenerationParameters
extends KeyGenerationParameters
implements Cloneable
A set of parameters for NtruEncrypt. Several predefined parameter sets are available and new ones can be created as well.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final NTRUEncryptionKeyGenerationParametersA parameter set that gives 128 bits of security and uses simple ternary polynomials.static final NTRUEncryptionKeyGenerationParametersLikeAPR2011_439, this parameter set gives 128 bits of security but uses product-form polynomials andf=1+pF.static final NTRUEncryptionKeyGenerationParametersA parameter set that gives 256 bits of security and uses simple ternary polynomials.static final NTRUEncryptionKeyGenerationParametersLikeAPR2011_743, this parameter set gives 256 bits of security but uses product-form polynomials andf=1+pF.intintintintintintintintintintintintintstatic final NTRUEncryptionKeyGenerationParametersA conservative (in terms of security) parameter set that gives 256 bits of security and is optimized for key size.static final NTRUEncryptionKeyGenerationParametersA conservative (in terms of security) parameter set that gives 256 bits of security and is a tradeoff between key size and encryption/decryption speed.static final NTRUEncryptionKeyGenerationParametersA conservative (in terms of security) parameter set that gives 256 bits of security and is optimized for encryption/decryption speed.booleanbooleanintintintintbyte[]intintintboolean -
Constructor Summary
ConstructorsConstructorDescriptionNTRUEncryptionKeyGenerationParameters(int N, int q, int df, int dm0, int db, int c, int minCallsR, int minCallsMask, boolean hashSeed, byte[] oid, boolean sparse, boolean fastFp, Digest hashAlg) Constructs a parameter set that uses ternary private keys (i.e.NTRUEncryptionKeyGenerationParameters(int N, int q, int df, int dm0, int db, int c, int minCallsR, int minCallsMask, boolean hashSeed, byte[] oid, boolean sparse, boolean fastFp, Digest hashAlg, SecureRandom random) Constructs a parameter set that uses ternary private keys (i.e.NTRUEncryptionKeyGenerationParameters(int N, int q, int df1, int df2, int df3, int dm0, int db, int c, int minCallsR, int minCallsMask, boolean hashSeed, byte[] oid, boolean sparse, boolean fastFp, Digest hashAlg) Constructs a parameter set that uses product-form private keys (i.e.NTRUEncryptionKeyGenerationParameters(int N, int q, int df1, int df2, int df3, int dm0, int db, int c, int minCallsR, int minCallsMask, boolean hashSeed, byte[] oid, boolean sparse, boolean fastFp, Digest hashAlg, SecureRandom random) Constructs a parameter set that uses product-form private keys (i.e.Reads a parameter set from an input stream. -
Method Summary
Modifier and TypeMethodDescriptionclone()booleanintReturns the maximum length a plaintext message can be with this parameter set.inthashCode()toString()voidwriteTo(OutputStream os) Writes the parameter set to an output streamMethods inherited from class org.bouncycastle.crypto.KeyGenerationParameters
getRandom, getStrength
-
Field Details
-
EES1087EP2
A conservative (in terms of security) parameter set that gives 256 bits of security and is optimized for key size. UsesCryptoServicesRegistrar.getSecureRandom()as an entropy source (but the value present at class load time). -
EES1171EP1
A conservative (in terms of security) parameter set that gives 256 bits of security and is a tradeoff between key size and encryption/decryption speed. UsesCryptoServicesRegistrar.getSecureRandom()as an entropy source (but the value present at class load time). -
EES1499EP1
A conservative (in terms of security) parameter set that gives 256 bits of security and is optimized for encryption/decryption speed. UsesCryptoServicesRegistrar.getSecureRandom()as an entropy source (but the value present at class load time). -
APR2011_439
A parameter set that gives 128 bits of security and uses simple ternary polynomials. UsesCryptoServicesRegistrar.getSecureRandom()as an entropy source (but the value present at class load time). -
APR2011_439_FAST
LikeAPR2011_439, this parameter set gives 128 bits of security but uses product-form polynomials andf=1+pF. UsesCryptoServicesRegistrar.getSecureRandom()as an entropy source (but the value present at class load time). -
APR2011_743
A parameter set that gives 256 bits of security and uses simple ternary polynomials. UsesCryptoServicesRegistrar.getSecureRandom()as an entropy source (but the value present at class load time). -
APR2011_743_FAST
LikeAPR2011_743, this parameter set gives 256 bits of security but uses product-form polynomials andf=1+pF. UsesCryptoServicesRegistrar.getSecureRandom()as an entropy source (but the value present at class load time). -
N
public int N -
q
public int q -
df
public int df -
df1
public int df1 -
df2
public int df2 -
df3
public int df3 -
dr
public int dr -
dr1
public int dr1 -
dr2
public int dr2 -
dr3
public int dr3 -
dg
public int dg -
maxMsgLenBytes
public int maxMsgLenBytes -
db
public int db -
bufferLenBits
public int bufferLenBits -
dm0
public int dm0 -
pkLen
public int pkLen -
c
public int c -
minCallsR
public int minCallsR -
minCallsMask
public int minCallsMask -
hashSeed
public boolean hashSeed -
oid
public byte[] oid -
sparse
public boolean sparse -
fastFp
public boolean fastFp -
polyType
public int polyType -
hashAlg
-
-
Constructor Details
-
NTRUEncryptionKeyGenerationParameters
public NTRUEncryptionKeyGenerationParameters(int N, int q, int df, int dm0, int db, int c, int minCallsR, int minCallsMask, boolean hashSeed, byte[] oid, boolean sparse, boolean fastFp, Digest hashAlg, SecureRandom random) Constructs a parameter set that uses ternary private keys (i.e.polyType=SIMPLE).- Parameters:
N- number of polynomial coefficientsq- modulusdf- number of ones in the private polynomialfdm0- minimum acceptable number of -1's, 0's, and 1's in the polynomialm'in the last encryption stepdb- number of random bits to prepend to the messagec- a parameter for the Index Generation Function (IndexGenerator)minCallsR- minimum number of hash calls for the IGF to makeminCallsMask- minimum number of calls to generate the masking polynomialhashSeed- whether to hash the seed in the MGF first (true) or use the seed directly (false)oid- three bytes that uniquely identify the parameter setsparse- whether to treat ternary polynomials as sparsely populated (SparseTernaryPolynomialvsDenseTernaryPolynomial)fastFp- whetherf=1+p*Ffor a ternaryF(true) orfis ternary (false)hashAlg- a valid identifier for ajava.security.MessageDigestinstance such asSHA-256. TheMessageDigestmust support thegetDigestLength()method.random- entropy source, ifnullusesCryptoServicesRegistrar.getSecureRandom()
-
NTRUEncryptionKeyGenerationParameters
public NTRUEncryptionKeyGenerationParameters(int N, int q, int df, int dm0, int db, int c, int minCallsR, int minCallsMask, boolean hashSeed, byte[] oid, boolean sparse, boolean fastFp, Digest hashAlg) Constructs a parameter set that uses ternary private keys (i.e.polyType=SIMPLE).- Parameters:
N- number of polynomial coefficientsq- modulusdf- number of ones in the private polynomialfdm0- minimum acceptable number of -1's, 0's, and 1's in the polynomialm'in the last encryption stepdb- number of random bits to prepend to the messagec- a parameter for the Index Generation Function (IndexGenerator)minCallsR- minimum number of hash calls for the IGF to makeminCallsMask- minimum number of calls to generate the masking polynomialhashSeed- whether to hash the seed in the MGF first (true) or use the seed directly (false)oid- three bytes that uniquely identify the parameter setsparse- whether to treat ternary polynomials as sparsely populated (SparseTernaryPolynomialvsDenseTernaryPolynomial)fastFp- whetherf=1+p*Ffor a ternaryF(true) orfis ternary (false)hashAlg- a valid identifier for ajava.security.MessageDigestinstance such asSHA-256. TheMessageDigestmust support thegetDigestLength()method.
-
NTRUEncryptionKeyGenerationParameters
public NTRUEncryptionKeyGenerationParameters(int N, int q, int df1, int df2, int df3, int dm0, int db, int c, int minCallsR, int minCallsMask, boolean hashSeed, byte[] oid, boolean sparse, boolean fastFp, Digest hashAlg, SecureRandom random) Constructs a parameter set that uses product-form private keys (i.e.polyType=PRODUCT).- Parameters:
N- number of polynomial coefficientsq- modulusdf1- number of ones in the private polynomialf1df2- number of ones in the private polynomialf2df3- number of ones in the private polynomialf3dm0- minimum acceptable number of -1's, 0's, and 1's in the polynomialm'in the last encryption stepdb- number of random bits to prepend to the messagec- a parameter for the Index Generation Function (IndexGenerator)minCallsR- minimum number of hash calls for the IGF to makeminCallsMask- minimum number of calls to generate the masking polynomialhashSeed- whether to hash the seed in the MGF first (true) or use the seed directly (false)oid- three bytes that uniquely identify the parameter setsparse- whether to treat ternary polynomials as sparsely populated (SparseTernaryPolynomialvsDenseTernaryPolynomial)fastFp- whetherf=1+p*Ffor a ternaryF(true) orfis ternary (false)hashAlg- a valid identifier for ajava.security.MessageDigestinstance such asSHA-256random- entropy source, ifnullusesCryptoServicesRegistrar.getSecureRandom()
-
NTRUEncryptionKeyGenerationParameters
public NTRUEncryptionKeyGenerationParameters(int N, int q, int df1, int df2, int df3, int dm0, int db, int c, int minCallsR, int minCallsMask, boolean hashSeed, byte[] oid, boolean sparse, boolean fastFp, Digest hashAlg) Constructs a parameter set that uses product-form private keys (i.e.polyType=PRODUCT). UsesCryptoServicesRegistrar.getSecureRandom()as an entropy source.- Parameters:
N- number of polynomial coefficientsq- modulusdf1- number of ones in the private polynomialf1df2- number of ones in the private polynomialf2df3- number of ones in the private polynomialf3dm0- minimum acceptable number of -1's, 0's, and 1's in the polynomialm'in the last encryption stepdb- number of random bits to prepend to the messagec- a parameter for the Index Generation Function (IndexGenerator)minCallsR- minimum number of hash calls for the IGF to makeminCallsMask- minimum number of calls to generate the masking polynomialhashSeed- whether to hash the seed in the MGF first (true) or use the seed directly (false)oid- three bytes that uniquely identify the parameter setsparse- whether to treat ternary polynomials as sparsely populated (SparseTernaryPolynomialvsDenseTernaryPolynomial)fastFp- whetherf=1+p*Ffor a ternaryF(true) orfis ternary (false)hashAlg- a valid identifier for ajava.security.MessageDigestinstance such asSHA-256
-
NTRUEncryptionKeyGenerationParameters
Reads a parameter set from an input stream.- Parameters:
is- an input stream- Throws:
IOException
-
-
Method Details
-
getEncryptionParameters
-
clone
-
getMaxMessageLength
public int getMaxMessageLength()Returns the maximum length a plaintext message can be with this parameter set.- Returns:
- the maximum length in bytes
-
writeTo
Writes the parameter set to an output stream- Parameters:
os- an output stream- Throws:
IOException
-
hashCode
public int hashCode() -
equals
-
toString
-