I need the system to be secure.
I tired to encode the image with base64 and sending the string via MQTT to Iot Core. Then decode the string with a cloud function and finally storage the decoded image in Google Cloud Storage. The problem is the limited size of a message in MQTT.
Using a Cloud Function and then storage in Google Cloud Storage is not really secure, anyone could hit that url and I loos control of all the ESP32CAM comunication.
Am I missing something? is there a really secure way to send files to Google Cloud Storage from to IoT Core?
Thanks
IoT Core should not be used to transfer big blobs.
However, you can take advantage of the secure connection between IoT Core and the device to send credentials to the device to access GCS securely.
Create a service account with write only access to your GCS bucket. Pass a key for that service account to the device through IoT Core(via configuration change, for example) The device then can use that key to connect securely to GCS and upload the image.
Depending on your preferences and the particular use case you can rotate the keys to access GCS whenever you want, or be as granular as you want with the permissions (one key for all the devices, one key per device, ...)