我们可以从谷歌物联网核心获取与设备关联的RSA公钥吗?



实际上,我在Google IoT Core上有一个设备及其关联的公钥。是否可以使用服务帐户(和相应的注册表(从任何脚本中获取该公钥。它是谷歌物联网核心上的受限密钥吗?

是的,这是可能的。使用python iot客户端的示例:

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)

使用 gcloud 的示例:

gcloud iot devices describe my-device --project=my-project --region=my-location --registry=my-registry --format=json | jq '.credentials

您可以通过其他客户端或直接使用 Rest API 获取此信息。

最新更新