Example #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 );
        }
        internal RSACryptoBackground( MainForm UseForm, RSACryptoWorkerInfo WInfo )
        {
            MForm = UseForm;

            DoWork += new DoWorkEventHandler( RSACryptoBackground_DoWork );
            ProgressChanged += new ProgressChangedEventHandler( RSACryptoBackground_ProgressChanged );
            RunWorkerCompleted += new RunWorkerCompletedEventHandler( RSACryptoBackground_RunWorkerCompleted );

            WorkerReportsProgress = true;
            WorkerSupportsCancellation = true;

            ProcessName = WInfo.ProcessName;
        }
        private void rSACryptoToolStripMenuItem_Click( object sender, EventArgs e )
        {
            Cancelled = false;

            RSACryptoWorkerInfo WInfo = new RSACryptoWorkerInfo();
            WInfo.ProcessName = "RSA Make Keys";
            RSACryptoBack = new RSACryptoBackground( MForm, WInfo );
            RSACryptoBack.RunWorkerAsync( WInfo );
        }