Skip to content
This repository has been archived by the owner on Mar 8, 2022. It is now read-only.

Latest commit

 

History

History
73 lines (47 loc) · 2.42 KB

README.md

File metadata and controls

73 lines (47 loc) · 2.42 KB

AndroidKeyStore

Build Status Version

Deprecated

This Library is now Deprecated and wont be updated anymore. Use Android Native Keystore System instead.

AndroidKeyStore is a library for Android apps that allows you to encrypt sensitive information, The encryption uses the Android KeyStore available to generate and uses RSA and AES keys for encryption operations.

Getting Started

Adding androidkeystore to your project

Include the following dependencies in your app's build.gradle :

dependencies {
    implementation 'com.mutualmobile:androidkeystore:0.0.4'
}

How to use

  1. Get an instance of KeystoreCryptoFactory
val factory = KeystoreCryptoFactory.get(context)
  1. Now carry out the encryption/decryption

NOTE: Since the Encryption/Decryption is Async, the following tasks needs to be done on a background thread

  //Generate Key Aliases
  factory.create_key_if_not_available(EMAIL)
  factory.create_key_if_not_available(PASSWORD)

  //Encrypt the string
  val encryptedEmail = factory.encrypt(EMAIL, mEmail)
  val encryptedPassword = factory.encrypt(PASSWORD, mPassword)

  //Decrypt the string
  factory.decrypt(EMAIL, encryptedEmail)
  factory.decrypt(PASSWORD, encryptedPassword)

Special Thanks

Realm - The popular mobile database that runs directly inside phones, tablets or wearables. This library is cloned from (https://github.com/realm/realm-android-user-store)

License

Copyright 2018 Mutual Mobile

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.