2012-04-23 104 views
9

我在我的Pandaboard上玩過Device Administration API,看起來setStorageEncryption方法沒有效果,儘管getStorageEncryption返回的狀態爲TRUE。setStorageEncryption沒有效果

在熊貓板的情況下,應用程序內部存儲實際上放置在可移動閃存卡(它沒有任何其他閃存)的某處。所以我做了以下幾點:

  1. 調用setStorageEncryption(true)(DeviceAdminSample.java來自ApiDemos示例)。
  2. 通過調用getStorageEncryption,getStorageEncryptionStatus並將示例文件保存在內部存儲上來驗證加密是否處於活動狀態。
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卡,放入讀卡器,如果=的/ dev /全部內容複製到我的電腦

    須藤DD的SDC =〜 /workspace/flash_card.bin

  2. 試圖找到字符串:

    $ grep的-Ubo --binary-文件=文本「TRUE密型重刑」〜/工作區/ flash_card.bin

    583576877:真正加密

當它找到字符串我做一個結論,即沒有加密到位。

實際上setStorageEncryption是否啓用加密,或者它只需要加密或者換句話說「聲明你的意圖」來加密存儲?

回答

4

我相信你必須調用另外下面的代碼:

// 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); 

它從設備管理樣本取。