示例#1
0
        public X9Curve(
            X9FieldID fieldID,
            ASN1Sequence seq)
        {
            if (fieldID.getIdentifier().Equals(X9ObjectIdentifiers.prime_field))
            {
                BigInteger     q   = ((DERInteger)fieldID.getParameters()).getValue();
                X9FieldElement x9A = new X9FieldElement(true, q, (ASN1OctetString)seq.getObjectAt(0));
                X9FieldElement x9B = new X9FieldElement(true, q, (ASN1OctetString)seq.getObjectAt(1));
                curve = new ECCurve.Fp(q, x9A.getValue().toBigInteger(), x9B.getValue().toBigInteger());
            }
            else
            {
                throw new Exception("not implemented");
            }

            if (seq.size() == 3)
            {
                seed = ((DERBitString)seq.getObjectAt(2)).getBytes();
            }
        }
示例#2
0
        public X9ECParameters(
            ECCurve curve,
            ECPoint g,
            BigInteger n,
            BigInteger h,
            byte[]      seed)
        {
            this.curve = curve;
            this.g     = g;
            this.n     = n;
            this.h     = h;
            this.seed  = seed;

            if (curve is ECCurve.Fp)
            {
                this.fieldID = new X9FieldID(X9ObjectIdentifiers.prime_field, ((ECCurve.Fp)curve).getQ());
            }
            else
            {
                this.fieldID = new X9FieldID(X9ObjectIdentifiers.characteristic_two_field, null);
            }
        }