Ejemplo n.º 1
0
        internal RSACryptoSystem( BackgroundWorker UseWorker, RSACryptoWorkerInfo UseWInfo )
        {
            Worker = UseWorker;
            WorkerInfo = UseWInfo;
            StartTime = new ECTime();
            StartTime.SetToNow();

            RngCsp = new RNGCryptoServiceProvider();
            IntMath = new IntegerMath();
            IntMathNewForP = new IntegerMathNew( IntMath );
            IntMathNewForQ = new IntegerMathNew( IntMath );

            Worker.ReportProgress( 0, IntMath.GetStatusString() );
            Quotient = new Integer();
            Remainder = new Integer();
            PrimeP = new Integer();
            PrimeQ = new Integer();
            PrimePMinus1 = new Integer();
            PrimeQMinus1 = new Integer();
            PubKeyN = new Integer();
            PubKeyExponent = new Integer();
            PrivKInverseExponent = new Integer();
            PrivKInverseExponentDP = new Integer();
            PrivKInverseExponentDQ = new Integer();
            QInv = new Integer();
            PhiN = new Integer();
            TestForDecrypt = new Integer();
            M1ForInverse = new Integer();
            M2ForInverse = new Integer();
            HForQInv = new Integer();
            M1MinusM2 = new Integer();
            M1M2SizeDiff = new Integer();

            PubKeyExponent.SetFromULong( PubKeyExponentUint );
        }
Ejemplo n.º 2
0
        internal IntegerMath()
        {
            IntMathNew = new IntegerMathNew( this );

            SignedD = new long[Integer.DigitArraySize];
            M = new ulong[Integer.DigitArraySize, Integer.DigitArraySize];
            Scratch = new ulong[Integer.DigitArraySize];

            // These numbers are created ahead of time so that they don't have
            // to be created over and over again within a loop where the
            // calculations are being done.
            ToDivide = new Integer();
            Quotient = new Integer();
            Remainder = new Integer();
            ToDivideKeep = new Integer();
            DivideByKeep = new Integer();
            DivideBy = new Integer();
            TestForDivide1 = new Integer();
            TempAdd1 = new Integer();
            TempAdd2 = new Integer();
            TempSub1 = new Integer();
            TempSub2 = new Integer();
            TempX = new Integer();
            TempY = new Integer();
            GcdX = new Integer();
            GcdY = new Integer();
            TestForModInverse1 = new Integer();
            TestForModInverse2 = new Integer();
            U0 = new Integer();
            U1 = new Integer();
            U2 = new Integer();
            V0 = new Integer();
            V1 = new Integer();
            V2 = new Integer();
            T0 = new Integer();
            T1 = new Integer();
            T2 = new Integer();
            SubtractTemp1 = new Integer();
            SubtractTemp2 = new Integer();
            Fermat1 = new Integer();
            Fermat2 = new Integer();
            TestFermat = new Integer();
            TempEuclid1 = new Integer();
            TempEuclid2 = new Integer();
            TempEuclid3 = new Integer();
            TestForBits = new Integer();
            OriginalValue = new Integer();
            TestForSquareRoot = new Integer();
            SqrtXPartTest1 = new Integer();
            SqrtXPartTest2 = new Integer();
            SqrtXPartDiff = new Integer();
            SqrtXPartR2 = new Integer();
            SqrtXPartTwoB = new Integer();

            MakePrimeArray();
        }