{"id":19946923,"url":"https://github.com/androidwithrossyn/encrypted-sharedpreferences","last_synced_at":"2025-03-01T14:17:45.966Z","repository":{"id":253253022,"uuid":"840902344","full_name":"AndroidWithRossyn/Encrypted-SharedPreferences","owner":"AndroidWithRossyn","description":"Encrypted SharedPreferences uses strong encryption algorithms (AES-256) and is integrated with the Android Keystore system, which securely manages the encryption keys.","archived":false,"fork":false,"pushed_at":"2025-02-20T11:06:05.000Z","size":134,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-20T12:22:43.271Z","etag":null,"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"],"latest_commit_sha":null,"homepage":"https://medium.com/@banrossyn/securing-android-app-with-encrypted-sharedpreferences-8a5e98783485","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AndroidWithRossyn.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-11T03:28:22.000Z","updated_at":"2025-02-20T11:06:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"8fb49f34-fad7-4863-835f-9019b56e04f1","html_url":"https://github.com/AndroidWithRossyn/Encrypted-SharedPreferences","commit_stats":null,"previous_names":["androidwithrossyn/sharedpreferences","androidwithrossyn/encrypted-sharedpreferences"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndroidWithRossyn%2FEncrypted-SharedPreferences","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndroidWithRossyn%2FEncrypted-SharedPreferences/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndroidWithRossyn%2FEncrypted-SharedPreferences/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndroidWithRossyn%2FEncrypted-SharedPreferences/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AndroidWithRossyn","download_url":"https://codeload.github.com/AndroidWithRossyn/Encrypted-SharedPreferences/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241374541,"owners_count":19952545,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["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"],"created_at":"2024-11-13T00:33:25.343Z","updated_at":"2025-03-01T14:17:45.947Z","avatar_url":"https://github.com/AndroidWithRossyn.png","language":"Kotlin","readme":"\u003ch1 align=\"center\"\u003eSecuring Android App with Encrypted SharedPreferences\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"\"\u003e\n      \u003cimg src=\"https://miro.medium.com/v2/resize:fit:828/format:webp/1*bir5xBeE4vxZnZPWSkP_2w.jpeg\" width=\"1000\" /\u003e\n    \u003c/a\u003e\n  \u003c/p\u003e\n  \n\n\n### Generally data is saved in this way in Android devices.\n\n```xml\n\u003c?xml version='1.0' encoding='utf-8' standalone='yes' ?\u003e\n\u003cmap\u003e\n    \u003cboolean name=\"googleMapShow\" value=\"true\" /\u003e\n    \u003cint name=\"dateFormat\" value=\"7\" /\u003e\n    \u003cboolean name=\"isShowTemperature\" value=\"true\" /\u003e\n    \u003cboolean name=\"isShowLevelIndicator\" value=\"false\" /\u003e\n    \u003cstring name=\"language\"\u003een\u003c/string\u003e\n    \u003cint name=\"latLongFormat\" value=\"2\" /\u003e\n    \u003cboolean name=\"isShowDate\" value=\"true\" /\u003e\n    \u003cint name=\"selectedTemplate\" value=\"0\" /\u003e\n    \u003cboolean name=\"isShowShortAddress\" value=\"true\" /\u003e\n    \u003cboolean name=\"firstTime\" value=\"false\" /\u003e\n    \u003cboolean name=\"isShowLongAddress\" value=\"true\" /\u003e\n    \u003cboolean name=\"isShowLatLong\" value=\"true\" /\u003e\n    \u003cboolean name=\"isShowTime\" value=\"true\" /\u003e\n    \u003cint name=\"temperatureFormat\" value=\"1\" /\u003e\n    \u003cint name=\"timeFormat\" value=\"8\" /\u003e\n    \u003cint name=\"googleMapType\" value=\"1\" /\u003e\n\u003c/map\u003e\n```\n\n### But when we use Encrypted SharedPreferences.\n```xml\n\u003c?xml version='1.0' encoding='utf-8' standalone='yes' ?\u003e\n\u003cmap\u003e\n    \u003cstring name=\"__androidx_security_crypto_encrypted_prefs_key_keyset__\"\u003e12a901bc682e67316d97810d5c4ed741daaeddd8877e30137e1b60d4094b04a6ff0bd27c351334ece9568e0b6a3d4b0de494c5577cd71a614e4198c02b8ce62626579ff52740fb41336fe4b012861f5b0533668d2642db6c45025f4428cf6fcd1aba151e991a4e1785dbd0848c8ded29a7540ad8a31236fd40b8c4ec9fa08b5ddf07ed49d6ffb42dbfa98c1a9a06c929f46120bcc6c563e82714e2f4134915b989ed0e75036428bcec24d37d1a4408d2a9e1c304123c0a30747970652e676f6f676c65617069732e636f6d2f676f6f676c652e63727970746f2e74696e6b2e4165735369764b6579100118d2a9e1c3042001\u003c/string\u003e\n    \u003cstring name=\"AUh4VNJxfVMtKEShUAH66Y/Wd6tacepdmB51suathcQ+YCrsu4hZ0Xg=\"\u003eARpRaxiHZmU9NmpOYhXGsKFWh0Q5gfG1YtjOZ+/ET0vY/zU4Pe4=\u003c/string\u003e\n    \u003cstring name=\"AUh4VNJW7atm/QULrLCmY/d2aNzirJKQGNOA3WOPUb0=\"\u003eARpRaxipyG/6dldVpNFeXh4JEO+NjL6JxmH24TTQVBj1xDVt4YKpEK8=\u003c/string\u003e\n    \u003cstring name=\"AUh4VNJyHr2mLKGjNgD1KKyjYWNeUMCaUEwd9BTrIk/ycU9l\"\u003eARpRaxhaVtgbMw1OzeIB/+3Nywr2+DM4pzP8S9M3Jd0Qd3bvKtQXBN4=\u003c/string\u003e\n    \u003cstring name=\"__androidx_security_crypto_encrypted_prefs_value_keyset__\"\u003e128801cb3c76b722706eeed2f367d681c440c160a4cad6d6279d87eb1ae86494ac213f596c289d9b677f1aff5d6152fbf777fe5e57319363213e1ad6dea868e104cc6c3772924516f3e6026e863dcf3a29547876e83c833e6d7a711c86fec53a9445c09bfbe47fb3bf3d3b5339ef9c80da7a7198a6c9a2736e9a55f2039a455ddaf7fce792200904df97921a440898d6c5d201123c0a30747970652e676f6f676c65617069732e636f6d2f676f6f676c652e63727970746f2e74696e6b2e41657347636d4b657910011898d6c5d2012001\u003c/string\u003e\n    \u003cstring name=\"AUh4VNLEMzO0ZEzywCdpX5nBzKTXdomqrA86p2Qz1hNg3DniJQw=\"\u003eARpRaxi7ULeVm2XWXKuSkU/0EzQKvdlou87SmUcBW4iaZMRvBgk=\u003c/string\u003e\n    \u003cstring name=\"AUh4VNLBzx1AEDT0DKye1uJvGOy0pDUu/+5L4EVNp6VeMFd7Ua8=\"\u003eARpRaxg8hP0mELpEOwh0nfVD6wd1K8FEt78EjzdWESkBk+nY0hE=\u003c/string\u003e\n    \u003cstring name=\"AUh4VNKRI5oaAyh3ukO1nrUvZOyznA8Wq1PUU0kZ1g==\"\u003eARpRaxi3ROeOi0fEMQ4i4Px+1ryY+adkx7aG5zBBWwD+9hPfv20=\u003c/string\u003e\n    \u003cstring name=\"AUh4VNJG2G6tiib4AgyC1Zyp+JB0fwinTJRyTkvooQ==\"\u003eARpRaxgClZXUx9+dAt8DPN/pWap8QTWm5cGiIMwB0OHDNPZJs2gMu60=\u003c/string\u003e\n    \u003cstring name=\"AUh4VNL4/Rv9MNzDJTM5VPM9seA71pP1sIqt13XGC5oSj60ToE/g\"\u003eARpRaxgk4Eg5Ssh8jV4w8BDdKjFDZ1pD3V6P6PJRtiJMpTXckmw=\u003c/string\u003e\n    \u003cstring name=\"AUh4VNLOvgbmqRDmi7BBk8+/1F/FJ7H6rsoNl2B3MBl/7g==\"\u003eARpRaxipnE2qdflE/X7dQYbNBtu7NxptAfmdz8+J/lBODO0kqSU=\u003c/string\u003e\n    \u003cstring name=\"AUh4VNK3nOPZuU3qgLFBAX1rs08LgLF3DKeCCbNK\"\u003eARpRaxghDuvQTvR+sH3qge7h9t7SZH4WITftmnA9jpZuizdDTzE=\u003c/string\u003e\n    \u003cstring name=\"AUh4VNJ6aLMPosbF9bIT1f8h3KkBDKsNjH3TNa/9\"\u003eARpRaxgTIDlUlcqBurlhjMIBiWdYd/Iv/XafyPYAX+4FbElm+b8yEys=\u003c/string\u003e\n\u003c/map\u003e\n```\n\nAdd the required dependencies to your build.gradle file:\n\n```groovy\ndependencies {\n    implementation(\"androidx.security:security-crypto:1.1.0-alpha06\")\n}\n```\n```kotlin\n  fun init(context : Context) {\n   \n        val masterKeyAlias = MasterKey.Builder(context)\n            .setKeyScheme(MasterKey.KeyScheme.AES256_GCM)\n            .build()\n\n        this.preferences = EncryptedSharedPreferences.create(\n            context,\n            SHARED_PREFERENCE_FILE_NAME,\n            masterKeyAlias,\n            EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,\n            EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM\n        )\n\n    }\n```\n\nElevate your Android app to the next level with our state-of-the-art solutions! Contact us today and let’s create something extraordinary!\n\n\u003cdiv align=\"start\"\u003e\n  \n\u003ca href=\"mailto:banrossyn@gmail.com\"\u003e\u003cimg src=\"https://img.shields.io/badge/Gmail-EA4335.svg?logo=Gmail\u0026logoColor=white\"\u003e\u003c/a\u003e\n[![Instagram](https://img.shields.io/badge/Instagram-%23E4405F.svg?logo=Instagram\u0026logoColor=white)](https://instagram.com/rohitraj.khorwal) [![LinkedIn](https://img.shields.io/badge/LinkedIn-%230077B5.svg?logo=linkedin\u0026logoColor=white)](https://www.linkedin.com/in/rohitrajkhorwal/) [![Medium](https://img.shields.io/badge/Medium-12100E?logo=medium\u0026logoColor=white)](https://medium.com/@rohitrajkhorwal) \n\u003ca href=\"https://t.me/banrossyn\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/badge/Telegram-26A5E4.svg?logo=Telegram\u0026logoColor=white\"\u003e\u003c/a\u003e\n\u003ca href=\"https://wa.me/+919694260426/\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/badge/WhatsApp-25D366.svg?logo=WhatsApp\u0026logoColor=white\"\u003e\n\u003c/div\u003e\n\n\n---\n\n`Note:` Please review our [Code of Conduct](./CODE_OF_CONDUCT.md) before using this project.\n# Find this Repository useful? ❤️\n\nSupport it by joining stargazers for this repository. ⭐\n\nAlso, [follow me on GitHub](https://github.com/AndroidWithRossyn/) for my next creations! 🤩\n\n\u003cp align=\"left\"\u003e\n\u003ca href=\"https://github.com/AndroidWithRossyn?tab=repositories\u0026sort=stargazers\"\u003e\u003cimg alt=\"All Repositories\" title=\"All Repositories\" src=\"https://custom-icon-badges.demolab.com/badge/-Click%20Here%20For%20All%20My%20Repos-1F222E?style=for-the-badge\u0026logoColor=white\u0026logo=repo\"/\u003e\u003c/a\u003e\n  \n\u003c/p\u003e\n\n\n## ☕ Fuel My Code\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://www.paypal.com/paypalme/banrossyn\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Support_My_Work-00457C?style=for-the-badge\u0026logo=paypal\u0026logoColor=white\" alt=\"PayPal\"/\u003e\n  \u003c/a\u003e\n   \u003ca href=\"https://github.com/AndroidWithRossyn/AndroidWithRossyn/blob/main/donate/upi_scan.jpg?raw=true\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Support_via_UPI-4CAF50?style=for-the-badge\u0026logo=google-pay\u0026logoColor=white\" alt=\"UPI\"/\u003e\n  \u003c/a\u003e\n  \u003cp\u003e\u003ci\u003eYour support transforms caffeine into code! ✨\u003c/i\u003e\u003c/p\u003e\n  \n  \u003ctable\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e🚀 Faster Updates\u003c/td\u003e\n      \u003ctd\u003e🔍 Better Documentation\u003c/td\u003e\n      \u003ctd\u003e🛠️ More Features\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/table\u003e\n  \n  \u003cdetails\u003e\n    \u003csummary\u003e\u003cb\u003eWhy Support?\u003c/b\u003e\u003c/summary\u003e\n    \u003cp\u003eEvery contribution helps me dedicate more time to creating high-quality open source Code. Your support directly translates to better software for everyone!\u003c/p\u003e\n  \u003c/details\u003e\n\u003c/div\u003e\n\n\n\n## License\n\n```\nCopyright: \n~ Rossyn\n~ Rohitraj Khorwal\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://capsule-render.vercel.app/api?type=waving\u0026color=gradient\u0026height=60\u0026section=footer\"/\u003e\n\u003c/p\u003e\n\n","funding_links":["https://www.paypal.com/paypalme/banrossyn"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandroidwithrossyn%2Fencrypted-sharedpreferences","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandroidwithrossyn%2Fencrypted-sharedpreferences","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandroidwithrossyn%2Fencrypted-sharedpreferences/lists"}