https://github.com/androidwithrossyn/encrypted-sharedpreferences
Encrypted SharedPreferences uses strong encryption algorithms (AES-256) and is integrated with the Android Keystore system, which securely manages the encryption keys.
https://github.com/androidwithrossyn/encrypted-sharedpreferences
android-security android-security-encryption androidx-security androidxsecurity encrypted encrypted-sharedpreferences encryption encryption-algorithms encryption-library secure-sharedpref secure-storage security-crypto security-cryptography sharedpreferences sharedpreferences-easy sharedpreferences-editor sharedpreferences-helper sharedpreferences-manager
Last synced: 8 months ago
JSON representation
Encrypted SharedPreferences uses strong encryption algorithms (AES-256) and is integrated with the Android Keystore system, which securely manages the encryption keys.
- Host: GitHub
- URL: https://github.com/androidwithrossyn/encrypted-sharedpreferences
- Owner: AndroidWithRossyn
- License: apache-2.0
- Created: 2024-08-11T03:28:22.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-20T11:06:05.000Z (9 months ago)
- Last Synced: 2025-02-20T12:22:43.271Z (9 months ago)
- Topics: android-security, android-security-encryption, androidx-security, androidxsecurity, encrypted, encrypted-sharedpreferences, encryption, encryption-algorithms, encryption-library, secure-sharedpref, secure-storage, security-crypto, security-cryptography, sharedpreferences, sharedpreferences-easy, sharedpreferences-editor, sharedpreferences-helper, sharedpreferences-manager
- Language: Kotlin
- Homepage: https://medium.com/@banrossyn/securing-android-app-with-encrypted-sharedpreferences-8a5e98783485
- Size: 131 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
Securing Android App with Encrypted SharedPreferences
### Generally data is saved in this way in Android devices.
```xml
en
```
### But when we use Encrypted SharedPreferences.
```xml
12a901bc682e67316d97810d5c4ed741daaeddd8877e30137e1b60d4094b04a6ff0bd27c351334ece9568e0b6a3d4b0de494c5577cd71a614e4198c02b8ce62626579ff52740fb41336fe4b012861f5b0533668d2642db6c45025f4428cf6fcd1aba151e991a4e1785dbd0848c8ded29a7540ad8a31236fd40b8c4ec9fa08b5ddf07ed49d6ffb42dbfa98c1a9a06c929f46120bcc6c563e82714e2f4134915b989ed0e75036428bcec24d37d1a4408d2a9e1c304123c0a30747970652e676f6f676c65617069732e636f6d2f676f6f676c652e63727970746f2e74696e6b2e4165735369764b6579100118d2a9e1c3042001
ARpRaxiHZmU9NmpOYhXGsKFWh0Q5gfG1YtjOZ+/ET0vY/zU4Pe4=
ARpRaxipyG/6dldVpNFeXh4JEO+NjL6JxmH24TTQVBj1xDVt4YKpEK8=
ARpRaxhaVtgbMw1OzeIB/+3Nywr2+DM4pzP8S9M3Jd0Qd3bvKtQXBN4=
128801cb3c76b722706eeed2f367d681c440c160a4cad6d6279d87eb1ae86494ac213f596c289d9b677f1aff5d6152fbf777fe5e57319363213e1ad6dea868e104cc6c3772924516f3e6026e863dcf3a29547876e83c833e6d7a711c86fec53a9445c09bfbe47fb3bf3d3b5339ef9c80da7a7198a6c9a2736e9a55f2039a455ddaf7fce792200904df97921a440898d6c5d201123c0a30747970652e676f6f676c65617069732e636f6d2f676f6f676c652e63727970746f2e74696e6b2e41657347636d4b657910011898d6c5d2012001
ARpRaxi7ULeVm2XWXKuSkU/0EzQKvdlou87SmUcBW4iaZMRvBgk=
ARpRaxg8hP0mELpEOwh0nfVD6wd1K8FEt78EjzdWESkBk+nY0hE=
ARpRaxi3ROeOi0fEMQ4i4Px+1ryY+adkx7aG5zBBWwD+9hPfv20=
ARpRaxgClZXUx9+dAt8DPN/pWap8QTWm5cGiIMwB0OHDNPZJs2gMu60=
ARpRaxgk4Eg5Ssh8jV4w8BDdKjFDZ1pD3V6P6PJRtiJMpTXckmw=
ARpRaxipnE2qdflE/X7dQYbNBtu7NxptAfmdz8+J/lBODO0kqSU=
ARpRaxghDuvQTvR+sH3qge7h9t7SZH4WITftmnA9jpZuizdDTzE=
ARpRaxgTIDlUlcqBurlhjMIBiWdYd/Iv/XafyPYAX+4FbElm+b8yEys=
```
Add the required dependencies to your build.gradle file:
```groovy
dependencies {
implementation("androidx.security:security-crypto:1.1.0-alpha06")
}
```
```kotlin
fun init(context : Context) {
val masterKeyAlias = MasterKey.Builder(context)
.setKeyScheme(MasterKey.KeyScheme.AES256_GCM)
.build()
this.preferences = EncryptedSharedPreferences.create(
context,
SHARED_PREFERENCE_FILE_NAME,
masterKeyAlias,
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
)
}
```
Elevate your Android app to the next level with our state-of-the-art solutions! Contact us today and letβs create something extraordinary!
[](https://instagram.com/rohitraj.khorwal) [](https://www.linkedin.com/in/rohitrajkhorwal/) [](https://medium.com/@rohitrajkhorwal)
---
`Note:` Please review our [Code of Conduct](./CODE_OF_CONDUCT.md) before using this project.
# Find this Repository useful? β€οΈ
Support it by joining stargazers for this repository. β
Also, [follow me on GitHub](https://github.com/AndroidWithRossyn/) for my next creations! π€©
## β Fuel My Code
Your support transforms caffeine into code! β¨
π Faster Updates
π Better Documentation
π οΈ More Features
Why Support?
Every contribution helps me dedicate more time to creating high-quality open source Code. Your support directly translates to better software for everyone!
## License
```
Copyright:
~ Rossyn
~ Rohitraj Khorwal
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.
```