r_batra
r_batra

Reputation: 410

Can we get RSA public key associated with device from google iot core

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

Answers (1)

Tlaquetzal
Tlaquetzal

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

Related Questions