I am trying to understand when using the default android device encryption in 4.0.4 ICS (AES-CBC 128Bit) how the Key Derivation Function works? That is how is the users decryption passcode transformed into a secure key for use with the Decryption?

And how is the Decryption Password Stored and hashed on the device?

I am trying to demonstrate points of potential vulnerability on our enterprise android devices, and mitigations.

  • AES is not a KDF, so your question is not well defined. Jan 13, 2013 at 14:50
  • 1
    Correct - but i want to know the architecture behind how android takes a User Defined Passcode, and uses it to generate a key to encrypt the device using AES.... and then secures that hashed key.
    – diagonalbatman
    Jan 13, 2013 at 15:47
  • 2
    Why is this off topic? I haven't 'tried' anything other than looking around the Google Docs.
    – diagonalbatman
    Jan 13, 2013 at 15:53
  • 1
    sigh.... What other way can i ask that question? I think it is perfectly valid to ask how the Security Framework works.
    – diagonalbatman
    Jan 13, 2013 at 16:00
  • This link might be of some help source.android.com/tech/encryption/…
    – Ali Ahmad
    Jan 14, 2013 at 14:08

1 Answer 1


Android Encryption Implementation Notes has a pretty detailed description of how the disk encryption is implemented from 3.0. When a user enables encryption if they do not already have a pin set they are required to set one.

The master key is a 128 bit number created by reading from /dev/urandom. It is encrypted with a hash of the user password created with the PBKDF2 function from the SSL library. The footer also contains a random salt (also read from /dev/urandom) used to add entropy to the hash from PBKDF2, and prevent rainbow table attacks on the password

The master key is then stored in the footer of the encrypted partition. Most of the code that is used to start the encryption process is in Vold, Android's volume daemon. If you have the full AOSP source for android you can take a look at /system/core/vold/cryptfs.c which implements many of the commands for encryption in vold as well as commands for verifying and changing the password.

This blog post, Android Disk Encryption also has some good insights into the crypto implmentation as well as the implications of tying the decryption of the master key to the pin/password entered by the user to unlock the device.

Hope this helps.

You must log in to answer this question.