Inheritance: Asn1Encodable
示例#1
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;
            }
        }
示例#2
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;
            }
        }
示例#3
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 x9Curve;

            if (seq[2] is X9Curve)
            {
                x9Curve = (X9Curve)seq[2];
            }
            else
            {
                x9Curve = new X9Curve(new X9FieldID((Asn1Sequence)seq[1]), (Asn1Sequence)seq[2]);
            }
            this.curve = x9Curve.Curve;
            if (seq[3] is X9ECPoint)
            {
                this.g = ((X9ECPoint)seq[3]).Point;
            }
            else
            {
                this.g = new X9ECPoint(this.curve, (Asn1OctetString)seq[3]).Point;
            }
            this.n    = ((DerInteger)seq[4]).Value;
            this.seed = x9Curve.GetSeed();
            if (seq.Count == 6)
            {
                this.h = ((DerInteger)seq[5]).Value;
            }
        }
示例#4
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();
        }
示例#5
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 x9c = new X9Curve(
                X9FieldID.GetInstance(seq[1]),
                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.n = ((DerInteger)seq[4]).Value;
            this.seed = x9c.GetSeed();

            if (seq.Count == 6)
            {
                this.h = ((DerInteger)seq[5]).Value;
            }
        }
示例#6
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 x9c = null;
            if (seq[2] is X9Curve)
            {
                x9c = (X9Curve) seq[2];
            }
            else
            {
                x9c = new X9Curve(
                    new X9FieldID(
                        (Asn1Sequence) seq[1]),
                        (Asn1Sequence) seq[2]);
            }

            this.curve = x9c.Curve;

            if (seq[3] is X9ECPoint)
            {
                this.g = ((X9ECPoint) seq[3]).Point;
            }
            else
            {
                this.g = new X9ECPoint(curve, (Asn1OctetString) seq[3]).Point;
            }

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

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