gpt4 book ai didi

java - setStorageEncryption 没有效果

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:39:59 24 4
gpt4 key购买 nike

我在我的 Pandaboard 上玩过设备管理 API,尽管 getStorageEncryption 返回的状态为 TRUE,但 setStorageEncryption 方法似乎没有任何效果。

对于 Panda 板,应用程序内部存储物理放置在可移动闪存卡上的某个位置(它没有任何其他闪存)。所以我做了以下事情:

  1. 调用 setStorageEncryption(true)(ApiDemos 示例中的 DeviceAdminSample.java)。
  2. 通过调用 getStorageEncryption、getStorageEncryptionStatus 验证加密是否处于 Activity 状态,并将示例文件保存在内部存储上。
if (mDPM.getStorageEncryption(mDeviceAdminSample)) {
string = "TRUE Encryption";
}

FileOutputStream fos = null;

fos = openFileOutput("hello_file.txt", Context.MODE_PRIVATE);
fos.write(string.getBytes());
fos.close();
  1. 从Pandaboard中取出SD卡,放入读卡器,将全部内容复制到我的电脑

    sudo dd if=/dev/sdc of=~/workspace/flash_card.bin

  2. 尝试查找字符串:

    $ grep -Ubo --binary-files=text 'TRUE Encryption' ~/workspace/flash_card.bin

    583576877:真正的加密

当它找到字符串时,我得出的结论是没有加密。

实际上 setStorageEncryption 是否启用了加密,或者它只请求加密,或者换句话说“声明您的 Intent ”来加密存储?

最佳答案

我相信您必须另外调用以下代码:

// Launch the activity to activate encryption.  May or may not return!
Intent intent = new Intent(DevicePolicyManager.ACTION_START_ENCRYPTION);
startActivityForResult(intent, REQUEST_CODE_START_ENCRYPTION);

它取自设备管理示例。

关于java - setStorageEncryption 没有效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10281552/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com