private void cipherForm_Cipher(object sender, EventArgs e) { if (environmentHelper.FileExists(cipherForm.OutputFileName)) { var dialogResult = messageHelper.Show("RSA file already exists. Would you like to overwrite it?", "RSA файл уже существует. Вы действительно хотите перезаписать его?", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.No) { return; } } cipherForm.CipherEnabled = false; try { publicKey = keySerializer.DeserializePublicKey(cipherForm.PublicKey); } catch (KeySerializationException) { messageHelper.Show("Public key has errors.", "Открытый ключ имеет ошибки."); return; } options.ZipСompression = cipherForm.ZipСompression; if (rsaFileCipher != null) { rsaFileCipher.BlockCompleted -= cipher_BlockCompleted; } rsaFileCipher = rsaFactory.CreateRsaFileCipher(); rsaFileCipher.BlockCompleted += cipher_BlockCompleted; RefreshThread(); thread.Start(); }
public void DeserializePublicKey_LineIsNull() { Assert.Throws(typeof(ArgumentNullException), () => serializer.DeserializePublicKey(null)); }