Skip to content
This repository was archived by the owner on May 28, 2026. It is now read-only.

VoiSmart/crypto

Repository files navigation

Crypto

This is a simple library to encrypt and decrypt small amount of data such as passwords.

Features

  • Supports down to Android API 18
  • Exposes only two methods: Encrypt and Decrypt
  • No useless boilerplate
  • Uses AndroidKeyStore to store the keys
  • Fixed cryptographic algorithms
    • RSA for 18 <= API <= 22 and optionally also for API >= 23 (if you set forceAsymmetric = true in initialization))
    • AES for API >= 23

Usage

  • Init the library
Crypto.init(context, "keys_alias")
  • Use the library
val helper = EncryptionHelper.getInstance()
val encrypted = helper.encrypt("some_text")
val decrypted = helper.decrypt(encrypted)

Future

  • More init configuration
    • Algorithm
    • Provider
    • Transformation
  • Resiliency to AndroidKeyStore keys deletion
  • Recover from exception
  • Other features I'm not yet aware

Notice

On API level lower than 21 keys might be deleted when user change the display's security mechanism (screen lock) Use with caution and only if losing your keys or not being able to recover the encrypted data are not critical for you.

Acknowledgement

Parts of the code are freely inspired by the Security Workshop Sample

Releases

Packages

Contributors

Languages