我需要 Android 9 中支持安全元件和 StrongBox 的 Android 手机列表。在哪里或如何找到它?
我在 Samsung Galaxy S9 和 AVD Google Pixle XL API 28 上尝试了下面的代码
KeyPairGenerator kpg = null;
kpg = KeyPairGenerator.getInstance(
KeyProperties.KEY_ALGORITHM_RSA, "AndroidKeyStore");
kpg.initialize(new KeyGenParameterSpec.Builder("keystore1", KeyProperties.PURPOSE_SIGN)
.setCertificateSerialNumber(BigInteger.valueOf(1L))
.setCertificateSubject(new X500Principal("CN=MyCompany"))
.setIsStrongBoxBacked(true) /* Enable StrongBox */
.setInvalidatedByBiometricEnrollment(true)
.build());
KeyPair kp = kpg.generateKeyPair();
KeyFactory factory = KeyFactory.getInstance(KeyProperties.KEY_ALGORITHM_EC, "AndroidKeyStore");
KeyInfo keyInfo = factory.getKeySpec(kp.getPrivate(), KeyInfo.class);
keyInfo.isInsideSecureHardware();
它抛出以下异常:
android.security.keystore.StrongBoxUnavailableException:无法生成密钥对
目前支持 StrongBox 的设备很少,不幸的是你在网上能找到的信息也很少。
虽然你是对的,根据Android运行Android 9.0的设备应该支持Strongbox,Strongbox是一个单独的硬件组件,我假设只有使用Android 9.0启动的设备才有机会拥有该硬件。
有GrapheneOS/AttestationSamples存储库,它收集有关多个设备的安全信息。
看了一下,只有Google的Pixel 3设备支持保险箱。您可以在文件夹中看到 Strongbox 认证证书。
有一个名为 Android 设备安全数据库的研究项目,该项目试图解决有关 Android 安全属性信息不易获取的问题。他们在实验室测试手机并将收集的属性保存在数据库中。您可以通过以下链接过滤 Strongbox 支持: