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

mipirakas

Senior Member
Feb 16, 2015
233
117
73
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
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

Forum Moderator
Staff member
Jun 6, 2014
4,178
7,861
263
30
Ambala
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
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

Forum Moderator
Staff member
Jun 6, 2014
4,178
7,861
263
30
Ambala
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
0
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
73
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,914
944
253
Elysium
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,439
1,250
183
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,914
944
253
Elysium
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
Jul 17, 2014
348
98
58
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
65
9
0
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
651
304
0
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
65
9
0
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,238
1,654
193
@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
271
124
63
@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
 

Attachments

Last edited: