Ejemplo n.º 1
0
 private void DoCheck()
 {
     checkLicenseButton.Enabled = false;
     SetProgressBarIndeterminateVisibility(true);
     checkLicenseButton.SetText(Resource.String.checking_license);
     checker.CheckAccess(this);
 }
            /// <summary>
            /// The run.
            /// </summary>
            public void Run()
            {
                this.context.IsServiceRunning = true;
                this.context.downloadNotification.OnDownloadStateChanged(DownloaderState.FetchingUrl);
                string deviceId = Settings.Secure.GetString(this.context.ContentResolver, Settings.Secure.AndroidId);

                var aep = new ApkExpansionPolicy(
                    this.context, new AesObfuscator(this.context.Salt, this.context.PackageName, deviceId));

                // reset our policy back to the start of the world to force a re-check
                aep.ResetPolicy();

                // let's try and get the OBB file from LVL first
                // Construct the LicenseChecker with a IPolicy.
                var checker = new LicenseChecker(this.context, aep, this.context.PublicKey);

                checker.CheckAccess(new ApkLicenseCheckerCallback(this, aep));
            }
Ejemplo n.º 3
0
        private void CheckLicense()
        {
            string deviceId = Settings.Secure.GetString(ContentResolver, Settings.Secure.AndroidId);

            // Construct the LicenseChecker with a policy.
            var obfuscator = new AesObfuscator(Salt, PackageName, deviceId);
            var policy     = new ServerManagedPolicy(this, obfuscator);

            _licenseChecker = new LicenseChecker(this, policy, Xamarin.InAppBilling.Utilities.Security.Unify(new[] {
                GetNumberString(3),
                GetNumberString(6),
                GetNumberString(1),
                GetNumberString(4),
                GetNumberString(2),
                GetNumberString(7),
                GetNumberString(0),
                GetNumberString(5)
            }, new[] { 0, 1, 2, 3, 4, 5, 6, 7 }));
            _licenseChecker.CheckAccess(this);
        }
Ejemplo n.º 4
0
        private void CheckLVL()
        {
            var salt = new byte[] { 28, 65, 30, 128, 103, 87, 74, 64, 51, 88, 95, 45, 91, 121, 36 };

            // create a app-unique identifer to prevent other apps from decrypting the responses
            var deviceInfoHelper = DependencyService.Resolve <IDeviceInfoHelper>();

            deviceInfoHelper.AppPackageName = this.PackageName;
            deviceInfoHelper.DeviceId       = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId);
            deviceInfoHelper.AppVersionName = this.ApplicationContext.PackageManager.GetPackageInfo(PackageName, 0).VersionName;

            // create the obfuscator that will read and write the saved responses,
            // passing the salt, the package name and the device identifier
            var obfuscator = new AESObfuscator(salt, deviceInfoHelper.AppPackageName, deviceInfoHelper.DeviceId);

            // create the policy, passing a Context and the obfuscator
            var policy = new ServerManagedPolicy(this, obfuscator);

            // create the checker
            var checker = new LicenseChecker(this, policy, ApiKey);

            // start the actual check, passing the callback
            checker.CheckAccess(this);
        }