public bool Validate(string file, byte[] sign) { HashAFile haf = new HashAFile(file); byte[] hash = haf.HashFile(); bool test = globaLrsa.VerifyHash(hash, CryptoConfig.MapNameToOID(globalHashAlgo), sign); return(test); }
private void button_send_Click(object sender, EventArgs e) { string file = textBox_file.Text; if (0 == file.Length) { label_ins.ForeColor = System.Drawing.Color.Red; HashAFile haf = new HashAFile(file); return; } HashAFile hash = new HashAFile(file); byte[] hashbytes = hash.HashFile(); if (0 == hashbytes.Length) { label_ins.Text = "Failed to hash the file" + file; return; } string temp = ""; foreach (byte hashbyte in hashbytes) { temp = temp + " " + hashbyte; } richTextBox_hash_value.Text = "Hash/Message Digest :" + temp; global_hashvalue = hashbytes; if (false == hash.CreateHashFile(file + "1")) { label_ins.Text = "Failed to create the hash file "; return; } }