Secure Preference Manager for android. It uses various Encryption to protect your application's Shared Preferences.

Overview

Secure-Pref-Manager

Android Arsenal Travis CI ##Secure Preference Manager is a simple Library to help you protect your Shared Preferences. Secure Preference Manager for android. It uses various encryption techniques to protect your application's Shared Preferences.

##Setup Add jitpack to your project’s repositories.

repositories {
        // ...
        maven { url "https://jitpack.io" }
    }

Then add Secure-Pref-Manager to your Module’s dependencies

dependencies {
	        compile 'com.github.prashantsolanki3:Secure-Pref-Manager:0.25'
	}

##Usage

###Initialize SecurePrefManager anywhere before using it.

  • Basic Initialization
       new SecurePrefManagerInit.Initializer(getApplicationContext())
               .initialize();
  • Recommended Initialization
  • AES Encryption by Default.
  • Auto Generated Key.
       new SecurePrefManagerInit.Initializer(getApplicationContext())
               .useEncryption(true)
               .initialize();
  • Advance Initialization: Only if you wanna add Custom Encryption Methods.
       new SecurePrefManagerInit.Initializer(getApplicationContext())
               .useEncryption(true)
               .setCustomEncryption(new Encryptor(getApplicationContext()) {
                   @Override
                   public String encrypt(String s) throws Exception {
                       // Your Encryption Algorithm
                       return encryptedString;
                   }

                   @Override
                   public String decrypt(String s) throws Exception {
                       // Your Decryption Algorithm
                       return decryptedString;
                   }
               })
               .initialize();

Adding and Retrieving Preferences

  • Adding
        SecurePrefManager.with(this)
                .set("user_name")
                .value("LoremIpsum")
                .go();
  • Retrieving
        String userName = SecurePrefManager.with(this)
                .get("user_name")
                .defaultValue("unknown")
                .go();

Hide Preferences from 3rd Party applications (EXPERIMENTAL)

  • Unhide Preferences when the activity starts
@Override
    protected void onStart() {
        super.onStart();
        SecurePrefManager.with(getApplicationContext())
                .unhide(new HidePreferences.PreferenceUpdateListener() {
                    @Override
                    public void onFailure() {
                        Log.d("unhiding", "Failed");
                    }

                    @Override
                    public void onProgress(int p, int max) {
                        Log.d("unhiding", "Progress: " + p + "/" + max);
                    }

                    @Override
                    public void onSuccess() {
                        Log.d("unhiding", "Success");
                    }
                });
    }
  • Hide preferences when leaving the activity
@Override
    protected void onPause() {
        SecurePrefManager.with(getApplicationContext())
                .hide(new HidePreferences.PreferenceUpdateListener() {
                    @Override
                    public void onFailure() {

                    }

                    @Override
                    public void onProgress(int p, int max) {

                    }

                    @Override
                    public void onSuccess() {

                    }
                });
    }

Have Fun!

You might also like...
A collection of Android build scripts for various third-party libraries and the tooling to build them

ndkports A collection of Android build scripts for various third-party libraries and the tooling to build them. If you're an Android app developer loo

🐫🐍🍢🅿 Multiplatform Kotlin library to convert strings between various case formats including Camel Case, Snake Case, Pascal Case and Kebab Case

KaseChange Multiplatform Kotlin library to convert strings between various case formats Supported Case Formats SCREAMING_SNAKE_CASE snake_case PascalC

Kindling - A standalone collection of utilities to help Ignition users. Features various tools to help work with Ignition's custom data export formats XClipper is a clipboard manager for Windows & Android which helps to track clipboard activities and makes it easier to interact with them.
XClipper is a clipboard manager for Windows & Android which helps to track clipboard activities and makes it easier to interact with them.

XClipper XClipper is a clipboard manager for Windows & Android which helps to track clipboard activities and makes it easier to interact with them ❤️

Ask Permission - Simple RunTime permission manager

Ask Permission https://kishanjvaghela.github.io/Ask-Permission/ Simple RunTime permission manager How to use Add url to your gradle file compile 'com.

A Virtual Machine For Assessing Android applications, Reverse Engineering and Malware Analysis

Androl4b AndroL4b is an android security virtual machine based on ubuntu-mate includes the collection of latest framework, tutorials and labs from dif

A set of helper classes for using dagger 1 with Android components such as Applications, Activities, Fragments, BroadcastReceivers, and Services.

##fb-android-dagger A set of helper classes for using dagger with Android components such as Applications, Activities, Fragments, BroadcastReceivers,

