VerifyData() public method

public VerifyData ( byte data, HashAlgorithm hasher, byte signature ) : bool
data byte
hasher System.Security.Cryptography.HashAlgorithm
signature byte
return bool
Exemplo n.º 1
0
        public bool IsValid(string productCode, string versionCode)
        {
            //System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();
            //timer.Start();

            // always pass BaseProductVerions in activation code IsValid
            if (RegCode == null || RegCode.IsExpired())
                return false;

            EZRSA ezrsa_public = new EZRSA(1024);
            ezrsa_public.FromXmlString(ProductKey);

            byte[] signatureBytes = new byte[128];
            for (int i = 0; i < 128; i++) {
                signatureBytes[i] = Convert.ToByte(ActivationCode.Substring(i * 2, 2), 16);
            }

            return ezrsa_public.VerifyData(Encoding.Unicode.GetBytes(Host + RegistrationCode + RegCode.R + productCode + versionCode), new SHA1CryptoServiceProvider(), signatureBytes);
        }