CryptoAuthLib
Microchip CryptoAuthentication Library
atca_jwt.h
Go to the documentation of this file.
1 
28 #ifndef ATCA_JWT_H_
29 #define ATCA_JWT_H_
30 
35 #include "cryptoauthlib.h"
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
42 typedef struct
43 {
44  char* buf; /* Input buffer */
45  uint16_t buflen; /* Total buffer size */
46  uint16_t cur; /* Current location in the buffer */
47 } atca_jwt_t;
48 
49 ATCA_STATUS atca_jwt_init(atca_jwt_t* jwt, char* buf, uint16_t buflen);
50 ATCA_STATUS atca_jwt_add_claim_string(atca_jwt_t* jwt, const char* claim, const char* value);
51 ATCA_STATUS atca_jwt_add_claim_numeric(atca_jwt_t* jwt, const char* claim, int32_t value);
52 ATCA_STATUS atca_jwt_finalize(atca_jwt_t* jwt, uint16_t key_id);
54 ATCA_STATUS atca_jwt_verify(const char* buf, uint16_t buflen, const uint8_t* pubkey);
55 
57 #ifdef __cplusplus
58 }
59 #endif
60 
61 #endif /* ATCA_JWT_H_ */
ATCA_STATUS atca_jwt_finalize(atca_jwt_t *jwt, uint16_t key_id)
Close the claims of a token, encode them, then sign the result.
Definition: atca_jwt.c:105
ATCA_STATUS atca_jwt_add_claim_string(atca_jwt_t *jwt, const char *claim, const char *value)
Add a string claim to a token.
Definition: atca_jwt.c:215
Structure to hold metadata information about the jwt being built.
Definition: atca_jwt.h:42
ATCA_STATUS
Definition: atca_status.h:41
uint16_t cur
Definition: atca_jwt.h:46
uint16_t buflen
Definition: atca_jwt.h:45
ATCA_STATUS atca_jwt_init(atca_jwt_t *jwt, char *buf, uint16_t buflen)
Initialize a JWT structure.
Definition: atca_jwt.c:64
char * buf
Definition: atca_jwt.h:44
Single aggregation point for all CryptoAuthLib header files.
void atca_jwt_check_payload_start(atca_jwt_t *jwt)
Check the provided context to see what character needs to be added in order to append a claim...
Definition: atca_jwt.c:41
ATCA_STATUS atca_jwt_verify(const char *buf, uint16_t buflen, const uint8_t *pubkey)
Verifies the signature of a jwt using the provided public key.
Definition: atca_jwt.c:285
ATCA_STATUS atca_jwt_add_claim_numeric(atca_jwt_t *jwt, const char *claim, int32_t value)
Add a numeric claim to a token.
Definition: atca_jwt.c:251