sameerIOTApps.Plugin.SecureStorage 2.0.0

Provides Secure storage of key value pairs for iOS, Android, UWP, MacOS(OSX) and Tizen apps.

There is a newer version of this package available.
See the version list below for details.

Requires NuGet 2.8.1 or higher.

Install-Package sameerIOTApps.Plugin.SecureStorage -Version 2.0.0
dotnet add package sameerIOTApps.Plugin.SecureStorage --version 2.0.0
<PackageReference Include="sameerIOTApps.Plugin.SecureStorage" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add sameerIOTApps.Plugin.SecureStorage --version 2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Secure Storage Plugin for Xamarin and Windows Apps (iPhone, Android, UWP, Mac, Tizen)

The plugin can be used to Securely store sensitive data strings such as password, session token, credit card number etc. This plugin securely stores the strings across sessions on iOS, Android, UWP, Mac and Tizen apps. Ver 2.0.0 is now compatible with .net standard.

The supported platforms include:

  • iOS Unified
  • Android
  • UWP
  • MacOS (OSX)
  • Tizen

It has easy to use API of key-value pairs. The pairs are saved using platform specific encryption mechanism. It has no dependencies on any packages (including Xamarin.Forms, MVVMCross.). And can be used by any Xamarin or UWP or Tizen app. It is open source.

Note

If your app fails to save values in iOS 10 Simulator, open the Entitlements.plist file and make sure that "Enable Keychain Access Groups" is checked. Also ensure that in Project->Options->iOS Bundle Signing, the Entitlements.plist is selected in Custom Entitlements for iPhoneSimulator platform.
This happens only in iOS 10 Simulator due to https://forums.xamarin.com/discussion/77760/ios-10-keychain

Usage

It provides 4 methods.

SetValue - Stores the key and value.

CrossSecureStorage.Current.SetValue(“SessionToken”, “1234567890”);

GetValue - Returns the value for the given key. If not found, returns default value.

var sessionToken = CrossSecureStorage.Current.GetValue (“SessionToken”);

DeleteKey - Deletes the given key and corresponding value from the storage.

CrossSecureStorage.Current.DeleteKey(“SessionToken”);

HasKey - Checks if the given key exists in the storage.

var exists = CrossSecureStorage.Current.HasKey (“SessionToken”);

NOTE: In Android Apps, by default the password for storage is the hardware serial number. So it is unique per device. Should you want to choose your password, it can be done as follows

SecureStorageImplementation.StoragePassword = "Your Password";

Make sure that you obfuscate the app so the password is not reverse engineered.

In the UWP Apps, the data is stored in the password vault. It has a built in limit of 10 values per app.

Changes in 2.0.0

  • Abstraction Layer - Now compatible with .net standard

  • iOS - No special changes

  • Android - Hardware serial number is the default password

  • UWP - New platform in 2.0.0. It has the following limitations.

      UWP Password vault has limitation of 10 values per app
      The value cannot be set as null or empty string. (Delete the key instead.)
    
  • Mac - New platform in 2.0.0

  • Tizen - New platform in 2.0.0

  • Windows Phone 8.X - Retired. If you want to use it, it is there in 1.2.2

The sample apps shows how to use it in Xamarin and in Tizen Apps.

Plugin: http://www.nuget.org/packages/sameerIOTApps.Plugin.SecureStorage/

Blog: https://sameerkapps.wordpress.com/2016/02/01/secure-storage-plugin-for-xamarin/

License

MIT License.

Secure Storage Plugin for Xamarin and Windows Apps (iPhone, Android, UWP, Mac, Tizen)

The plugin can be used to Securely store sensitive data strings such as password, session token, credit card number etc. This plugin securely stores the strings across sessions on iOS, Android, UWP, Mac and Tizen apps. Ver 2.0.0 is now compatible with .net standard.

The supported platforms include:

  • iOS Unified
  • Android
  • UWP
  • MacOS (OSX)
  • Tizen

It has easy to use API of key-value pairs. The pairs are saved using platform specific encryption mechanism. It has no dependencies on any packages (including Xamarin.Forms, MVVMCross.). And can be used by any Xamarin or UWP or Tizen app. It is open source.

Note

If your app fails to save values in iOS 10 Simulator, open the Entitlements.plist file and make sure that "Enable Keychain Access Groups" is checked. Also ensure that in Project->Options->iOS Bundle Signing, the Entitlements.plist is selected in Custom Entitlements for iPhoneSimulator platform.
This happens only in iOS 10 Simulator due to https://forums.xamarin.com/discussion/77760/ios-10-keychain

Usage

It provides 4 methods.

SetValue - Stores the key and value.

CrossSecureStorage.Current.SetValue(“SessionToken”, “1234567890”);

GetValue - Returns the value for the given key. If not found, returns default value.

var sessionToken = CrossSecureStorage.Current.GetValue (“SessionToken”);

DeleteKey - Deletes the given key and corresponding value from the storage.

CrossSecureStorage.Current.DeleteKey(“SessionToken”);

HasKey - Checks if the given key exists in the storage.

var exists = CrossSecureStorage.Current.HasKey (“SessionToken”);

NOTE: In Android Apps, by default the password for storage is the hardware serial number. So it is unique per device. Should you want to choose your password, it can be done as follows

SecureStorageImplementation.StoragePassword = "Your Password";

Make sure that you obfuscate the app so the password is not reverse engineered.

In the UWP Apps, the data is stored in the password vault. It has a built in limit of 10 values per app.

Changes in 2.0.0

  • Abstraction Layer - Now compatible with .net standard

  • iOS - No special changes

  • Android - Hardware serial number is the default password

  • UWP - New platform in 2.0.0. It has the following limitations.

      UWP Password vault has limitation of 10 values per app
      The value cannot be set as null or empty string. (Delete the key instead.)
    
  • Mac - New platform in 2.0.0

  • Tizen - New platform in 2.0.0

  • Windows Phone 8.X - Retired. If you want to use it, it is there in 1.2.2

The sample apps shows how to use it in Xamarin and in Tizen Apps.

Plugin: http://www.nuget.org/packages/sameerIOTApps.Plugin.SecureStorage/

Blog: https://sameerkapps.wordpress.com/2016/02/01/secure-storage-plugin-for-xamarin/

License

MIT License.

Dependencies

This package has no dependencies.

Showing the top 3 GitHub repositories that depend on sameerIOTApps.Plugin.SecureStorage:

Repository Stars
prajjwaldimri/GithubXamarin
GithubXamarin(GitIt) is a cross-platform application for https://github.com which is built using Xamarin.
MoneyFox/MoneyFox
A way to make budgeting easy. A basic idea for the community, made even better by the community.
sameerkapps/SecureStorage

Read more about the GitHub Usage information on our documentation.

Version History

Version Downloads Last updated
2.5.0 133,437 5/21/2018
2.0.1 37,195 2/11/2018
2.0.0 12,492 12/28/2017
1.2.2 55,426 4/30/2017
1.2.1 28,350 2/22/2016
1.2.0 434 2/14/2016
1.0.0 567 1/31/2016