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

snowwolf725

Senior Member
Mar 23, 2010
138
370
103
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
 

Attachments

Last edited:

aneeshmbabu

Senior Member
May 22, 2013
359
27
0
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 ..
 

snowwolf725

Senior Member
Mar 23, 2010
138
370
103
Taipei
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 ..
You need reboot recovery, before you use MTP.
In order to use MTP, you need remount your data partition.
 
  • Like
Reactions: aneeshmbabu

aneeshmbabu

Senior Member
May 22, 2013
359
27
0
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,250
656
0
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,021
1,022
0
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 Developer / Recognized Contributor / Re
Jul 27, 2014
5,062
8,769
263
32
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