Beispiel #1
0
        bool DoDecrypt(ITrack track, string serverCert)
        {
            var config = new DecryptConfig(Filename, track.GetTrackType(), track.Id, Config.License, null, track.InitDataB64, serverCert);

            string encryptedName = track.GetFilename(Filename, false, false);
            string decryptedName = track.GetFilename(Filename, true, false);

            Cleanup.Add(track.GetFilename(Filename, true, false));

            int retries = 0;

            while (retries < 10)
            {
                Decrypter decrypt = new Decrypter(config);

                var challenge = decrypt.GetChallenge();

                string licenseB64 = Client.GetLicense(challenge);

                if (licenseB64 == null)
                {
                    retries++;
                    continue;
                }

                if (!decrypt.UpdateLicense(licenseB64))
                {
                    retries++;
                    continue;
                }

                decrypt.StartProcess();

                if (File.Exists(encryptedName) && File.Exists(decryptedName) && !Config.SkipCleanup)
                {
                    File.Delete(encryptedName);
                }

                return(true);
            }
            return(false);
        }