Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,45 +34,27 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Cirrious.CrossCore">
<HintPath>..\packages\MvvmCross.HotTuna.CrossCore.3.1.1\lib\MonoAndroid\Cirrious.CrossCore.dll</HintPath>
</Reference>
<Reference Include="Cirrious.CrossCore.Droid">
<HintPath>..\packages\MvvmCross.HotTuna.CrossCore.3.1.1\lib\MonoAndroid\Cirrious.CrossCore.Droid.dll</HintPath>
</Reference>
<Reference Include="Cirrious.MvvmCross">
<HintPath>..\packages\MvvmCross.HotTuna.MvvmCrossLibraries.3.1.1\lib\MonoAndroid\Cirrious.MvvmCross.dll</HintPath>
</Reference>
<Reference Include="Cirrious.MvvmCross.Binding">
<HintPath>..\packages\MvvmCross.HotTuna.CrossCore.3.1.1\lib\MonoAndroid\Cirrious.MvvmCross.Binding.dll</HintPath>
</Reference>
<Reference Include="Cirrious.MvvmCross.Binding.Droid">
<HintPath>..\packages\MvvmCross.HotTuna.CrossCore.3.1.1\lib\MonoAndroid\Cirrious.MvvmCross.Binding.Droid.dll</HintPath>
</Reference>
<Reference Include="Cirrious.MvvmCross.Droid">
<HintPath>..\packages\MvvmCross.HotTuna.MvvmCrossLibraries.3.1.1\lib\MonoAndroid\Cirrious.MvvmCross.Droid.dll</HintPath>
</Reference>
<Reference Include="Cirrious.MvvmCross.Localization">
<HintPath>..\packages\MvvmCross.HotTuna.CrossCore.3.1.1\lib\MonoAndroid\Cirrious.MvvmCross.Localization.dll</HintPath>
</Reference>
<Reference Include="Mono.Android" />
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Net, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\MvvmCross.PortableSupport.3.1.1\lib\MonoAndroid\System.Net.dll</HintPath>
</Reference>
<Reference Include="System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\MvvmCross.PortableSupport.3.1.1\lib\MonoAndroid\System.Windows.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Serialization, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\MvvmCross.PortableSupport.3.1.1\lib\MonoAndroid\System.Xml.Serialization.dll</HintPath>
</Reference>
<Reference Include="System.Net, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmCross.PortableSupport.3.1.1\lib\MonoAndroid\System.Net.dll</HintPath>
</Reference>
<Reference Include="MvvmCross.Platform.Droid">
<HintPath>..\packages\MvvmCross.Platform.4.1.0\lib\MonoAndroid\MvvmCross.Platform.Droid.dll</HintPath>
</Reference>
<Reference Include="MvvmCross.Platform">
<HintPath>..\packages\MvvmCross.Platform.4.1.0\lib\MonoAndroid\MvvmCross.Platform.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="MvxAndroidProtectedData.cs" />
Expand All @@ -81,9 +63,9 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="Resources\AboutResources.txt" />
<None Include="SecureStoragePluginBootstrap.cs.pp" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\Values\Strings.xml" />
Expand Down
4 changes: 2 additions & 2 deletions Beezy.MvvmCross.Plugins.SecureStorage.Droid/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// MvvmCross - Secure Storage Plugin is licensed using Microsoft Public License (Ms-PL)
//

using Cirrious.CrossCore;
using Cirrious.CrossCore.Plugins;
using MvvmCross.Platform.Plugins;
using MvvmCross.Platform;