DiskCache - Simple and readable disk cache for kotlin and android applications

DiskCache Simple and readable disk cache for kotlin and android applications (with journaled lru strategy) This is a simple lru disk cache, based on t

This project is an add-on for the excellent J2V8 Project. It allows users to debug JS running in V8 using Chrome DevTools. Uses Stetho for communication with Chrome DevTools.

J2V8-Debugger This project is an add-on for the excellent J2V8 Project. It allows users to debug JS running in V8 using Chrome DevTools. Uses Stetho f

Comments
  • Error while installing

    Error while installing

    Failed to resolve: com.github.prashantsolanki3:Secure-Pref-Manager:0.25+

    i have added maven { url "https://jitpack.io" } to maven and compile 'com.github.prashantsolanki3:Secure-Pref-Manager:0.25+' dependency to build.gradle

    question 
    opened by nishu3389 6
  • Migrating old data that is not encrypted.

    Migrating old data that is not encrypted.

    What strategy would you recommend for migrating old data that is not encrypted, or does this library handle that already? If not I am willing to do a pull request to help out!

    enhancement 
    opened by ZkHaider 2
  • Potential vulnerability: using blank/default initialization vector

    Potential vulnerability: using blank/default initialization vector

    Hi,

    by looking at the code of this library, I noticed that it depends on this encryption library https://github.com/scottyab/AESCrypt-Android

    Also, I noticed that your encrypt method is using a default/blank initialization vector, which is known to be vulnerable to ciphertext-only attacks (a great discussion on the topic can be found here http://security.stackexchange.com/questions/35210/encrypting-using-aes-256-do-i-need-iv/35216#35216). This vulnerability is also reported on the github page of the dependency.

    I recommend to promptly fix this weakness by generating a random initialization vector before performing encryption.

    Thanks

    opened by PasqualePuzio 0
Releases(1.0.0)
Android Secure SharedPreferences Using Facebook Conceal Encryption

SharedChamber Android Project : SharedChamber on top of SharedPreferences using Facebook Conceal Description Conceal provides a set of Java APIs to pe

Hafiq 95 Nov 25, 2022
Expirable Disk Lru Cache is a secure(with encryption) wrapper for [DiskLruCache](https://github.com/JakeWharton/DiskLruCache) that allows expiring of key/value pairs by specifying evictionTimeSpan. It has very simple API.

ExpirableDiskLruCache ExpirableDiskLruCache is a wrapper for DiskLruCache that allows expiring of key/value pairs by specifying evictionTimeSpan. It h

Vijay Rawat 24 Oct 3, 2022
Aplicación Android para comprender como funciona el listado y las shared preferences

READ.ME Este proyecto tiene como finalidad explicar como se debe utilizar un RecyclerView con una vista bindeada a este. En el proyecto se puede ver c

Carlos Muñoz Bustamante 4 Apr 12, 2022
Reactor is key value database and is a great alternative to Shared Preferences.

Reactor Reactor is a fast and secure key-value library for Android, and has an embedded database based on the JSON structure and is a great alternativ

mr amir abbas 37 Oct 30, 2022
Preference wrappers for primitive types for Android

Typed Preferences This library for Android provides classes which allow to store and retrieve settings from the preferences. There is an individual cl

Tobias Preuss 189 Nov 25, 2022
Preferences data store example

DataStore Example this example shows how you can use data store to store data in key value pairs and get rid of shared preferences Medium Article: htt

Kashif Mehmood 24 Dec 15, 2022
⚙ A beautiful and extensible API for bulding preferences screen

Material Preferences ?? Installation Add this in app's build.gradle file: implementation 'com.imangazaliev.material-prefs:core:<version>' implementati

Mahach Imangazaliev 59 Jul 26, 2022
✔️ Secure, simple key-value storage for Android

Hawk 2.0 Secure, simple key-value storage for android Important Note This version has no backward compatibility with Hawk 1+ versions. If you still wa

Orhan Obut 3.9k Dec 20, 2022
Access and process various types of personal data in Android with a set of easy, uniform, and privacy-friendly APIs.

PrivacyStreams PrivacyStreams is an Android library for easy and privacy-friendly personal data access and processing. It offers a functional programm

null 269 Dec 1, 2022
Various useful utilities for Android apps development

Android Commons Various useful utilities for Android apps development. API documentation provided as Javadoc. Usage Add dependency to your build.gradl

Alex Vasilkov 112 Nov 14, 2022