Example #1
0
 public Task <string> ProtectData(string plainText)
 {
     return(Task <string> .Run(() =>
     {
         string cipherText = AndroidKeyStore.EncryptAndBase64Encode(
             ANDROIDKEYSTORE_ALIAS,
             plainText);
         return (cipherText);
     }));
 }
Example #2
0
        public void StoreCredential(
            string key,
            string username,
            string password,
            bool removeFirst)
        {
            if (removeFirst)
            {
                RemovePassword(key);
            }
            string  aliasKey  = String.Format("cachy.{0}", key);
            JObject credsJSON = new JObject
            {
                { "UserName", new JValue(username) },
                { "Password", new JValue(password) }
            };
            string credsPlainText = credsJSON.ToString(Newtonsoft.Json.Formatting.None);
            string cipherText     = AndroidKeyStore.EncryptAndBase64Encode(aliasKey, credsPlainText);

            Configuration.SetValue <string>(key, cipherText);
        }