Azure IoT middleware for FreeRTOS
azure_iot_jws.h
Go to the documentation of this file.
1 /* Copyright (c) Microsoft Corporation.
2  * Licensed under the MIT License. */
3 
11 #ifndef AZURE_IOT_JWS_H
12 #define AZURE_IOT_JWS_H
13 
14 #include <stdint.h>
15 
16 #include "azure_iot_result.h"
17 
21 typedef struct AzureIoTJWS_RootKey
22 {
23  uint8_t * pucRootKeyId;
24  uint32_t ulRootKeyIdLength;
25  uint8_t * pucRootKeyN;
26  uint32_t ulRootKeyNLength;
27  uint8_t * pucRootKeyExponent;
30 
31 
32 #define azureiotjwsRSA3072_SIZE 384
33 #define azureiotjwsSHA256_SIZE 32
34 #define azureiotjwsJWS_HEADER_SIZE 1400
35 #define azureiotjwsJWS_PAYLOAD_SIZE 60
36 #define azureiotjwsJWK_HEADER_SIZE 48
37 #define azureiotjwsJWK_PAYLOAD_SIZE 700
38 #define azureiotjwsSIGNATURE_SIZE 400
39 #define azureiotjwsSIGNING_KEY_E_SIZE 10
40 #define azureiotjwsSIGNING_KEY_N_SIZE azureiotjwsRSA3072_SIZE
41 #define azureiotjwsSHA_CALCULATION_SCRATCH_SIZE azureiotjwsRSA3072_SIZE + azureiotjwsSHA256_SIZE
49 #define azureiotjwsSCRATCH_BUFFER_SIZE \
50  ( azureiotjwsJWS_HEADER_SIZE + azureiotjwsJWK_HEADER_SIZE + azureiotjwsJWK_PAYLOAD_SIZE \
51  + azureiotjwsSIGNATURE_SIZE + azureiotjwsSIGNING_KEY_N_SIZE + azureiotjwsSIGNING_KEY_E_SIZE \
52  + azureiotjwsSHA_CALCULATION_SCRATCH_SIZE )
53 
75  uint32_t ulManifestLength,
76  uint8_t * pucJWS,
77  uint32_t ulJWSLength,
78  AzureIoTJWS_RootKey_t * xADURootKeys,
79  uint32_t ulADURootKeysLength,
80  uint8_t * pucScratchBuffer,
81  uint32_t ulScratchBufferLength );
82 
83 #endif /* AZURE_IOT_JWS_H */
AzureIoTResult_t AzureIoTJWS_ManifestAuthenticate(const uint8_t *pucManifest, uint32_t ulManifestLength, uint8_t *pucJWS, uint32_t ulJWSLength, AzureIoTJWS_RootKey_t *xADURootKeys, uint32_t ulADURootKeysLength, uint8_t *pucScratchBuffer, uint32_t ulScratchBufferLength)
Authenticate the manifest from ADU.
struct AzureIoTJWS_RootKey AzureIoTJWS_RootKey_t
Holds the values of the root key used to verify the JWS signature.
Azure IoT FreeRTOS middleware result values.
enum AzureIoTResult AzureIoTResult_t
The results used by the middleware.
Holds the values of the root key used to verify the JWS signature.
Definition: azure_iot_jws.h:22
uint32_t ulRootKeyIdLength
Definition: azure_iot_jws.h:24
uint32_t ulRootKeyExponentLength
Definition: azure_iot_jws.h:28
uint32_t ulRootKeyNLength
Definition: azure_iot_jws.h:26
uint8_t * pucRootKeyN
Definition: azure_iot_jws.h:25
uint8_t * pucRootKeyId
Definition: azure_iot_jws.h:23
uint8_t * pucRootKeyExponent
Definition: azure_iot_jws.h:27