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

Internet of Things IoT Frameworks 3 years ago

727 0 0 0 0

_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

User submissions are the sole responsibility of contributors, with TuteeHUB disclaiming liability for accuracy, copyrights, or consequences of use; content is for informational purposes only and not professional advice.

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.

Similar Forum


Q

Azure IoT hub and sending messages with mosquitto_pub

_x000D_ _x000D_ I'm trying to send some simple message with mosquitto_pub to Azure IoT HUB but faced...
Q

How to generate AWS bootstrap certificates with java SDK?

_x000D_ _x000D_ According to this docs I need to generate so-called bootstrap certificates for my Io...
Q

is it possible to do 3way handshake only one time with mqtt communication?

_x000D_ _x000D_ I am using mosquitto_pub to publish the data with TLS using a topic. I am using mosq...

Important Internet of Things Links