-
Notifications
You must be signed in to change notification settings - Fork 633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fleet provisioning demo to get certificate and private key via CreateKeysAndCertificate #1875
fleet provisioning demo to get certificate and private key via CreateKeysAndCertificate #1875
Conversation
Thanks for contributing this demo! Looks good to me; apologies for delay in reviewing. |
@giuspen Thanks for the contribution. @n9wxu merged your PR in, but I have some concerns. In general, use of the CreateKeysAndCertificate API is discouraged due to key material being transmitted over the wire. While communication to AWS IoT Core is typically encrypted, it's very much preferred to use the CreateCertificatefromCsr API call unless it is not possible to do. Primarily this would be due to code size restrictions or lack of a secure entropy source. In general, it is best from a security standpoint to avoid transmitting private keys at all unless absolutely necessary even if the transmission medium is encrypted. |
@paulbartell thanks for your comment, I have been trying to use the CreateCertificatefromCsr API demo in order to then use that downloaded certificate for the mutual auth demo without success. It is not clear after I have the certificate which private key is associated. I would expect either not being able to run the demo until I point to my already existing private key or that at the end of the demo I have the privat key and certificate pair. Could you improve that demo or help me understand how to do that? |
@giuspen: With the CreateCertificatefromCsr API, the associated private key is the private key which signed the Certificate Signing Request included in the request to CreateCertificatefromCsr. Often this means that the existing key is re-used with the new certificate. Does that answer you question? |
@paulbartell in the CreateCertificatefromCsr demo (as in the new demo CreateKeysAndCertificate) I have to create manually one claim private key and one claim certificate and pass the paths. |
@paulbartell I'm working on https://github.com/giuspen/aws-iot-device-sdk-embedded-C/tree/GP_fleet_provisioning_with_csr_demo to add the changes to optionally write the generated private key to disk similarly to the keys and certificate demo, a little help to get it into the right format to be written would be great. |
With the following I have written the EC PRIVATE KEY https://github.com/giuspen/aws-iot-device-sdk-embedded-C/blob/100c34120fe1e45683cf10eb7db7c27281910304/demos/fleet_provisioning/fleet_provisioning_with_csr/pkcs11_operations.c#L1157 but while the demo succeeds, then the mutual auth demo will fail using this private key and certificate (the same works instead with keys cert demo) [INFO] [FLEET_PROVISIONING_DEMO] [fleet_provisioning_with_csr_demo.c:791] Demo completed successfully. $ ./bin/mqtt_demo_mutual_auth |
(the private key saved example) |
There is a bug in the fleet provisioning demo with CSR. If I use directly the private key
The rebuilding of the private key
Example of difference in the keys
|
I simply created a new fleet provisioning demo that instead of using the CreateCertificatefromCsr API, uses the CreateKeysAndCertificate API, tested successfully, any feedback welcome