// Show how to use Password Based Helper public void SetupPasswordBasedTesting() { // Grab the buttons var saveButton = FindViewById <Button>(Resource.Id.saveButton); var getButton = FindViewById <Button>(Resource.Id.getButton); var deleteButton = FindViewById <Button>(Resource.Id.deleteButton); var deleteAllButton = FindViewById <Button>(Resource.Id.deleteAllButton); // Remove unused inputs var radioGroup = FindViewById <RadioGroup>(Resource.Id.radioGroup1); var parent = FindViewById <LinearLayout>(Resource.Id.linearLayout1); parent.RemoveView(radioGroup); // Janky add listeners to buttons saveButton.Click += (o, e) => { var key = FindViewById <EditText>(Resource.Id.storedKeyText).Text; var password = FindViewById <EditText>(Resource.Id.storedMessageText).Text; var helper = new PasswordBasedKeyHelper(key); helper.CreateKey(password, "*****@*****.**"); var encryptedData = helper.EncryptData("Password based key creation success"); Print(helper.DecryptData(encryptedData)); }; getButton.Click += (o, e) => { var key = FindViewById <EditText>(Resource.Id.storedKeyText).Text; var helper = new PasswordBasedKeyHelper(key); var encryptedData = helper.EncryptData("Password based key retrieved success"); Print(helper.DecryptData(encryptedData)); }; deleteButton.Click += (o, e) => { var key = FindViewById <EditText>(Resource.Id.storedKeyText).Text; var helper = new PasswordBasedKeyHelper(key); Print(helper.DeleteKey().ToString()); }; deleteAllButton.Click += (o, e) => { var storageHelper = new SecureStorageHelper(); storageHelper.RemoveAllItems(); }; // Grab the text inputs var nameInput = FindViewById <EditText>(Resource.Id.storedKeyText); var messageInput = FindViewById <EditText>(Resource.Id.storedMessageText); // Set prompts nameInput.Hint = "Password based key alias"; messageInput.Hint = "Password"; }