libjwt-1.17.0
|
Functions that enable seeing the plain text or fully encoded version of a JWT object. More...
Functions | |
int | jwt_dump_fp (jwt_t *jwt, FILE *fp, int pretty) |
Output plain text representation to a FILE pointer. | |
char * | jwt_dump_str (jwt_t *jwt, int pretty) |
Return plain text representation as a string. | |
int | jwt_encode_fp (jwt_t *jwt, FILE *fp) |
Fully encode a JWT object and write it to FILE. | |
char * | jwt_encode_str (jwt_t *jwt) |
Fully encode a JWT object and return as a string. | |
void | jwt_free_str (char *str) |
Free a string returned from the library. | |
Functions that enable seeing the plain text or fully encoded version of a JWT object.
int jwt_dump_fp | ( | jwt_t * | jwt, |
FILE * | fp, | ||
int | pretty ) |
Output plain text representation to a FILE pointer.
This function will write a plain text representation of this JWT object without Base64 encoding. This only writes the header and body, and does not compute the signature or encryption (if such an algorithm were being used).
Note, this may change the content of JWT header if algorithm is set on the JWT object. If algorithm is set (jwt_set_alg was called on the jwt object) then dumping JWT attempts to append 'typ' header. If the 'typ' header already exists, then it is left untouched, otherwise it is added with default value of "JWT".
jwt | Pointer to a JWT object. |
fp | Valid FILE pointer to write data to. |
pretty | Enables better visual formatting of output. Generally only used for debugging. |
char * jwt_dump_str | ( | jwt_t * | jwt, |
int | pretty ) |
Return plain text representation as a string.
Similar to jwt_dump_fp() except that a string is returned. The string must be freed by the caller.
Note, this may change the content of JWT header if algorithm is set on the JWT object. If algorithm is set (jwt_set_alg was called on the jwt object) then dumping JWT attempts to append 'typ' header. If the 'typ' header already exists, then it is left untouched, otherwise it is added with default value of "JWT".
jwt | Pointer to a JWT object. |
pretty | Enables better visual formatting of output. Generally only used for debugging. |
int jwt_encode_fp | ( | jwt_t * | jwt, |
FILE * | fp ) |
Fully encode a JWT object and write it to FILE.
This will create and write the complete JWT object to FILE. All parts will be Base64 encoded and signatures or encryption will be applied if the algorithm specified requires it.
jwt | Pointer to a JWT object. |
fp | Valid FILE pointer to write data to. |
char * jwt_encode_str | ( | jwt_t * | jwt | ) |
Fully encode a JWT object and return as a string.
Similar to jwt_encode_fp() except that a string is returned. The string must be freed by the caller. If you changed the allocation method using jwt_set_alloc, then you must use jwt_free_str() to free the memory.
jwt | Pointer to a JWT object. |
void jwt_free_str | ( | char * | str | ) |
Free a string returned from the library.
str | Pointer to a string previously created with jwt_encode_str(). |