private void encryptButtonSum_Click(object sender, EventArgs e) { bool clearTextIsOK = false; bool keyIsOK = false; clearTextIsOK = checkTextBox(clearTextBoxSum, invalidClearTextLabelSum, "Nem adtál meg titkosítandó szöveget."); keyIsOK = checkTextBox(securityKeyTextBoxSum, invalidSecurityKeyLabelSum, "Nem adtál meg titkos kulcsot."); if (clearTextIsOK && keyIsOK) { StringBuilder s = new StringBuilder(clearTextBoxSum.Text.ToString()); encryptedTextLabelSumCaesar.Text = "Caesar: " + caesar.VigenereEncrypt(s, securityKeyTextBoxSum.Text).ToString(); encryptedTextLabelSumDES.Text = "DES: " + start(clearTextBoxSum.Text.ToUpper(), securityKeyTextBoxSum.Text.ToUpper(),false); rsa.RSA rsaAlgorithm = new rsa.RSA(); BigInteger encrypted = rsaAlgorithm.encrypt(System.Text.Encoding.UTF8.GetBytes(clearTextBoxSum.Text)); encryptedTextLabelSumRSA.Text = "RSA: " + encrypted.ToString(); encryptedTextLabelSumAES.Text = "AES: " + Convert.ToBase64String(aes.AESalgo.encrypt(GetBytes(clearTextBoxSum.Text), GetBytes(securityKeyTextBoxSum.Text))).ToString(); } }
private void encryptButtonRSA_Click(object sender, EventArgs e) { bool clearTextIsOK = false; clearTextIsOK = checkTextBox(clearTextBoxRSA, invalidClearTextLabelRSA, "Nem adtál meg titkosítandó szöveget."); if (clearTextIsOK) { rsa.RSA rsaAlgorithm = new rsa.RSA(); BigInteger encrypted = rsaAlgorithm.encrypt(System.Text.Encoding.UTF8.GetBytes(clearTextBoxRSA.Text)); encryptedTextLabelRSA.Text = encrypted.ToString(); playButtonRSA.Enabled = true; leftArrowButtonRSA.Enabled = true; rightArrowButtonRSA.Enabled = true; } }