Esempio n. 1
0
        public X9ECParameters(Asn1Sequence seq)
        {
            //IL_0036: Unknown result type (might be due to invalid IL or missing references)
            if (!(seq[0] is DerInteger) || !((DerInteger)seq[0]).Value.Equals(BigInteger.One))
            {
                throw new ArgumentException("bad version in X9ECParameters");
            }
            X9Curve x9Curve = new X9Curve(X9FieldID.GetInstance(seq[1]), Asn1Sequence.GetInstance(seq[2]));

            curve = x9Curve.Curve;
            object obj = seq[3];

            if (obj is X9ECPoint)
            {
                g = (X9ECPoint)obj;
            }
            else
            {
                g = new X9ECPoint(curve, (Asn1OctetString)obj);
            }
            n    = ((DerInteger)seq[4]).Value;
            seed = x9Curve.GetSeed();
            if (seq.Count == 6)
            {
                h = ((DerInteger)seq[5]).Value;
            }
        }
Esempio n. 2
0
        public X9ECParameters(Asn1Sequence seq)
        {
            if (!(seq[0] is DerInteger) || !((DerInteger)seq[0]).Value.Equals(BigInteger.One))
            {
                throw new ArgumentException("bad version in X9ECParameters");
            }
            X9Curve curve = new X9Curve(X9FieldID.GetInstance(seq[1]), Asn1Sequence.GetInstance(seq[2]));

            this.curve = curve.Curve;
            object obj2 = seq[3];

            if (obj2 is X9ECPoint)
            {
                this.g = (X9ECPoint)obj2;
            }
            else
            {
                this.g = new X9ECPoint(this.curve, (Asn1OctetString)obj2);
            }
            this.n    = ((DerInteger)seq[4]).Value;
            this.seed = curve.GetSeed();
            if (seq.Count == 6)
            {
                this.h = ((DerInteger)seq[5]).Value;
            }
        }
Esempio n. 3
0
        public X9ECParameters(
            Asn1Sequence seq)
        {
            if (!(seq[0] is DerInteger) ||
                !((DerInteger)seq[0]).HasValue(1))
            {
                throw new ArgumentException("bad version in X9ECParameters");
            }

            this.n = ((DerInteger)seq[4]).Value;

            if (seq.Count == 6)
            {
                this.h = ((DerInteger)seq[5]).Value;
            }

            X9Curve x9c = new X9Curve(
                X9FieldID.GetInstance(seq[1]), n, h,
                Asn1Sequence.GetInstance(seq[2]));

            this.curve = x9c.Curve;
            object p = seq[3];

            if (p is X9ECPoint)
            {
                this.g = (X9ECPoint)p;
            }
            else
            {
                this.g = new X9ECPoint(curve, (Asn1OctetString)p);
            }

            this.seed = x9c.GetSeed();
        }