Return to Level1Techs.com

Android - Check if AES key is inside the secure hardware

Hey guys, I thought maybe someone here knows the answer to the following question:

For my application, I create an AES key and want to check whether said key is stored inside the Secure Hardware. I googled and found an example for RSA, but figured it shouldn’t matter. Below is the RSA example I found:

KeyFactory keyFactory = KeyFactory.getInstance(secretKey.getAlgorithm(), "AndroidKeyStore");
KeyInfo keyInfo = keyFactory.getKeySpec(secretKey, KeyInfo.class);
keyInfo.isInsideSecureHardware();

However, the very first line returns a no such algorithm: AES for provider AndroidKeyStore exception. But shouldn’t it be possible to check if an AES key is inside the secure hardware for AES as well?

Theoretically I could use asymmetric encryption, since it is only a small snippet of data I want to en/decrypt but I would still prefer if I could use symmetric encryption.

Do you guys have an idea?