namespace Beezy.MvvmCross.Plugins.SecureStorage.Droid
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions Beezy.MvvmCross.Plugins.SecureStorage.Droid/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MvvmCross.HotTuna.CrossCore" version="3.1.1" targetFramework="MonoAndroid22" />
<package id="MvvmCross.HotTuna.MvvmCrossLibraries" version="3.1.1" targetFramework="MonoAndroid22" />
<package id="MvvmCross.PortableSupport" version="3.1.1" targetFramework="MonoAndroid22" />
<package id="MvvmCross.Platform" version="4.1.0" targetFramework="MonoAndroid23" />
</packages>
Original file line number Diff line number Diff line change
@@ -1,87 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{986D1130-0344-42D3-A927-2AFA2E4908C3}</ProjectGuid>
<ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{7693A6D0-0A34-4834-9C1E-DD1197B5449D}</ProjectGuid>
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<RootNamespace>Beezy.MvvmCross.Plugins.SecureStorage.Touch</RootNamespace>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
<AssemblyName>Beezy.MvvmCross.Plugins.SecureStorage.Touch</AssemblyName>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<MtouchDebug>true</MtouchDebug>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchUseSGen>true</MtouchUseSGen>
<MtouchUseRefCounting>true</MtouchUseRefCounting>
<MtouchLink></MtouchLink>
<MtouchHttpClientHandler></MtouchHttpClientHandler>
<MtouchTlsProvider></MtouchTlsProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<OutputPath>bin\Release</OutputPath>
<DefineConstants></DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchUseSGen>true</MtouchUseSGen>
<MtouchUseRefCounting>true</MtouchUseRefCounting>
<MtouchLink></MtouchLink>
<MtouchHttpClientHandler></MtouchHttpClientHandler>
<MtouchTlsProvider></MtouchTlsProvider>
</PropertyGroup>
<ItemGroup>
<Compile Include="MvxTouchProtectedData.cs" />
<Compile Include="Plugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.iOS" />
<Reference Include="MvvmCross.Platform.iOS">
<HintPath>..\packages\MvvmCross.Platform.4.1.0\lib\Xamarin.iOS10\MvvmCross.Platform.iOS.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="MvvmCross.Platform">
<HintPath>..\packages\MvvmCross.Platform.4.1.0\lib\Xamarin.iOS10\MvvmCross.Platform.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="SecureStoragePluginBootstrap.cs.pp" />
<Folder Include="Resources\" />
</ItemGroup>
<ItemGroup>
<Reference Include="Cirrious.CrossCore">
<HintPath>..\packages\MvvmCross.HotTuna.CrossCore.3.1.1\lib\MonoTouch\Cirrious.CrossCore.dll</HintPath>
</Reference>
<Reference Include="Cirrious.CrossCore.Touch">
<HintPath>..\packages\MvvmCross.HotTuna.CrossCore.3.1.1\lib\MonoTouch\Cirrious.CrossCore.Touch.dll</HintPath>
</Reference>
<Reference Include="Cirrious.MvvmCross">
<HintPath>..\packages\MvvmCross.HotTuna.MvvmCrossLibraries.3.1.1\lib\MonoTouch\Cirrious.MvvmCross.dll</HintPath>
</Reference>
<Reference Include="Cirrious.MvvmCross.Binding">
<HintPath>..\packages\MvvmCross.HotTuna.CrossCore.3.1.1\lib\MonoTouch\Cirrious.MvvmCross.Binding.dll</HintPath>
</Reference>
<Reference Include="Cirrious.MvvmCross.Binding.Touch">
<HintPath>..\packages\MvvmCross.HotTuna.CrossCore.3.1.1\lib\MonoTouch\Cirrious.MvvmCross.Binding.Touch.dll</HintPath>
</Reference>
<Reference Include="Cirrious.MvvmCross.Localization">
<HintPath>..\packages\MvvmCross.HotTuna.CrossCore.3.1.1\lib\MonoTouch\Cirrious.MvvmCross.Localization.dll</HintPath>
</Reference>
<Reference Include="Cirrious.MvvmCross.Touch">
<HintPath>..\packages\MvvmCross.HotTuna.MvvmCrossLibraries.3.1.1\lib\MonoTouch\Cirrious.MvvmCross.Touch.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="monotouch" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="MvxTouchProtectedData.cs" />
<Compile Include="Plugin.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Beezy.MvvmCross.Plugins.SecureStorage\Beezy.MvvmCross.Plugins.SecureStorage.csproj">
<Project>{b58c3994-4663-4c3a-ab28-f82b3db1be99}</Project>
<Project>{B58C3994-4663-4C3A-AB28-F82B3DB1BE99}</Project>
<Name>Beezy.MvvmCross.Plugins.SecureStorage</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,48 @@
// MvvmCross - Secure Storage Plugin is licensed using Microsoft Public License (Ms-PL)
//

