static void Main(string[] args) { WriteLine("暗号キーを5文字(アルファベット)入力して下さい"); var key = Console.ReadLine(); WriteLine("暗号化したテキストを入力して下さい"); var message = Console.ReadLine(); WriteLine("暗号化 Start"); var crypto = new RC2(key, message); crypto.Encrypt(); WriteLine("暗号化 End"); WriteLine(""); WriteLine(crypto.EncryptMessage); WriteLine(""); WriteLine(""); WriteLine("復号化 Start"); crypto.Decrypt(); WriteLine("復号化 End"); WriteLine(crypto.NomarlMessage); Console.ReadLine(); }
private void Button_Click(object sender, RoutedEventArgs e) { try { var iv = this.EncryptIv.Text; var key = this.EncryptCryptoKey.Text; var message = this.EncryptNomalMessage.Text; var crp = new RC2(key, message); crp.IV = iv; crp.Encrypt(); this.EncryptResult.Text = crp.EncryptMessage; }catch(Exception ex) { this.EncryptResult.Text = ex.Message; } }
private void Button_Click_1(object sender, RoutedEventArgs e) { try { var iv = this.DecryptIv.Text; var key = this.DecryptCryptoKey.Text; var cryptoMessage = this.DecryptCryptoMessage.Text; var crp = new RC2(key, ""); crp.IV = iv; crp.EncryptMessage = cryptoMessage; crp.Decrypt(); this.DecryptResult.Text = crp.NomarlMessage; } catch (Exception ex) { this.DecryptResult.Text = "Exception="+ex.Message; } }