Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1.         public bool SHAValidateSign(string originalstring, byte[] fileSignature, byte[] pubKey)
  2.         {
  3.  
  4.             var cert = new X509Certificate2();
  5.             try
  6.             {
  7.                 cert = new X509Certificate2(pubKey, "");
  8.             }
  9.             catch (System.Security.Cryptography.CryptographicException e)
  10.             {
  11.                 var a = e.InnerException;
  12.             }
  13.  
  14.             var rsaCryptoIPT = (RSACryptoServiceProvider)cert.PublicKey.Key;
  15.             var sha1 = new SHA1CryptoServiceProvider();
  16.             ASCIIEncoding encoder = new ASCIIEncoding();
  17.  
  18.             return (!rsaCryptoIPT.VerifyData(encoder.GetBytes(originalstring), sha1, fileSignature));
  19.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement