Methods for signing and verifying JSON Web Token (JWT) tokens.
More...
|
struct | atca_jwt_t |
| Structure to hold metadata information about the jwt being built. More...
|
|
|
ATCA_STATUS | atca_jwt_init (atca_jwt_t *jwt, char *buf, uint16_t buflen) |
| Initialize a JWT structure. More...
|
|
ATCA_STATUS | atca_jwt_add_claim_string (atca_jwt_t *jwt, const char *claim, const char *value) |
| Add a string claim to a token. More...
|
|
ATCA_STATUS | atca_jwt_add_claim_numeric (atca_jwt_t *jwt, const char *claim, int32_t value) |
| Add a numeric claim to a token. More...
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
Methods for signing and verifying JSON Web Token (JWT) tokens.
◆ atca_jwt_add_claim_numeric()
Add a numeric claim to a token.
- Note
- This function does not escape strings so the user has to ensure the claim is valid first
- Parameters
-
[in] | jwt | JWT Context to use |
[in] | claim | Name of the claim to be inserted |
[in] | value | integer value to be inserted |
◆ atca_jwt_add_claim_string()
Add a string claim to a token.
- Note
- This function does not escape strings so the user has to ensure they are valid for use in a JSON string first
- Parameters
-
[in] | jwt | JWT Context to use |
[in] | claim | Name of the claim to be inserted |
[in] | value | Null terminated string to be insterted |
◆ atca_jwt_check_payload_start()
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.
- Parameters
-
[in] | jwt | JWT Context to use |
◆ atca_jwt_finalize()
Close the claims of a token, encode them, then sign the result.
- Parameters
-
[in] | jwt | JWT Context to use |
[in] | key_id | Key Id (Slot number) used to sign |
◆ atca_jwt_init()
Initialize a JWT structure.
- Parameters
-
[in] | jwt | JWT Context to initialize |
[in,out] | buf | Pointer to a buffer to store the token |
[in] | buflen | Length of the buffer |
◆ atca_jwt_verify()
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.
- Parameters
-
[in] | buf | Buffer holding an encoded jwt |
[in] | buflen | Length of the buffer/jwt |
[in] | pubkey | Public key (raw byte format) |