[Guide] How to decrypt data partition, and re-encrypt data partition on OnePlus 5

Search This thread

snowwolf725

Senior Member
Mar 23, 2010
138
374
Taipei
Because there are too many people ask about "how to decrypt data" and "how to re-encrypt data",
I write a guide to tell you how to decrypt/re-encrypt data partition.

[Change log for V2:]
1. Update script to no-verity-opt-encrypt-6.0.zip
2. Decryption support for Android Oreo and Android Nougat

[Why we need decrypt data partion?]
1. Install MultiRom/MultiBoot
2. Some Roms only work on decrypted device
3. For better performance

[Disadvantage]
1. Low security (Cracker can access your file, and remove lock screen pin from TWRP)
2. It need to wipe your data/internal storage to decrypt data partition.

Decrypt data partition with magisk:
1. Go to “Wipe” section, tap “Format Data”, and type “yes”
2. Transfer Rom and no_verity_op5_v2.zip to the device over MTP
3. Go to “Install” section, select ROM, and swipe to confirm the flash
4. Go to “Install” section, select magisk.zip, and swipe to confirm the flash
5. Go to “Install” section, select no_verity_op5_v2.zip, and swipe to confirm the flash
6. Reboot

PS. you should format data before flashing no_verity_op5.zip.

Re-Encrypt data partition:
1. Go to “Wipe” section, tap “Format Data”, and type “yes”
2. Transfer stock Oxygen Rom to the device over MTP
3. Go to “Install” section, select the Oxygen rom, and swipe to confirm the flash
4. Reboot

[Proof]
No magic here. What you see is real.


