FDE
In previous versions Android's default encryption for /data
and Adoptable Storage was Full Disk Encryption (FDE) which is a custom implementation of dm-crypt
. userdata
partition (on FDE as well as FBE) is hard (or impossible) to decrypt off-the-device because of hardware-backed encryption. In case of Adoptable Storage implemented since Android M, key is saved at /data/misc/vold/expand_*.key
, you don't need to dump memory but accessing /data
requires root. Key is stored unencrypted because of the assumption:
Because the contents of an adopted storage device are strongly tied to the Android device that adopted it, the encryption keys should not be extractable from the parent device, and therefore the storage device can't be mounted elsewhere.
But if you are already rooted and once you have the key, it's possible to decrypt the SD Card on a Linux machine using dmsetup
. Also note that removing physical SD Card will break your /sdcard
and the apps you would have moved.
FBE
Recent versions of Android mostly use File Based Encryption (FBE) which bases on Linux filesystem encryption (for ext4
and f2fs
). It doesn't use a single key, instead the master key generates per file (per inode in fact) keys on the go. On Android encrypted master key is saved to /data/misc/vold/user_keys/de/
and /data/misc/vold/user_keys/ce/
along with other related files. Further subdirectories are named after the UserID e.g. 0
for device owner. Here de
is for Device Encrypted storage which is entirely hardware-based encrypted and is available at boot without user interaction. ce
is Credential Encrypted storage which requires user PIN/password for decryption in addition to hardware-backed key. Different directories on /data
partition are (not encrypted or) encrypted with different keys; DE or CE, for user 0
or user 10
and so on.
So each user has 2 encrypted keys - one for CE and the other for DE - just like the encrypted key stored to the footer of userdata
partition as in the case of FDE. The keys can't be simply used for decrypting files on PC as opposed to a single key required to decrypt whole block device in case of FDE Adoptable Storage. Also FBE with Adoptable Storage doesn't work on Nougat and Oreo, and doesn't look very stable on Pie. I'm not sure how it's gonna work when things get streamlined. If some implementations store unencrypted (CE/DE) master keys in /data/misc/vold/user_keys/
, there would be higher chances for FBE to work across multiple platforms.
OTHER OPTIONS
If you don't want to go with Android's native FDE or FBE, you can manually setup dm-crypt
(plain / LUKS), or try FUSE-based solutions first like encfs
or gocryptfs
; they are relatively simpler. Binaries are available here.
FBE can be manually managed with fscrypt
tool but I don't think that would be a very feasible option at the moment. You may give a try though.
ecryptfs
is another Linux kernel's native feature. Android by default never used ecryptfs
AFAIK, so it depends on ROM builder if they built kernel with CONFIG_ECRYPT_FS=y
or not. You might need to rebuild kernel.
All of the above options work well but all need root access and manual configuration on Android e.g. an init.d
script, or a third party solution.
Or if you just want to encrypt selected directories and not the whole SD card, give MiXplorer a try. It includes Java port of encfs
which doesn't require root. However directory decrypted in MiXplorer won't be accessible to other apps. For Boxcrypter type of use case, I prefer rclone
because it's open-source.
RELATED:
FBE
. The path/data/misc/vold
belongs to Irfan's description ofFDE
.