相关疑难解决方法(0)

在 SSLContext 中使用硬件支持的密钥

我想在 Android 上使用硬件支持的密钥进行客户端双向 TLS。钥匙应该通过生物识别技术解锁。

我找到了如何在 Android 上生成硬件支持的密钥对:

KeyPairGenerator keyGenerator = KeyPairGenerator.getInstance( KeyProperties.KEY_ALGORITHM_RSA, "AndroidKeyStore");
keyGenerator.initialize(
    new KeyGenParameterSpec.Builder(myAlias, KeyProperties.PURPOSE_ENCRYPT | KeyProperties.PURPOSE_DECRYPT)
        .setDigests(KeyProperties.DIGEST_SHA256, KeyProperties.DIGEST_SHA512)
        .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_RSA_PKCS1)
        .setUserAuthenticationRequired(true)
        .build());
keyGenerator.generateKeyPair();
Run Code Online (Sandbox Code Playgroud)

以及如何使用指纹解锁硬件支持的私钥:

FingerprintManager fingerprintManager = (FingerprintManager) this.getSystemService(Context.FINGERPRINT_SERVICE);
PrivateKey key  = (PrivateKey) keyStore.getKey(myAlias, null);
Cipher cipher = Cipher.getInstance(cipherAlgorithm, "AndroidKeyStore");
cipher.init(Cipher.DECRYPT_MODE, key);
FingerprintManager.CryptoObject cryptoObject = new FingerprintManager.CryptoObject(cipher);
fingerprintManager.authenticate(cryptoObject, cancellationSignal, 0, authenticationCallback, null);
Run Code Online (Sandbox Code Playgroud)

我还可以将 HttpClient 配置为使用客户端证书:

// I have loaded the PrivateKey privateKey and Certificate certificate from PEM files
KeyStore keyStore = KeyStore.getInstance("PKCS12");
keyStore.load(null);
final char pseudoSecretPassword[] = ("##" …
Run Code Online (Sandbox Code Playgroud)

security android keystore sslcontext secure-element

5
推荐指数
1
解决办法
1213
查看次数

客户端证书Android Https

我在这个问题上挣扎了一个星期...我在Android设备上安装了一个客户端证书.我的应用程序必须将文件上传到服务器,并要求客户端证书进行握手.

是否有任何提示来实现此连接?谢谢...

https android

2
推荐指数
1
解决办法
1621
查看次数

标签 统计

android ×2

https ×1

keystore ×1

secure-element ×1

security ×1

sslcontext ×1