[How it work?]
OnePlus 5 uses FBE(File-Based Encryption) to encrypt data partition.
The latest no-verity-opt-encrypt zip ( https://build.nethunter.com/android-tools/no-verity-opt-encrypt/ ) only replace "forceencrypt" to "encryptable".
It didn't replace "fileencryption", so your data partition is still encrypted.
In order to decrypt data partition, I modified the no-verity-opt-encrypt.zip by myself.
The no_verity_op5_v2.zip will replace "fileencryption" to "encryptable".

boot.img/ramdis/fstab.qcom
1500755753175.jpg
 

Attachments

  • no_verity_op5.zip
    1 MB · Views: 4,924
  • no_verity_op5_v2.zip
    656.8 KB · Views: 22,505
Last edited:

aneeshmbabu

Senior Member
May 22, 2013
359
27
Pune
Mtp transfer means .. I tried after wiping format data I tried to transfer the required file by using my laptop with original data cable , but data transfer is showing but not transferring actually waited a long .. but no transfer happens ..
 

aneeshmbabu

Senior Member
May 22, 2013
359
27
Pune
You need reboot recovery, before you use MTP.
In order to use MTP, you need remount your data partition.
Hi thanks for the replay , presently i flashed twrp and magisk also I'm in Franco custom kernel , so can i possible to decrypt data,
I'm very new in one plus 5 , coming from Motorola phones , so kindly give me a step wise process for a beginner .. thanks in advance ..
 

ChavitoArg

Senior Member
Aug 13, 2011
1,251
656
So in order to remain unencrypted i have to flash this after a custom kernel, dont they include this feature already? Sorry for the questions, but im new to this device.
 

Fif_

Senior Member
Jun 5, 2013
1,230
1,354
Google Nexus 10
Google Nexus 4
So in order to remain unencrypted i have to flash this after a custom kernel, dont they include this feature already? Sorry for the questions, but im new to this device.
Yes, you have to flash it every time you write the boot partition: flash a ROM or OTA.
Note that if you use Magisk, Magisk by default automatically turns off DM Verity and force encrypt, so there's no need to flash both no_verity_op5.zip and Magisk, just Magisk is fine.
 
  • Like
Reactions: wmq and ChavitoArg

wrongway213

Recognized Dev & Contributor / Retired Forum Mod
Jul 27, 2014
5,090
8,865
33
Canton, OH
I have a few questions for the sake of clarity, as an experience I had makes me question if Magisk handles this. Blu_spark kernel will not boot when flashed with Magisk on my decrypted, stock OOS device - I believe status of encrypted/decrypted and FBE are two separate things based on the reply from eng.stk. it seems to use that kernel while decrypted, I still need to flash no-verity zip, even with Magisk.

This thread states both that you don't need to flash this if using Magisk, but that you need to flash this anytime you modify boot IMG - ROM flash, OTA, etc. I'm trying to nail down when I need this zip and when I don't - very curious if there's some solid info on when to use this in flashing and when not to. Guide is great as is for decrypting - just wanna stay that way.
 
  • Like
Reactions: ChavitoArg

HonPig

Member
Sep 20, 2017
16
7
is decryption needed for xposed as official release has come out?

Sent from my OnePlus5 using XDA Labs
 

Top Liked Posts

  • There are no posts matching your filters.
  • 56
    Because there are too many people ask about "how to decrypt data" and "how to re-encrypt data",
    I write a guide to tell you how to decrypt/re-encrypt data partition.

    [Change log for V2:]
    1. Update script to no-verity-opt-encrypt-6.0.zip
    2. Decryption support for Android Oreo and Android Nougat

    [Why we need decrypt data partion?]
    1. Install MultiRom/MultiBoot
    2. Some Roms only work on decrypted device
    3. For better performance

    [Disadvantage]
    1. Low security (Cracker can access your file, and remove lock screen pin from TWRP)
    2. It need to wipe your data/internal storage to decrypt data partition.

    Decrypt data partition with magisk:
    1. Go to “Wipe” section, tap “Format Data”, and type “yes”
    2. Transfer Rom and no_verity_op5_v2.zip to the device over MTP
    3. Go to “Install” section, select ROM, and swipe to confirm the flash
    4. Go to “Install” section, select magisk.zip, and swipe to confirm the flash
    5. Go to “Install” section, select no_verity_op5_v2.zip, and swipe to confirm the flash
    6. Reboot

    PS. you should format data before flashing no_verity_op5.zip.

    Re-Encrypt data partition:
    1. Go to “Wipe” section, tap “Format Data”, and type “yes”
    2. Transfer stock Oxygen Rom to the device over MTP
    3. Go to “Install” section, select the Oxygen rom, and swipe to confirm the flash
    4. Reboot

    [Proof]
    No magic here. What you see is real.


    [How it work?]
    OnePlus 5 uses FBE(File-Based Encryption) to encrypt data partition.
    The latest no-verity-opt-encrypt zip ( https://build.nethunter.com/android-tools/no-verity-opt-encrypt/ ) only replace "forceencrypt" to "encryptable".
    It didn't replace "fileencryption", so your data partition is still encrypted.
    In order to decrypt data partition, I modified the no-verity-opt-encrypt.zip by myself.
    The no_verity_op5_v2.zip will replace "fileencryption" to "encryptable".

    boot.img/ramdis/fstab.qcom
    1500755753175.jpg
    7
    Don't worry about it. I appreciate you making the changes that you did, thanks. :) You've made some great contributions to the community, keep up the good work! :)
    New thread is live! https://forum.xda-developers.com/android/software/universal-dm-verity-forceencrypt-t3817389
    5
    I recently clean flashed OB13 and here's what I did:
    Booted to bootloader
    Fastboot flashed the latest blu_spark TWRP
    Reboot to recovery
    Wipe everything (selected everything for wiping except USB-OTG, obviously)
    Once the wipe process finished, I formatted the data partition as well
    Reboot to recovery again
    Copied all the zips to my interna storage
    Flashed the zips in the following order: OOS OB13 Full Zip --> Magisk 15.4 Zip (Note that Magisk 16.x doesn't work and will error out, so use this one and then later update Magisk from Magisk Manager) --> No Verity Zip (the one by @daxiaamu worked absolutely fine)
    Cleared cache and dalvik-cache
    Rebooted & profit!
    I've been working on and off the last couple months on making a more universal verity and force encrypt remover zip. Finally got it figured out. Works great for me on ob11 and liquid remix on my op5t. You won't need magisk or anything else, just this zip :)

    I still want to tweak it slightly but it's complete and works flawlessly if you want to use it instead (I'll be making a thread for it this week).

    Also, magisk 16.6 works fine. There's just a bug with it where you can't put your .magisk file in /data or it'll throw an error so put it somewhere else like /cache (although you won't need magisk for verity/fec removal thanks to this zip)
    4
    @snowwolf725 hi mate

    Could you purpose a update no_verity_op5_v3.zip for the new OpenBeta 13 with Treble support (Vendor partition). Actualy v2 don't work and a dmverity v3 is available here

    but i prefer your file because of that :

    try this file
    work on me decrypt data in open beta 13 treble
    see METHOD 1: Using TWRP recovery [ For Decrypted Users] on this thread for flashing
    https://forum.xda-developers.com/oneplus-5/how-to/official-stable-oxygen-os-5-0-update-t3724247
    use the file below that I provide
    4
    Here is the confirmed working file made by me. You can attach it in your thread https://drive.google.com/open?id=1BtZKnNc2ooe9lcDd0JJ8eHzylA0StSm2