Google Cloud IoT Device SDK for Embedded C API
iotc_jwt.h
Go to the documentation of this file.
1 /* Copyright 2018-2019 Google LLC
2  *
3  * This is part of the Google Cloud IoT Device SDK for Embedded C,
4  * it is licensed under the BSD 3-Clause license; you may not use this file
5  * except in compliance with the License.
6  *
7  * You may obtain a copy of the License at:
8  * https://opensource.org/licenses/BSD-3-Clause
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __IOTC_JWT_H__
18 #define __IOTC_JWT_H__
19 
20 #include <iotc_types.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #define IOTC_JWT_HEADER_BUF_SIZE 40
27 #define IOTC_JWT_HEADER_BUF_SIZE_BASE64 \
28  (((IOTC_JWT_HEADER_BUF_SIZE + 2) / 3) * 4)
29 
30 #define IOTC_JWT_PAYLOAD_BUF_SIZE 256
31 #define IOTC_JWT_PAYLOAD_BUF_SIZE_BASE64 \
32  (((IOTC_JWT_PAYLOAD_BUF_SIZE + 2) / 3) * 4)
33 
34 #define IOTC_JWT_MAX_SIGNATURE_SIZE 132
35 #define IOTC_JWT_MAX_SIGNATURE_SIZE_BASE64 \
36  (((IOTC_JWT_MAX_SIGNATURE_SIZE + 2) / 3) * 4)
37 
38 #define IOTC_JWT_SIZE \
39  (IOTC_JWT_HEADER_BUF_SIZE_BASE64 + 1 + IOTC_JWT_PAYLOAD_BUF_SIZE_BASE64 + \
40  1 + IOTC_JWT_MAX_SIGNATURE_SIZE_BASE64)
41 
87  const char* project_id, uint32_t expiration_period_sec,
88  const iotc_crypto_key_data_t* private_key_data, char* dst_jwt_buf,
89  size_t dst_jwt_buf_len, size_t* bytes_written);
90 
91 #ifdef __cplusplus
92 }
93 #endif
94 
95 #endif /* __IOTC_JWT_H__ */
iotc_state_t
Definition: iotc_error.h:30
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)