Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find out whether the device is full disk encrypted and what encryption was used?

Since Android 3.0 full disk encryption is supported, but I can't see any API to that ability. The two specific things I need to know are:

  1. Whether the device is encrypted?
  2. What encryption is used.

I found a low level explanation of the process here and it seems to suggest the encryption used is 128 AES with CBC and ESSIV:SHA256, but it does not talk about a way to find whether the device is encrypted.

So, is there a way my app can query whether the device is using the full disk encryption feature, or do I need to resort to hacky solutions like Runtime.exec calls?

like image 244
Mikle Avatar asked Jun 14 '11 09:06

Mikle


People also ask

How do I know if my disk is full encrypted?

Windows - DDPE (Credant)In the Data Protection window, click on the icon of the hard drive (aka System Storage). Under System Storage, if you see the following text: OSDisk (C) and In compliance underneath, then your hard drive is encrypted.

How do you check if my device is encrypted?

You can check the encryption status for Android devices by navigating to Settings > Security > Encryption. This tab shows whether the device is encrypted or not. In case the Android device is not encrypted, you can enable encryption from the same tab.

What is full device encryption?

Full-disk encryption is the process of encoding all user data on an Android device using an encrypted key. Once a device is encrypted, all user-created data is automatically encrypted before committing it to disk and all reads automatically decrypt data before returning it to the calling process.

What is disk encryption used for?

Whole disk encryption protects a disk in the event of theft or accidental loss. Whole disk encryption encrypts the entire disk including swap files, system files, and hibernation files.


1 Answers

As @Mikle mentions you can just call the DevicePolicyManager and ask it the status

@SuppressLint("NewApi")
    private boolean isEncrypted(Context context) {
        DevicePolicyManager devicePolicyManager = (DevicePolicyManager) context
                .getSystemService(Context.DEVICE_POLICY_SERVICE);

        if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB) {
            int status = devicePolicyManager.getStorageEncryptionStatus();
            if (DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE == status) {
                return true;
            }
        }
        return false;
    }
like image 76
scottyab Avatar answered Sep 23 '22 19:09

scottyab