Ejemplo n.º 1
0
 public bool VerifySignature(string filePath)
 {
     using (SHA256 mySHA = SHA256.Create())
     {
         FileStream file = new FileStream(filePath, FileMode.Open);
         Hash = mySHA.ComputeHash(file);
         file.Close();
     }
     using (SHA256 mySHA = SHA256.Create())
     {
         byte[] temp;
         for (int i = 0; i < 256; i++)
         {
             temp = Support.SubArray(Signature, 32 * i, 32); //substract 256bit number(32*8)
             temp = mySHA.ComputeHash(temp);                 //hashing
             for (int j = 0; j < 32; j++)                    //putting into public key variable
             {
                 Signature[32 * i + j] = temp[j];
             }
         }
     }
     //compare ChooseBytes(Hash) and new signature
     return(Signature.SequenceEqual(ChooseBytes(Hash)));
 }