Skip to content

Commit

Permalink
Fixed tests, bumped version, slight tweaks to docs,
Browse files Browse the repository at this point in the history
  • Loading branch information
scottyab committed Apr 10, 2015
1 parent a5b8921 commit e825d04
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 86 deletions.
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Secure-preferences

[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-secure--preferences-brightgreen.svg?style=flat)](http:https://android-arsenal.com/details/1/362)

This is Android Shared preference wrapper that encrypts the values of Shared Preferences using AES 128, CBC, and PKCS5 padding with integrity checking in the form of a SHA 256 hash. Each key is stored as a one way HA 256 hash. Both keys and values are base64 encoded before storing into prefs xml file. **By default the generated key is stored in the backing perferences file and so can be read and extracted by root user.** Recommend use the user password generated option as added in v0.1.0.
This is Android Shared preference wrapper that encrypts the values of Shared Preferences using AES 128, CBC, and PKCS5 padding with integrity checking in the form of a SHA 256 hash. Each key is stored as a one way SHA 256 hash. Both keys and values are base64 encoded before storing into prefs xml file. **By default the generated key is stored in the backing preferences file and so can be read and extracted by root user.** Recommend use the user password generated option as added in v0.1.0.

The sample app is available on [playstore](https://play.google.com/store/apps/details?id=com.securepreferences.sample)

Expand All @@ -13,19 +13,22 @@ The sample app is available on [playstore](https://play.google.com/store/apps/de
##New release v0.1.0
This release is a major refactor of the guts of secure prefs, which is *Not backwards compatible* yet with older versions. So if you have an existing app using this don't upgrade. I'll be looking to add migration into a later release.

[Full list of changes](changes.md)

#Usage

##Dependency

Maven central is the prefered way:
Maven central is the preferred way:

```java
dependencies {
compile 'com.scottyab:secure-preferences-lib:0.0.4'
}
```

Or clone this repo and add the library as a Android library project/module.
###Download
Or download the release .aar or clone this repo and add the library as a Android library project/module.

#Examples
This will use the default shared pref file
Expand All @@ -35,15 +38,15 @@ This will use the default shared pref file
```

##Custom pref file
You can define a seperate file for encrpyted preferences.
You can define a separate file for encrypted preferences.

```java
SharedPreferences prefs = new SecurePreferences(context, null, "my_custom_prefs.xml");
```


##User password
Passing in a password to the SecurePreferences contructor means the key is generated at runtime and *not* stored in the backing pref file.
Passing in a password to the SecurePreferences constructor means the key is generated at runtime and *not* stored in the backing pref file.

```java
SharedPreferences prefs = new SecurePreferences(context, "userpassword", "my_user_prefs.xml");
Expand Down Expand Up @@ -88,8 +91,8 @@ SharedPreferences keys and values are stored as simple map in an XML file.


###Disclaimer
By default it's not bullet proof security (in fact it's more like obfuscation of the preferences) but it's a quick win for incrementally making your android app more secure. For instance it'll stop users on rooted devices easily modifiying your app's shared prefs.
*Recommend using the user password based prefs as introducted in v0.1.0.*
By default it's not bullet proof security (in fact it's more like obfuscation of the preferences) but it's a quick win for incrementally making your android app more secure. For instance it'll stop users on rooted devices easily modifying your app's shared prefs.
*Recommend using the user password based prefs as introduced in v0.1.0.*


###Contributing
Expand Down Expand Up @@ -119,4 +122,4 @@ Apache License, Version 2.0
limitations under the License.


Lock icon for sample app licenced under creativecommons created by Sam Smith via [thenounproject.com](http:https://thenounproject.com/term/lock/5704/)
The sample app Lock icon for sample app licenced under Creative Commons created by Sam Smith via [thenounproject.com](http:https://thenounproject.com/term/lock/5704/)
6 changes: 3 additions & 3 deletions changes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
##Release Notes:
0.1.0
This release is a major refactor of the guts of secure prefs, which is *Not backwards compatible* yet with older versions. So if you have an existing app using this don't upgrade. I'll be looking to add migration into a later release.
This release is a major refactor of the guts of secure prefs, which is *Not backwards compatible* with 0.4.0 and older versions _yet!_. So if you have an existing app using this don't upgrade. I'll be looking to add migration into a later release.

* uses a new and stronger [Crypto library](https://github.com/scottyab/java-aes-crypto) under the hood
* includes PRNG fixes that effects JellyBean devices as per [google dev blog article](http:https://android-developers.blogspot.nl/2013/08/some-securerandom-thoughts.html)
Expand All @@ -9,11 +9,11 @@ This release is a major refactor of the guts of secure prefs, which is *Not back
* updated sample app
* removed test project and added tests as part of main project
* refactored library project to standard gradle structure
* published to maven central
* published to maven central/added github release


0.0.4
* Gralde support thanks @yelinaung
* Gradle support thanks @yelinaung
* Fix for OnPreferenceChanged listener @richardleggett

0.0.3
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
VERSION_NAME=0.0.5
VERSION_CODE=5
VERSION_NAME=0.1.0-SNAPSHOT
VERSION_CODE=10
GROUP=com.scottyab


Expand Down
Loading

0 comments on commit e825d04

Please sign in to comment.