如何将证书和键.PEM文件转换为Java密钥库以用于Android?

发布于 2025-02-04 21:30:40 字数 1000 浏览 4 评论 0原文

我是Android开发的新手。抱歉,如果这是一个基本问题。我已经制作了AWS IoT证书,并附上了相应的物联网政策和我试图连接的物联网。我得到了AWS签订的证书,它给了我三个.pem文件可下载:证书以及私人和公共钥匙。它还给了我rootca1和rootca3证书。

documentation 使用

mqttManager.connect(<YOUR_KEYSTORE>, new AWSIotMqttClientStatusCallback() {
    @Override
    public void onStatusChanged(final AWSIotMqttClientStatus status,
                                final Throwable throwable) {
        Log.d(LOG_TAG, "Status = " + String.valueOf(status));
    }
});

在这里我们得到参数&lt; your_keystore&gt;java.security.keystore object。如何将这个对象制成我从AWS IoT中拥有的文件?

I am fairly new to Android development. Sorry if this is a basic question. I have already made my AWS IoT Certificate and attached to it the corresponding IoT Policy and IoT Thing I am trying to connect to. I got a certificate made by AWS and it gave me three .pem files to download: the certificate and the private and public keys. It also gave me the RootCA1 and RootCA3 certificates.

In the documentation, it says that we can connect to AWS using the certificate with

mqttManager.connect(<YOUR_KEYSTORE>, new AWSIotMqttClientStatusCallback() {
    @Override
    public void onStatusChanged(final AWSIotMqttClientStatus status,
                                final Throwable throwable) {
        Log.d(LOG_TAG, "Status = " + String.valueOf(status));
    }
});

and from here we get that the argument <YOUR_KEYSTORE> is a java.security.KeyStore object. How can I make this object given the files I have from AWS IoT?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眼趣 2025-02-11 21:30:40

Check out the

Check out the AWSIotKeystoreHelper.saveCertificateAndPrivateKey API, which can create a keystore file from a private key and a certificate.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文