private void makeKeysToolStripMenuItem_Click(object sender, EventArgs e) { Cancelled = false; // Make sure any previous stuff is closed. FreeEverything(); RSACrypto = new RSACryptoSystem(this); RSACrypto.MakeRSAKeys(); }
internal void FreeEverything() { if (IsDisposed) { return; } if (RSACrypto != null) { RSACrypto.FreeEverything(); RSACrypto = null; } }
private void RSACryptoBackground_DoWork(object sender, DoWorkEventArgs e) { if (CancellationPending) { return; } if (MForm.GetIsClosing()) { return; } BackgroundWorker Worker = (BackgroundWorker)sender; RSACryptoWorkerInfo WInfo = (RSACryptoWorkerInfo)(e.Argument); try // catch { if (Worker.CancellationPending) { e.Cancel = true; return; } RSACryptoSystem RSACrypto = new RSACryptoSystem(Worker, WInfo); RSACrypto.MakeRSAKeys(); RSACrypto.FreeEverything(); if (Worker.CancellationPending) { e.Cancel = true; return; } } catch (Exception Except) { Worker.ReportProgress(0, "Error in RSACryptoBackground DoWork process:"); Worker.ReportProgress(0, Except.Message); e.Cancel = true; } }