Google Cloud IoT Device SDK for Embedded C API
|
#include <iotc_types.h>
Go to the source code of this file.
Macros | |
#define | IOTC_JWT_HEADER_BUF_SIZE 40 |
#define | IOTC_JWT_HEADER_BUF_SIZE_BASE64 (((IOTC_JWT_HEADER_BUF_SIZE + 2) / 3) * 4) |
#define | IOTC_JWT_PAYLOAD_BUF_SIZE 256 |
#define | IOTC_JWT_PAYLOAD_BUF_SIZE_BASE64 (((IOTC_JWT_PAYLOAD_BUF_SIZE + 2) / 3) * 4) |
#define | IOTC_JWT_MAX_SIGNATURE_SIZE 132 |
#define | IOTC_JWT_MAX_SIGNATURE_SIZE_BASE64 (((IOTC_JWT_MAX_SIGNATURE_SIZE + 2) / 3) * 4) |
#define | IOTC_JWT_SIZE |
Functions | |
iotc_state_t | iotc_create_iotcore_jwt (const char *project_id, uint32_t expiration_period_sec, const iotc_crypto_key_data_t *private_key_data, char *dst_jwt_buf, size_t dst_jwt_buf_len, size_t *bytes_written) |
#define IOTC_JWT_HEADER_BUF_SIZE 40 |
Definition at line 26 of file iotc_jwt.h.
#define IOTC_JWT_HEADER_BUF_SIZE_BASE64 (((IOTC_JWT_HEADER_BUF_SIZE + 2) / 3) * 4) |
Definition at line 27 of file iotc_jwt.h.
#define IOTC_JWT_MAX_SIGNATURE_SIZE 132 |
Definition at line 34 of file iotc_jwt.h.
#define IOTC_JWT_MAX_SIGNATURE_SIZE_BASE64 (((IOTC_JWT_MAX_SIGNATURE_SIZE + 2) / 3) * 4) |
Definition at line 35 of file iotc_jwt.h.
#define IOTC_JWT_PAYLOAD_BUF_SIZE 256 |
Definition at line 30 of file iotc_jwt.h.
#define IOTC_JWT_PAYLOAD_BUF_SIZE_BASE64 (((IOTC_JWT_PAYLOAD_BUF_SIZE + 2) / 3) * 4) |
Definition at line 31 of file iotc_jwt.h.
#define IOTC_JWT_SIZE |
Definition at line 38 of file iotc_jwt.h.
iotc_state_t iotc_create_iotcore_jwt | ( | const char * | project_id, |
uint32_t | expiration_period_sec, | ||
const iotc_crypto_key_data_t * | private_key_data, | ||
char * | dst_jwt_buf, | ||
size_t | dst_jwt_buf_len, | ||
size_t * | bytes_written | ||
) |
Creates a JWT which will be used to connect to the IoT Core service. The JWT should be used in the MQTT Connect password field when connecting to IoT Core.
The function currently supports ES256 key types only, as its intended for small devices where ECC algorithims should be used to their smaller key footprint requirements.
Note: This function invokes the Crypto BSP functions iotc_bsp_sha256(), iotc_bsp_ecc(), and iotc_bsp_base64_encode_urlsafe() to fullfill string encoding and signature functionality.
[in] | expiration_period_sec | the length of time (in seconds) before this JWT will expire. |
[in] | project_id | the project id the device belongs to in the GCP IoT organization. |
[in] | private_key_data | data identifying a private key to be used to sign the JWT. For more information on how to generate a private-public key pair for your device, please see: https://cloud.google.com/iot/docs/how-tos/credentials/keys. |
[in/out] | a pointer to a buffer to hold the formatted and signed JWT. | |
[in] | dst_jwt_buf_len | the length of the dst_jwt_buf buffer, in bytes. |
[out] | bytes_written | will contain the number of bytes that were written to the provided dst_jwt_buf. |