/**
  * Constructs a parameter set that uses ternary private keys (i.e. </code>polyType=SIMPLE</code>).
  * @param N            number of polynomial coefficients
  * @param q            modulus
  * @param d            number of -1's in the private polynomials <code>f</code> and <code>g</code>
  * @param B            number of perturbations
  * @param basisType    whether to use the standard or transpose lattice
  * @param beta         balancing factor for the transpose lattice
  * @param normBound    maximum norm for valid signatures
  * @param keyNormBound maximum norm for the polynomials <code>F</code> and <code>G</code>
  * @param primeCheck   whether <code>2N+1</code> is prime
  * @param sparse       whether to treat ternary polynomials as sparsely populated ({@link SparseTernaryPolynomial} vs {@link DenseTernaryPolynomial})
  * @param keyGenAlg    <code>RESULTANT</code> produces better bases, <code>FLOAT</code> is slightly faster. <code>RESULTANT</code> follows the EESS standard while <code>FLOAT</code> is described in Hoffstein et al: An Introduction to Mathematical Cryptography.
  * @param hashAlg      a valid identifier for a <code>java.security.MessageDigest</code> instance such as <code>SHA-256</code>. The <code>MessageDigest</code> must support the <code>getDigestLength()</code> method.
  */
 public SignatureParameters(int N, int q, int d, int B, BasisType basisType, float beta, float normBound, float keyNormBound, bool primeCheck, bool sparse, KeyGenAlg keyGenAlg, String hashAlg)
 {
     this.N            = N;
     this.q            = q;
     this.d            = d;
     this.B            = B;
     this.basisType    = basisType;
     this.beta         = beta;
     this.normBound    = normBound;
     this.keyNormBound = keyNormBound;
     this.primeCheck   = primeCheck;
     this.sparse       = sparse;
     this.keyGenAlg    = keyGenAlg;
     this.hashAlg      = hashAlg;
     polyType          = TernaryPolynomialType.SIMPLE;
     init();
 }
Exemplo n.º 2
0
 /**
  * Constructs a parameter set that uses ternary private keys (i.e. </code>polyType=SIMPLE</code>).
  * @param N            number of polynomial coefficients
  * @param q            modulus
  * @param d            number of -1's in the private polynomials <code>f</code> and <code>g</code>
  * @param B            number of perturbations
  * @param basisType    whether to use the standard or transpose lattice
  * @param beta         balancing factor for the transpose lattice
  * @param normBound    maximum norm for valid signatures
  * @param keyNormBound maximum norm for the polynomials <code>F</code> and <code>G</code>
  * @param primeCheck   whether <code>2N+1</code> is prime
  * @param sparse       whether to treat ternary polynomials as sparsely populated ({@link SparseTernaryPolynomial} vs {@link DenseTernaryPolynomial})
  * @param keyGenAlg    <code>RESULTANT</code> produces better bases, <code>FLOAT</code> is slightly faster. <code>RESULTANT</code> follows the EESS standard while <code>FLOAT</code> is described in Hoffstein et al: An Introduction to Mathematical Cryptography.
  * @param hashAlg      a valid identifier for a <code>java.security.MessageDigest</code> instance such as <code>SHA-256</code>. The <code>MessageDigest</code> must support the <code>getDigestLength()</code> method.
  */
 public SignatureParameters(int N, int q, int d, int B, BasisType basisType, float beta, float normBound, float keyNormBound, bool primeCheck, bool sparse, KeyGenAlg keyGenAlg, String hashAlg)
 {
     this.N = N;
     this.q = q;
     this.d = d;
     this.B = B;
     this.basisType = basisType;
     this.beta = beta;
     this.normBound = normBound;
     this.keyNormBound = keyNormBound;
     this.primeCheck = primeCheck;
     this.sparse = sparse;
     this.keyGenAlg = keyGenAlg;
     this.hashAlg = hashAlg;
     polyType = TernaryPolynomialType.SIMPLE;
     init();
 }
        /**
         * Reads a parameter set from an input stream.
         * @param is an input stream
         * @throws IOException
         */
        public SignatureParameters(MemoryStream ins)
        {
            BinaryReader dis = new BinaryReader(ins);

            N                 = dis.ReadInt32();
            q                 = dis.ReadInt32();
            d                 = dis.ReadInt32();
            d1                = dis.ReadInt32();
            d2                = dis.ReadInt32();
            d3                = dis.ReadInt32();
            B                 = dis.ReadInt32();
            basisType         = (BasisType)dis.ReadInt32();
            beta              = dis.ReadSingle();
            normBound         = dis.ReadSingle();
            keyNormBound      = dis.ReadSingle();
            signFailTolerance = dis.ReadInt32();
            primeCheck        = dis.ReadBoolean();
            sparse            = dis.ReadBoolean();
            bitsF             = dis.ReadInt32();
            keyGenAlg         = (KeyGenAlg)dis.ReadInt32();
            hashAlg           = dis.ReadString();
            polyType          = (TernaryPolynomialType)dis.ReadInt32();
            init();
        }
Exemplo n.º 4
0
 /**
  * Reads a parameter set from an input stream.
  * @param is an input stream
  * @throws IOException
  */
 public SignatureParameters(MemoryStream ins)
 {
     BinaryReader dis = new BinaryReader(ins);
     N = dis.ReadInt32();
     q = dis.ReadInt32();
     d = dis.ReadInt32();
     d1 = dis.ReadInt32();
     d2 = dis.ReadInt32();
     d3 = dis.ReadInt32();
     B = dis.ReadInt32();
     basisType = (BasisType)dis.ReadInt32();
     beta = dis.ReadSingle();
     normBound = dis.ReadSingle();
     keyNormBound = dis.ReadSingle();
     signFailTolerance = dis.ReadInt32();
     primeCheck = dis.ReadBoolean();
     sparse = dis.ReadBoolean();
     bitsF = dis.ReadInt32();
     keyGenAlg = (KeyGenAlg)dis.ReadInt32();
     hashAlg = dis.ReadString();
     polyType = (TernaryPolynomialType)dis.ReadInt32();
     init();
 }