Я пишу приложение Android для подключения датчика к сервису IoT AWS.
Мне предоставлен сертификат X.509, пара открытых и закрытых ключей, clientEndpoint
и т. Д.
Я пытаюсь следовать образцу кода AWS ( см. Здесь ).
Инструкции понятны, но я не хочу создавать сертификат и ключи(Они у меня уже есть).
Ниже приведен фрагмент кода:
// Create a new private key and certificate. This call
// creates both on the server and returns them to the
// device.
CreateKeysAndCertificateRequest createKeysAndCertificateRequest = new CreateKeysAndCertificateRequest();
createKeysAndCertificateRequest.setSetAsActive(true);
final CreateKeysAndCertificateResult createKeysAndCertificateResult;
createKeysAndCertificateResult = mIotAndroidClient.createKeysAndCertificate(createKeysAndCertificateRequest);
Log.i(LOG_TAG,"Cert ID: " +createKeysAndCertificateResult.getCertificateId() +" created.");
// store in keystore for use in MQTT client
// saved as alias "default" so a new certificate isn't
// generated each run of this application
AWSIotKeystoreHelper.saveCertificateAndPrivateKey(certificateId,createKeysAndCertificateResult.getCertificatePem(),createKeysAndCertificateResult.getKeyPair().getPrivateKey(),
keystorePath, keystoreName, keystorePassword);
// load keystore from file into memory to pass on
// connection
clientKeyStore = AWSIotKeystoreHelper.getIotKeystore(certificateId,keystorePath, keystoreName, keystorePassword);
Как использовать файлы существующих сертификатов вместо генерации нового сертификата и ключей?
Спасибо