using MonoTouch.Foundation;
using MonoTouch.Security;
using Foundation;
using Security;

namespace Beezy.MvvmCross.Plugins.SecureStorage.Touch
{
public class MvxTouchProtectedData : IMvxProtectedData
{
public void Protect(string key, string value)
{
SecKeyChain.Add(new SecRecord(SecKind.GenericPassword)
{
Service = NSBundle.MainBundle.BundleIdentifier,
Account = key,
ValueData = NSData.FromString(value, NSStringEncoding.UTF8)
});
}
bool _synchronizable = false;

public void Protect (string key, string value)
{
Remove (key.ToLower ());

var result = SecKeyChain.Add (new SecRecord (SecKind.GenericPassword) {
Service = NSBundle.MainBundle.BundleIdentifier,
Label = key.ToLower(),
Account = key.ToLower (),
ValueData = NSData.FromString (value),
Generic = NSData.FromString (key.ToLower ()),
Accessible = SecAccessible.WhenUnlockedThisDeviceOnly,
Synchronizable = _synchronizable
});
}

public string Unprotect(string key)
{
var existingRecord = new SecRecord(SecKind.GenericPassword)
{
Account = key,
Label = key,
Service = NSBundle.MainBundle.BundleIdentifier
Generic = NSData.FromString (key.ToLower ()),
Service = NSBundle.MainBundle.BundleIdentifier,
Label = key.ToLower (),
Account = key.ToLower (),
Synchronizable = _synchronizable
};

// Locate the entry in the keychain, using the label, service and account information.
// The result code will tell us the outcome of the operation.
SecStatusCode resultCode;
SecKeyChain.QueryAsRecord(existingRecord, out resultCode);
existingRecord = SecKeyChain.QueryAsRecord(existingRecord, out resultCode);

if (resultCode == SecStatusCode.Success)
return NSString.FromData(existingRecord.ValueData, NSStringEncoding.UTF8);
return NSString.FromData(existingRecord.ValueData, NSStringEncoding.UTF8);
else
return null;
}
Expand All @@ -44,8 +53,9 @@ public void Remove(string key)
{
var existingRecord = new SecRecord(SecKind.GenericPassword)
{
Account = key,
Label = key,
Generic = NSData.FromString (key.ToLower ()),
Account = key.ToLower (),
Label = key.ToLower (),
Service = NSBundle.MainBundle.BundleIdentifier
};
SecKeyChain.Remove(existingRecord);
Expand Down
4 changes: 2 additions & 2 deletions Beezy.MvvmCross.Plugins.SecureStorage.Touch/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// MvvmCross - Secure Storage Plugin is licensed using Microsoft Public License (Ms-PL)
//

using Cirrious.CrossCore;
using Cirrious.CrossCore.Plugins;
using MvvmCross.Platform.Plugins;
using MvvmCross.Platform;

namespace Beezy.MvvmCross.Plugins.SecureStorage.Touch
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Cirrious.CrossCore.Plugins;
using MvvmCross.Platform.Plugins;

namespace $rootnamespace$.Bootstrap
{
Expand Down
6 changes: 1 addition & 5 deletions Beezy.MvvmCross.Plugins.SecureStorage.Touch/packages.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MvvmCross" version="3.1.1" targetFramework="MonoTouch10" />
<package id="MvvmCross.HotTuna.CrossCore" version="3.1.1" targetFramework="MonoTouch10" />
<package id="MvvmCross.HotTuna.MvvmCrossLibraries" version="3.1.1" targetFramework="MonoTouch10" />
<package id="MvvmCross.HotTuna.StarterPack" version="3.1.1" targetFramework="MonoTouch10" />
<package id="MvvmCross.PortableSupport" version="3.1.1" targetFramework="MonoTouch10" />
<package id="MvvmCross.Platform" version="4.1.0" targetFramework="xamarinios10" />
</packages>
Loading