System.Security.Cryptography.DSACryptoServiceProvider.VerifySignature C# (CSharp) Method

VerifySignature() public method

public VerifySignature ( byte rgbHash, byte rgbSignature ) : bool
rgbHash byte
rgbSignature byte
return bool
        public override bool VerifySignature(byte[] rgbHash, byte[] rgbSignature)
        {
            return VerifyHash(rgbHash, null, rgbSignature);
        }

Usage Example

        /*private void GenerateLicense() {
            DSA dsa = new DSACryptoServiceProvider();
            dsa.FromXmlString(PrivateKey);

            string vfyhash =
                "Sam Bacsa" +
                "netMercs Group" +
                "Unlimited" +
                "CMS-102022-00UL" +
                "Never" +
                "1.2" +
                "1.3";

            // Grab all the featurebits
            foreach (bool val in _features.Values)
                vfyhash += val.ToString();

            // Hash it and get the result
            string hash = Convert.ToBase64String(dsa.CreateSignature(Convert.FromBase64String(CConfig.SHA1(vfyhash))));
        }*/
        private bool VerifyLicense()
        {
            // Verifies the loaded license details to see if they
            // check out
            g.LogDebug("LicenseManager::VerifyLicense: Enter");

            g.LogDebug("LicenseManager::VerifyLicense: Loading DSA object and public key");
            DSA dsa = new DSACryptoServiceProvider();
            dsa.FromXmlString(PublicKey);

            g.LogDebug("LicenseManager::VerifyLicense: Object loaded.  Key is " + PublicKey);

            string vfyhash = _user + _company + _limit + _serial + ((_expires.Year == 1) ? "Never" : _expires.ToString())
                    + _version.ToString() + _version_limit.ToString();

            // Load the feature bits
            foreach (bool val in _features.Values)
                vfyhash += val.ToString();

            g.LogDebug("LicenseManager::VerifyLicense: vfyhash is " + vfyhash);
            g.LogDebug("LicenseManager::VerifyLicense: Verifying signature");

            bool result = dsa.VerifySignature(
                    Convert.FromBase64String(CConfig.SHA1(vfyhash)),
                    Convert.FromBase64String(_signature)
            );

            g.LogDebug("LicenseManager::VerifyLicense: Result of signature verification is: " + result.ToString());
            g.LogDebug("LicenseManager::VerifyLicense: Leave");

            return result;
        }
All Usage Examples Of System.Security.Cryptography.DSACryptoServiceProvider::VerifySignature