The ultimate solution for keystore manipulation in Android
Tired of deal with Android keystore? A lot of code ever? This library is for you
This library is tiny (no dependencies) just to small implementations to store/retrieve keystore values it automatically deals with old Android keystore implementation (pre api 23) and newer Android keystore
//Just get a instance of the CipherStorage
CipherStorage cipherStorage = CipherStorageFactory.newInstance(context);
//Then you can use the encrypt and decrypt method
- I care a lot about unit tests, and since this library touch on the Android Keystore making it almost impossible to test, but, I said "almost" that's why I provide another library just for tests, if you wanna use mockito
when...thenit's fine but I think this is not your responsability so just add this into your test implementation and that's it, the
CipherStorageFactorywill return a in memory implementation just for tests you don't need change anything on your source code:
Where the encrypted values are stored?
- By default the encrypted values are stored in an android shared preferences, but you can always pass your own implementation of the
Storageinterface and store it where you want, on a SQLite for example.
- Did you use this library? Please notify me via email firstname.lastname@example.org I would love to receive feedbacks and see if this library is used in some project and if it's helping somehow.
- On Api level 22 and bellow your alias for key should not contain more than 256 bytes otherwise we can't save the the value due a limitation on the Android Keystore
- Zularizal for this amazing library logo and sample icons
Copyright 2018 Leonardo Rossetto
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
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.