Android app to connect to AWS IoT using X.509 certificate

Internet of Things IoT Frameworks 2 years ago

0 0 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating
_x000D_ _x000D_ I am writing an Android application to connect a sensor to an AWS IoT service. I have been provided with the X.509 certificate, a pair of public-private key, clientEndpoint, etc. I am trying to follow the AWS's Sample code (see here). The instructions are clear, but I don't want to generate the certificate and the keys (I already have them). Below is the code snippet: // 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); How can I use the existing certificates files instead of generating new certificate and keys? Thank you

Posted on 16 Aug 2022, this text provides information on IoT Frameworks related to Internet of Things. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (0)

Post Answer

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

Important Internet of Things Links