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

Search This thread

mipirakas

Senior Member
Feb 16, 2015
233
117
leuven
Would this help me in decrypting my device that's stuck in encryption w/o formatting? My issue is that I deleted the gatekeekper/lockscreen keys and now when booting up my phone, it only shows a black screen with my wallpaper but I can't access any data/apps. When I boot into twrp, it asks me for a password that I never set. I've tried default_password, as well as some other ones but none worked. So now it looks like my device is stuck in encryption mode and I'm trying to figure out how to decrypt it and access my files so I can back it up :confused:.
Only way to decrypt is to do a full wipe including internal storage. This file is only to stay decrypted if you already are decrypted so i think your data is lost. Never delete gatekeeper and lockscreen keys when you are encrypted.
 
  • Like
Reactions: CoCoGirl886

drockin

New member
Apr 17, 2018
4
0
I am potentially looking at having to decrypt a copy of data recovered from a OnePlus 5 which had a touchscreen stop working. Would it be possible to decrypt this data once it has been recovered from the phone? Or would it need to be loaded back onto a OnePlus 5 to be decrypted and be readable?
 

shadowstep

Senior Moderator / Moderator Committee
Staff member
Jun 6, 2014
6,918
17,335
33
Ambala Cantt
OnePlus 9R
Samsung Galaxy Watch 6
I am potentially looking at having to decrypt a copy of data recovered from a OnePlus 5 which had a touchscreen stop working. Would it be possible to decrypt this data once it has been recovered from the phone? Or would it need to be loaded back onto a OnePlus 5 to be decrypted and be readable?

You mean you want to decrypt the data recovered from a OP5 which was encrypted by default earlier? If so, then the only way it can be decrypted is restoring that partition via TWRP and using the passcode/key/whatever was used to encrypt it. There is no other workaround. If you do not know the passcode/key/whatever, you're out of luck.
 

drockin

New member
Apr 17, 2018
4
0
You mean you want to decrypt the data recovered from a OP5 which was encrypted by default earlier? If so, then the only way it can be decrypted is restoring that partition via TWRP and using the passcode/key/whatever was used to encrypt it. There is no other workaround. If you do not know the passcode/key/whatever, you're out of luck.

Thanks, that was my understanding. The data was encrypted and protected using a pattern lock which I set, so in theory that shouldn't be a problem. That challenge I am facing is actually getting a copy of the partition to restore and then access/unlock, as it on a phone that has a non-working touchscreen and limited to no way to access it via software.
 

shadowstep

Senior Moderator / Moderator Committee
Staff member
Jun 6, 2014
6,918
17,335
33
Ambala Cantt
OnePlus 9R
Samsung Galaxy Watch 6
Thanks, that was my understanding. The data was encrypted and protected using a pattern lock which I set, so in theory that shouldn't be a problem. That challenge I am facing is actually getting a copy of the partition to restore and then access/unlock, as it on a phone that has a non-working touchscreen and limited to no way to access it via software.

Ah, I see. Unfortunately, there's no way it can be decrypted if it's not on the phone. That's why the encryption is there in the first place, to prevent misuse of data if someone manages to gets a copy of it somehow. :)
 

Fatadxb

Senior Member
Dec 28, 2008
140
21
why does my phone encrypted again when I use fingerprint and pattern etc How to avoid that to happen again?
i did format data and use no_verity with no success
Do I have to keep my phone unlocker all the time or theres another way?
 

mipirakas

Senior Member
Feb 16, 2015
233
117
leuven
why does my phone encrypted again when I use fingerprint and pattern etc How to avoid that to happen again?
i did format data and use no_verity with no success
Do I have to keep my phone unlocker all the time or theres another way?
No you can set pin/pattern when you are decrypted. If it asks you the password in recovery then that means you are not decrypted. To decrypt you have to wipe your entire internal storage. Did you maybe only tick the data checbox in twrp? Because you also need to tick internal storage.
 
  • Like
Reactions: Fatadxb

Mervingio

Senior Member
Mar 28, 2011
3,917
944
Elysium
OnePlus 7 Pro
Sorry to ask but I’m new to Oneplus got the 5t I assume this works on it too? I remember the LG v20 use a file for no encryption too but once the file was flashed and your internal wiped no need to do the same again so with OP5/5T are the same?

I`m little lost here any help is great
 

ahmed.ismael

Senior Member
Oct 14, 2015
2,443
1,252
Samsung Galaxy S21+
Xiaomi Poco F3
Sorry to ask but I’m new to Oneplus got the 5t I assume this works on it too? I remember the LG v20 use a file for no encryption too but once the file was flashed and your internal wiped no need to do the same again so with OP5/5T are the same?

I`m little lost here any help is great
if you wnat to stay decrypted so you have to format data in twrp then flash a decrypted rom ( encrypted roms works but you have to flash the no variety zip every time you flash an encrypted rom )
and also op5 and op5t is the same ( kernel is unified ) each device have it's own rom zip but both are the same in terms of encryption


