Microsoft.HockeyApp.AuthManager.StoreStringProtected C# (CSharp) Method

StoreStringProtected() public method

Store data encrypted in the isolatedStorage
public StoreStringProtected ( string dataIdentifier, string data ) : void
dataIdentifier string identifier for the data to write
data string the data to store
return void
        public void StoreStringProtected(string dataIdentifier, string data)
        {
            byte[] protectedData = ProtectedData.Protect(Encoding.UTF8.GetBytes(data), Encoding.UTF8.GetBytes("hockeyAppIsCool"));

            IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication();
            using (IsolatedStorageFileStream writestream = new IsolatedStorageFileStream(dataIdentifier + ".crypt", FileMode.Create, FileAccess.Write, file))
            {
                using (Stream writer = new StreamWriter(writestream).BaseStream)
                {
                    writer.Write(protectedData, 0, protectedData.Length);
                }
            }
        }