示例#1
0
        public RsaSecretBcpgKey(
            BigInteger d,
            BigInteger p,
            BigInteger q)
        {
            // PGP requires (p < q)
            int cmp = p.CompareTo(q);

            if (cmp >= 0)
            {
                if (cmp == 0)
                {
                    throw new ArgumentException("p and q cannot be equal");
                }

                BigInteger tmp = p;
                p = q;
                q = tmp;
            }

            this.d = new MPInteger(d);
            this.p = new MPInteger(p);
            this.q = new MPInteger(q);
            this.u = new MPInteger(p.ModInverse(q));

            this.expP = d.Remainder(p.Subtract(BigInteger.One));
            this.expQ = d.Remainder(q.Subtract(BigInteger.One));
            this.crt  = q.ModInverse(p);
        }
		public RsaSecretBcpgKey(
			BigInteger d,
			BigInteger p,
			BigInteger q)
		{
			// PGP requires (p < q)
			int cmp = p.CompareTo(q);
			if (cmp >= 0)
			{
				if (cmp == 0)
					throw new ArgumentException("p and q cannot be equal");

				BigInteger tmp = p;
				p = q;
				q = tmp;
			}

			this.d = new MPInteger(d);
			this.p = new MPInteger(p);
			this.q = new MPInteger(q);
			this.u = new MPInteger(p.ModInverse(q));

			this.expP = d.Remainder(p.Subtract(BigInteger.One));
			this.expQ = d.Remainder(q.Subtract(BigInteger.One));
			this.crt = q.ModInverse(p);
		}
示例#3
0
        public RsaSecretBcpgKey(
			BigInteger d,
			BigInteger p,
			BigInteger q)
        {
            // pgp requires (p < q)
            if (p.CompareTo(q) > 0)
            {
                BigInteger tmp = p;
                p = q;
                q = tmp;
            }

            this.d = new MPInteger(d);
            this.p = new MPInteger(p);
            this.q = new MPInteger(q);
            this.u = new MPInteger(p.ModInverse(q));
            this.expP = d.Remainder(p.Subtract(BigInteger.One));
            this.expQ = d.Remainder(q.Subtract(BigInteger.One));
            this.crt = q.ModInverse(p);
        }
        public RsaSecretBcpgKey(
            BigInteger d,
            BigInteger p,
            BigInteger q)
        {
            // pgp requires (p < q)
            if (p.CompareTo(q) > 0)
            {
                BigInteger tmp = p;
                p = q;
                q = tmp;
            }

            this.d    = new MPInteger(d);
            this.p    = new MPInteger(p);
            this.q    = new MPInteger(q);
            this.u    = new MPInteger(p.ModInverse(q));
            this.expP = d.Remainder(p.Subtract(BigInteger.One));
            this.expQ = d.Remainder(q.Subtract(BigInteger.One));
            this.crt  = q.ModInverse(p);
        }
示例#5
0
        public RsaSecretBcpgKey(BigInteger d, BigInteger p, BigInteger q)
        {
            int num = p.CompareTo(q);

            if (num >= 0)
            {
                if (num == 0)
                {
                    throw new ArgumentException("p and q cannot be equal");
                }
                BigInteger bigInteger = p;
                p = q;
                q = bigInteger;
            }
            this.d    = new MPInteger(d);
            this.p    = new MPInteger(p);
            this.q    = new MPInteger(q);
            this.u    = new MPInteger(p.ModInverse(q));
            this.expP = d.Remainder(p.Subtract(BigInteger.One));
            this.expQ = d.Remainder(q.Subtract(BigInteger.One));
            this.crt  = q.ModInverse(p);
        }
        public RsaSecretBcpgKey(BigInteger d, BigInteger p, BigInteger q)
        {
            //IL_001a: Unknown result type (might be due to invalid IL or missing references)
            int num = p.CompareTo(q);

            if (num >= 0)
            {
                if (num == 0)
                {
                    throw new ArgumentException("p and q cannot be equal");
                }
                BigInteger bigInteger = p;
                p = q;
                q = bigInteger;
            }
            this.d = new MPInteger(d);
            this.p = new MPInteger(p);
            this.q = new MPInteger(q);
            u      = new MPInteger(p.ModInverse(q));
            expP   = d.Remainder(p.Subtract(BigInteger.One));
            expQ   = d.Remainder(q.Subtract(BigInteger.One));
            crt    = q.ModInverse(p);
        }