GoogleCloudPlatform / iot-device-sdk-embedded-c

Cloud IoT Device SDK for Connectivity to IoT Core.
Other
247 stars 83 forks source link

private key load error #66

Closed PranitaJindal closed 5 years ago

PranitaJindal commented 5 years ago

When running last command of ./Linux_gcc_gcp_iot -p PROJECT_ID -d projects/PROJECT_ID/locations/LOCATION/registries/REGISTRY_ID/devices/DEVICE_ID -t /devices/DEVICE_ID/state

It is showing the following error: Example for FreeRTOS Linux port.

./Linux_gcc_gcp_iot IoTC Embedded C Client Version 1.0.0

private key file size of 1704 bytes is larger than certificate buffer size of 256 bytes

Application exiting due to private key load error.

Though I used the following command for generating private key: openssl genpkey -algorithm RSA -out rsa_private.pem -pkeyopt rsa_keygen_bits:2048 openssl rsa -in rsa_private.pem -pubout -out rsa_public.pem

DellaBitta commented 5 years ago

Hello, and thank you for the issue.

We chose to support only ES256 keys in the IoT Device SDK at launch. We thought RSA keys were quite large in comparison, and the smaller ES256 keys are better aligned with the type of low profile devices we're targeting with the SDK.

Please follow the "Generating an ES256 key" instructions in the Creating public/private key pairs guide. I believe this should solve the problem for you, but if it doesn't then please feel free to re-open this issue.