private void CheckUsingServerManagedPolicy() { //("MainActivity.CheckUsingServerManagedPolicy"); byte[] salt = new byte[15] { 46, 65, 30, 128, 103, 57, 74, 64, 51, 88, 95, 45, 77, 117, 36 }; string packageName = this.PackageName; string @string = Settings.Secure.GetString(this.ContentResolver, "android_id"); AESObfuscator obfuscator = new AESObfuscator(salt, packageName, @string); ServerManagedPolicy policy = new ServerManagedPolicy(this, obfuscator); this._licenseChecker = new LicenseChecker(this, policy, "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAry4fecehDpCohQk4XhiIZX9ylIGUThWZxfN9qwvQyTh53hvnpQl/lCrjfflKoPz6gz5jJn6JI1PTnoBy/iXVx1+kbO99qBgJE2V8PS5pq+Usbeqqmqqzx4lEzhiYQ2um92v4qkldNYZFwbTODYPIMbSbaLm7eK9ZyemaRbg9ssAl4QYs0EVxzDK1DjuXilRk28WxiK3lNJTz4cT38bfs4q6Zvuk1vWUvnMqcxiugox6c/9j4zZS5C4+k+WY6mHjUMuwssjCY3G+aImWDSwnU3w9G41q8EoPvJ1049PIi7GJXErusTYZITmqfonyejmSFLPt8LHtux9AmJgFSrC3UhwIDAQAB"); this._licenseChecker.CheckAccess(this); }
public override void SetUp() { var salt = new byte[] { 104, 12, 112, 82, 85, 10, 11, 61, 15, 54, 44, 66, 117, 89, 64, 110, 53, 123, 33 }; string deviceId = Settings.Secure.GetString(Context.ContentResolver, Settings.Secure.AndroidId); this.policy = new ServerManagedPolicy(Context, new AesObfuscator(salt, Context.PackageName, deviceId)); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); RequestWindowFeature(WindowFeatures.IndeterminateProgress); SetContentView(Resource.Layout.Main); // Try to use more data here. ANDROID_ID is a single point of attack. 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); checker = new LicenseChecker(this, policy, Base64PublicKey); checkLicenseButton = FindViewById <Button>(Resource.Id.checkButton); checkLicenseButton.Click += delegate { DoCheck(); }; DoCheck(); }
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); }
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); }