I am looking for a solution where I can use StrongBox hardware if present in the device to store my cryptographic keys. Currently, I am creating keys having setIsStrongBoxBacked(true) method in KeyGenParameterSpec builder, and when the StrongBoxUnavailableException occurs I fallback to generate keys without it.
How to check for StrongBox Keymaster hardware availability before key generation?
Asked Answered
You can check whether the device has feature of "PackageManager.FEATURE_STRONGBOX_KEYSTORE" like this:
boolean hasStrongBox() {
return mActivity.getPackageManager()
.hasSystemFeature(PackageManager.FEATURE_STRONGBOX_KEYSTORE)
}
or
boolean hasStrongBox;
hasStrongBox = getContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_STRONGBOX_KEYSTORE);
© 2022 - 2024 — McMap. All rights reserved.