anyway you will have to put in mind that you will fu** it up in some point as everyone did lol
just backup your data and dive into it,you will find it easy after a couple of soft brick ( no harm will be done ) you could always flash oos official builds and encrypt it and you will got a fresh device

Sent from my OnePlus 5 using XDA Labs
 

Mervingio

Senior Member
Mar 28, 2011
3,917
944
Elysium
OnePlus 7 Pro
if you wnat to stay decrypted so you have to format data in twrp then flash a decrypted rom ( encrypted roms works but you have to flash the no variety zip every time you flash an encrypted rom )
and also op5 and op5t is the same ( kernel is unified ) each device have it's own rom zip but both are the same in terms of encryption


anyway you will have to put in mind that you will fu** it up in some point as everyone did lol
just backup your data and dive into it,you will find it easy after a couple of soft brick ( no harm will be done ) you could always flash oos official builds and encrypt it and you will got a fresh device

Sent from my OnePlus 5 using XDA Labs

LOL this happen on my v20 like 3 times lost everything because of device has been encrypted after i learn my lesson

Thank You Buddy!
 

digger16309

Senior Member
This happened to me, but after setting my phone up, I'm not in the mood to pull all of my internal storage off (backup), format, decrypt, and then load it all back up again. I don't understand the overall problem. I set a lockscreen PIN. The same PIN is needed in TWRP to decrypt data. Isn't this a good feature? Doesn't that prevent anyone who steals my phone from just booting into TWRP to access my data? Yes?

Setting aside the performance argument, which I understand but don't fully buy into, what's the reason for having decrypted data that anyone with physical access to the phone and a small amount of knowledge can use against me?
 

gianmaxfactor

Senior Member
Sep 5, 2012
83
10
47
Rome
I would keep data encrypted, but I also need to backup and restore it.

How can I make a backup of the data folder while it is encrypted? And could I restore it later?

Or better, how can I temporarily decrypt data to backup/restore it? Sometimes ago I had read something about TWRP + adb + decryption keys but at that moment I was not interested because I had not the problem, so I don't remember where and specially how...
 

Mesmurized

Senior Member
Nov 16, 2013
655
304
I would keep data encrypted, but I also need to backup and restore it.

How can I make a backup of the data folder while it is encrypted? And could I restore it later?...
Simple: connect phone to PC. Open phone internal storage in explorer and copy whateveryouwant. It's stored on the PC unencrypted. If needed back on phone, copy in reverse. It reencrypts before it's written to disk.

---------- Post added at 09:29 PM ---------- Previous post was at 09:20 PM ----------

This happened to me, but after setting my phone up, I'm not in the mood to pull all of my internal storage off (backup), format, decrypt, and then load it all back up again. I don't understand the overall problem. I set a lockscreen PIN. The same PIN is needed in TWRP to decrypt data. Isn't this a good feature? Doesn't that prevent anyone who steals my phone from just booting into TWRP to access my data? Yes?...
Yes it does. The argument is because bootloader is not locked, hackers can easily access data and eventually crack it.
Setting aside the performance argument, which I understand but don't fully buy into, what's the reason for having decrypted data that anyone with physical access to the phone and a small amount of knowledge can use against me?
It is much easier for the flash-a-holics. And sometimes being encrypted requires additional steps. Like before a twrp nanoid, you should remove the pin/fp. Makes restoring a whole lot easier.

---------- Post added at 09:37 PM ---------- Previous post was at 09:29 PM ----------

Decrypt data partition with magisk:...
I have one suggestion. The above line implies magisk is the reason for decryption. It's not. Format did the decryption.
Just a suggested rewording as some non-experienced users I've come across in other forums believe magisk actually does the decryption.

Your thread, you decide. A humble suggestion.
 
Last edited:
  • Like
Reactions: mhxmhx

gianmaxfactor

Senior Member
Sep 5, 2012
83
10
47
Rome
Simple: connect phone to PC. Open phone internal storage in explorer and copy whateveryouwant. It's stored on the PC unencrypted. If needed back on phone, copy in reverse. It reencrypts before it's written to disk.

Thank you Mes, I have a doubt about how could I restore data if the phone did not boot.

I can restore system, boot, custom and vendor partititions with TWRP, but I could only access data (decrypted) if phone completely boot...

My TWRP has no support for decryption, so I can't insert a "pin" to decrypt data.

So, what if I completely brick my phone? I will restore any partition except data. Then the phone will start and so I could access the data folder. Then I should merely overwrite its content with the backuped one. Is it all right in your opinion ?
 

Pho3nX

Senior Member
Jun 13, 2013
2,875
2,111
Nothing Phone 1
@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 :

[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-...y-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".
 

jahidinbedod

Senior Member
Apr 27, 2014
292
129
@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://xdaforums.com/oneplus-5/how-to/official-stable-oxygen-os-5-0-update-t3724247
use the file below that I provide
 

Attachments

  • no_verity_op5_treble.zip
    125.8 KB · Views: 171
  • Screenshot_20180705-214051.jpg
    Screenshot_20180705-214051.jpg
    127.2 KB · Views: 298
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 57
    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://xdaforums.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://xdaforums.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