Since Android 4.3, Android has its own keystore where I can store keys and use them later for encryption/decryption.
It is said here and here that each key can only be retrieved by its owner and not even root can get it.
My question is: Couldn't I write a program that would switch my uid to the owner of the key, retrieve it, and then use it to decrypt data I shouldn't have access to?
Edit: Added citation to keystore doc.
The Android Keystore system lets you store cryptographic keys in a container to make it more difficult to extract from the device. Once keys are in the keystore, they can be used for cryptographic operations with the key material remaining non-exportable.
A public/private key RSA pair is generated, which is stored in the Android device's keystore and protected usually by the device PIN. An AES-based symmetric key is also generated, which is used to encrypt and decrypt the secrets.
A key alias is a label for specific key within a keystore. Key aliases are created using your third-party certificate management tool.
So yes, you can use the same keystore to sign multiple apks, without a problem. You can also use the same alias (each alias is a certificate) to sign multiple apks, and it will work.
It is true that normally a key can only be retrieved by the user that stored it.
See e.g.: http://nelenkov.blogspot.se/2011/11/using-ics-keychain-api.html
If a device is rooted, the keys still cannot be retrieved unless the attacker also has the password.
If the attacker has rooted the device and has the password or the device is unlocked, it's game over.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With