How to change the encryption key on (rooted) Android 9?


Question

In Android 6, you could change the disk encryption key using the vdc command with



vdc cryptfs changepw NEWPW


In Android 9, you get a message, that raw commands are no longer supported.



During rooting and installing Lineage OS 16 and installing different stuff, I got different PIN and encryption keys. This means, that when I change the lockscreen PIN, the encryption key is no longer changed.



In principle, this is what I wanted to achieve, but the problem is that I currently do not know how to change the encryption key at all. I would like to have a rather short lockscreen pin and a longer encryption key, that I can change from time to time. On Android 6 this was no problem on the shell and with different Apps, but the Apps seem to depend on the vdc command as well.



I already tried to change the lockscreen PIN back to the current encryption password in the hope, that the next change of the PIN then would change the encryption as well, because I thought maybe the encryption was not changed because the new API needs a correct old password before changing the key to the new password. But this did not work as well.



Is there any App, command line tool or function in Lineage OS 16, that can change the encryption key?


Answer

I was able to set an encryption password again, be removing the lockscreen by removing some files related to the lockscreen and then setting a new passphrase. To use a different lockscreen password then, you need to restore the original files.



Source on XDA: https://forum.xda-developers.com/showpost.php?p=78699812&postcount=58




As a workaround on Android Pie, you can do the following (on your own
risk):




  1. set the desired password for the screen lock

  2. backup lockscreen files:


    1. all files under /data/system_de/0/spblob/

    2. files containing "_synthetic_password_" in /data/misc/keystore/user_0/

    3. /data/system/locksettings.db


  3. set the desired password for the device encryption

  4. restore / replace all lockscreen files



If something went wrong, sqlite into /data/system/locksettings.db and
set the values of sp-handle and lockscreen.password_type to 0 to reset
the screen lock.




Afterwards I enabled the lockscreen using the settings app and used the current boot password as password. When changing the lockscreen, the boot password was changed as well.



To have separate lockscreen and boot passwords again, you can either restore the previous files, or remove the new ones and set a fresh lockscreen password, that does not overwrite the encryption key.


Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes