public override void Decrypt(string inputPath, string outputPath) { var file = ReadFile(inputPath); RsaKey decryptKey = RsaKeyManager.GetRsaKey(rsaKeyPath); BigInteger _d = decryptKey.FirstPart; BigInteger _n = decryptKey.SecondPart; int sizePart = GetPartKeyLength(_n); IncreaseByteArray(ref file, sizePart); RunDecrypt(outputPath, file.Length, sizePart, ref file, _d, _n); }
public override void Encrypt(string inputPath, string outputPath) { byte[] file = ReadFile(inputPath); RsaKey encryptKey = RsaKeyManager.GetRsaKey(rsaKeyPath); BigInteger _e = encryptKey.FirstPart; BigInteger _n = encryptKey.SecondPart; int sizePart = GetPartKeyLength(_n); IncreaseByteArray(ref file, sizePart - 1); RunEncrypt(outputPath, file.Length, sizePart, ref file, _e, _n); }
private void CreateKeysButton_Click(object sender, EventArgs e) { int sizeKey = int.Parse(keySizeBox.Text); RsaKeyManager keyManager = new RsaKeyManager(sizeKey); string publicKeyPath = ""; string privateKeyPath = ""; try { ShowSaveKeysDialogs(ref publicKeyPath, ref privateKeyPath); } catch { WriteActionLog("Пути сохранения ключей указаны некорректно.", true); return; } keyManager.KMNotify += ShowSaveKeysMessage; keyManager.SaveKeysAsync(publicKeyPath, privateKeyPath); }