private void ComputeButton_Click(object sender, EventArgs e) { MACHandler mh = new MACHandler(algorithmSelectionBox.Text); byte[] mac = mh.ComputeMAC(myConverter.StringToByteArray(PlainTextASCIIButton.Text), myConverter.StringToByteArray(KeyASCIIButton.Text)); MACASCIIButton.Text = myConverter.ByteArrayToString(mac); MACHEXButton.Text = myConverter.ByteArrayToHexString(mac); }
private void VerifyMacButtoon_Click(object sender, EventArgs e) { MACHandler mh = new MACHandler(algorithmSelectionBox.Text); if (mh.CheckAuthenticity(myConverter.StringToByteArray(PlainTextASCIIButton.Text), myConverter.HexStringToByteArray(MACHEXButton.Text), myConverter.StringToByteArray(KeyASCIIButton.Text)) == true) { System.Windows.Forms.MessageBox.Show("MAC er validt"); } else { System.Windows.Forms.MessageBox.Show("MAC er ikke validt"); } }