背景

用过小米系统的人应该可能或多或少的用到过小米的秘密隐藏功能。如
磁盘的结构
看网上资料,说小米的私密文件不管文件大小能够达到秒级加密,一时非常好奇。决定一探究竟;

现象

加密前

本人手机sdcard中有一张测试图片,result.jpg。通过stat命令,我们可以看到;

1
2
3
4
5
6
7
8
shell@cancro:/sdcard $ stat result.jpg
File: `result.jpg'
Size: 488024 Blocks: 960 IO Blocks: 4096 regular file
Device: 15h Inode: 7709 Links: 1
Access: (660/-rw-rw----) Uid: (0/ root) Gid: (1015/ root)
Access: 2018-05-29 14:17:41.071482351
Modify: 2018-05-29 14:17:41.191482351
Change: 2018-05-29 14:17:41.191482351

加密后

1
2
stat result.jpg                                         
stat: 'result.jpg': No such file or directory

解密后

1
2
3
4
5
6
7
8
shell@cancro:/sdcard $ stat result.jpg
File: `result.jpg'
Size: 488024 Blocks: 960 IO Blocks: 4096 regular file
Device: 15h Inode: 7709 Links: 1
Access: (660/-rw-rw----) Uid: (0/ root) Gid: (1015/ root)
Access: 2018-05-29 14:17:41.071482351
Modify: 2018-06-15 14:08:49.041830979
Change: 2018-06-15 14:08:49.041830979

原理

我们可以看到加密的问题就存在sdcard/FileExplorer一个隐藏目录下。

1
2
3
4
5
shell@cancro:/sdcard/FileExplorer/.safebox $ ls -al
-rw-rw---- root sdcard_rw 1024 2018-06-15 17:23 .header_backup_a8d42b3dcf1e588e361ca8f35dad77c0.jpg_encrypted_new
-rw-rw---- root sdcard_rw 0 2018-06-15 14:06 .nomedia
-rw-rw---- root sdcard_rw 4011 2018-06-15 17:23 .thumb_a8d42b3dcf1e588e361ca8f35dad77c0.jpg_encrypted_new
-rw-rw---- root sdcard_rw 488024 2018-06-15 17:23 {[私密文件请谨慎删除]}a8d42b3dcf1e588e361ca8f35dad77c0.jpg_encrypted_new