Installation

READ Security limitations Before using if you actually value securing your data.
Assuming you are using Visual Studio 2010 Express Windows Phone addition
  1. Go here and download the latest dll.
  2. Add the dll to the references section of the project
    1. In visual studio, open the solution explorer and right click on references -> add.
    2. Click the file tab and add the dll as a reference.
    3. Follow the steps here to unlock the dll.
  3. add the following to the classes you want to use the encryption in.

using imichaelmiers.wp7.security.cryptography.PasswordProtectedStorage;

Usage

Store data

// Stores the value "bazValue" under the tag "barTag" and protects it with the password "fooPass"
// Don't hard code passwords and try not to use strings to store them 
PasswordProtectedStore.Store.Add("fooPass", "barTag", "bazValue");
PasswordProtectedStore.Store.Save(); // Saves the data to disk 

Get data

try
{
     string data = (string)PasswordProtectedStore.Store.Get(Password, Tag);
     this.Status = String.Format("Retrived {0}", data);
}
    catch (KeyNotFoundException)
{
    this.Status = String.Format("Not data stored under Tag {0}.", Tag);
}
    catch (CryptographicException e)
{
    this.Status = String.Format("error {0}", e.Message);
}

Remove data

PasswordProtectedStore.Store.Remove("barTag");
PasswordProtectedStore.Store.Save(); // Persists the delete.

Last edited Feb 19, 2011 at 9:45 PM by imichaelmiers, version 10

Comments

No comments yet.