Esempio n. 1
0
        public static bool VerifyPcSign()
        {
            string cpuSerialNo  = getSeralNo();
            bool   renderResult = DGyption.VerifySign(Convert.FromBase64String(cpuSerialNo));

            renderResult = IsValidateX(cpuSerialNo); //---------------------------------------------------
            return(renderResult);
        }
Esempio n. 2
0
        public static bool VerifySign(byte[] content)
        {
            string Serial  = Convert.ToBase64String(content);
            string sysPath = Environment.ExpandEnvironmentVariables("%systemdrive%");
            string sFile   = Path.Combine(sysPath + "\\ApplicationAuthoriztion.key");

            if (!File.Exists(sFile))
            {
                string appPath = Environment.CurrentDirectory;
                sFile = Path.Combine(appPath + "\\ApplicationAuthoriztion.key");
            }
            if (File.Exists(sFile))
            {
                try
                {
                    using (StreamReader reader = new StreamReader(sFile))
                    {
                        string signDataFromFile = "";
                        while (!reader.EndOfStream)
                        {
                            signDataFromFile += reader.ReadLine();
                        }
                        if (signDataFromFile != string.Empty || signDataFromFile.Length < 10)
                        {
                            bool verifiedResult = DGyption.VerifySign(Serial, signDataFromFile);
                            if (verifiedResult)
                            {
                                //---------------------------------------
                                bool renderResult = true;
                                renderResult = IsValidateX(Serial);
                                return(renderResult);
                            }
                            else
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }
                catch
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }