I am trying to piece together some information about the security system in Android. Particularly about how user's password/PIN is connected with encryption keys in file-based encryption mode. I'm doing this for my university project. I've found a lot of useful information on the Android source site. But some things are still unclear to me.
- How is passwords/PIN information connected with keys, which are used to encrypt files?
The stretched credential is the user credential after salting and stretching with the scrypt algorithm. The credential is actually hashed once in the lock settings service before being passed to vold for passing to scrypt. This is cryptographically bound to the key in the TEE with all the guarantees that apply to KM_TAG_APPLICATION_ID.
- Where does Android store this key: in hardware or some not accessible memory?
The secdiscardable hash is a 512-bit hash of a random 16 KB file stored alongside other information used to reconstruct the key, such as the seed
- What algorithm does Android use for reconstruction the key?