37

Using the SD card as Adopted Storage encrypts it. How can it be decrypted?

1
  • 1
    I think current versions of Android do not use the term Adopted Storage they use SD card formatted as internal storage. Dec 23, 2018 at 18:09

1 Answer 1

34

How to decrypt adopted storage.

  1. Your Android device must be rooted.

  2. Browse to /data/misc/vold, e.g. using a file browser app like "ES Explorer".

  3. The .key file there is the encryption key of your adopted storage.

  4. View the 16-byte key using a graphical hex editor or alternatively run hexdump -e '/1 "%02x"' filename_here.key.

  5. Mount your SD card e.g. using a GNU/Linux system. In my case, SD card was mounted at /dev/sdb2.

  6. Then run this command to decrypt the drive:

    dmsetup create crypt1 --table "0 `blockdev --getsize /dev/sdb2` crypt aes-cbc-essiv:sha256 <Put the 16-byte hex key here> 0 /dev/sdb2 0"
    

    Some types of errors/warnings can be ignored.

  7. If your key is correct, you can mount it by mount -t ext4 /dev/mapper/crypt1 /mnt/1/

  8. Finally, you can run cd /mnt/1 to browse the decrypted storage.

6
  • 2
    Related: Corrupt SD card formatted as internal storage. The answer is similar, but gives an alternative approach to finding the 16-byte key.
    – Izzy
    May 22, 2016 at 16:05
  • 1
    Is it possible to generate the .key keyfile from a known password/pin code and access to the device? Or is the key completely random? In my case, my internal storage is wiped, so I don't have access to the original keyfile anymore.
    – zerwas
    Jul 7, 2016 at 8:53
  • 1
    @zerwas the right thing is that you copy your key after making your SD as internal, but you can for sure encrypt your storage same as android do and make a key then put it there it will work but if you copy your key once its done by the phone it will be much simpler
    – poqdavid
    Jul 8, 2016 at 19:02
  • 2
    the full manual has the correct way of extracting the key using od: nelenkov.blogspot.com.br/2015/06/…
    – brauliobo
    Mar 26, 2017 at 23:40
  • 1
    I have unrooted encrypted Android 10 device and I don't see anything of mentioned in p. 2-3. I don't have /data folder in my root storage, no vold folder and I don't have any .key file. When I search my root storage for vold string, all I can see are vold.fstab and vold.rc files. When I search for .key, I am getting a bunch of files with .so extension having .keymaster as a part of file name and now file with filename ending in .key. Is it because these are available only on rooted phone or because this answer is a little bit out dated and no longer valid for Android 10?
    – trejder
    Dec 5, 2020 at 19:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .