Reputation: 410
Actually, I have a device and its associated public key on Google IoT Core. Is it possible to get that public key from any script using the service account (and respective registry). Is it restricted keys on google-iot-core?
Upvotes: 2
Views: 328
Reputation: 2850
Yes, it is possible. An example using python iot client:
from google.cloud import iot_v1
client = iot_v1.DeviceManagerClient()
name = client.device_path('my-project', 'my-location', 'my-registry', 'my-device')
response = client.get_device(name)
# Here you can see the credentials
print(response.credentials)
An example using gcloud:
gcloud iot devices describe my-device --project=my-project --region=my-location --registry=my-registry --format=json | jq '.credentials
You can get this information with other clients or using the Rest API directly.
Upvotes: 1