private void StoreHashedCredentials(Account account) { string accountJson = JsonConvert.SerializeObject(account); //Convert Password and Salt values to byte[] arrays byte[] accountByte = Encoding.UTF8.GetBytes(accountJson); //Encrypt Password and Salt byte[] arrays using Protect() method byte[] protectedAccountByte = ProtectedData.Protect(accountByte, null); //Save byte[] arrays as two files in Isolated Storage SaveToFile(protectedAccountByte, CREDFILE); }
public void SaveCredentials(string userName, string password) { if (!string.IsNullOrWhiteSpace(userName) && !string.IsNullOrWhiteSpace(password)) { Account account = new Account() { UserName = userName, Password = password}; StoreHashedCredentials(account); } }