当我们使用HttpClient时,我们将遵循以下代码:
var httpClientBuilder = OkHttpClient.Builder()
var caFileInputStream = context.resources.openRawResource(R.raw.my_certificate)
// We're going to put our certificates in a Keystore
val keyStore = KeyStore.getInstance("PKCS12")
keyStore.load(caFileInputStream, "my file password".toCharArray())
val keyManagerFactory = KeyManagerFactory.getInstance("X509")
keyManagerFactory.init(keyStore, "my file password".toCharArray())
val sslContext = SSLContext.getInstance("TLS")
sslContext.init(keyManagerFactory.keyManagers, null, SecureRandom())
return httpClientBuilder
.sslSocketFactory(sslContext.socketFactory)
.build()
同样的,我们如何在BBD中的GDHttpClient中实现这一点?我的要求是在API调用的发布请求中附加SSL证书。
1条答案
按热度按时间j91ykkif1#
自定义证书可添加到BlackBerry UEM并分配给使用您的应用程序的用户。使用GdHttpClient建立网络连接时,将自动部署和使用这些证书。有关如何在BlackBerry UEM中配置此功能的说明,请参阅以下指南。
Managing client certificates for user accounts