System.Security.Cryptography.DSACryptoServiceProvider.VerifyData C# (CSharp) Метод

VerifyData() публичный Метод

Verifies the specified signature data by comparing it to the signature computed for the specified data.
public VerifyData ( byte rgbData, byte rgbSignature ) : bool
rgbData byte The data that was signed.
rgbSignature byte The signature data to be verified.
Результат bool
        public bool VerifyData(byte[] rgbData, byte[] rgbSignature)
        {
            byte[] hashVal = _sha1.ComputeHash(rgbData);
            return VerifyHash(hashVal, null, rgbSignature);
        }

Usage Example

Пример #1
0
 public bool ChangeNick(string oldnick, string newnick, byte[] newnickhashed)
 {
     bool result = false;
     Chat instance = new Chat();
     instance.Deserialiser();
     User user = instance.SearchNick(oldnick);
     if (user != null) //si l'utilisateur actuel existe
     {
         if (instance.SearchNick(newnick) == null) //si le nouveau login choisi est bon
         {
             ASCIIEncoding encoding = new ASCIIEncoding();
             DSACryptoServiceProvider mycrypto = new DSACryptoServiceProvider();
             mycrypto.ImportParameters(user.Publickey);
             if (mycrypto.VerifyData(encoding.GetBytes(newnick), newnickhashed)) //verification de la provenance du message
             {
                 instance.RemoveUser(user);
                 user.Login = newnick;
                 instance.AddUser(user);
                 instance.Serialiser();
                 result = true;
             }
         }
     }
     return result;
 }
All Usage Examples Of System.Security.Cryptography.DSACryptoServiceProvider::VerifyData