I am working on a project using LibJWT that has to be portable to Windows and Linux. For Windows, we are not allowed to store our keys outside of the Windows certificate store. So, I ported the code, and created a jwt-wincrypt.c implementation that uses Windows CNG APIs, and I have verified that HMAC, RSA, and ECC algorithms are working.
For public keys, the code continues to accept PEM-encoded public keys, but it will also accept a Windows cert store path of the form: cert:\LocalMachine\My<thumbprint>. For private keys, there are unfortunately no good Windows APIs for importing PEM-encoded private keys, and so currently the code only accepts Windows cert store paths for jwt_encode. ("It's a feature!" -- Since realistically, no one on Windows is going to put their private keys in files.)
In addition, porting to Windows uncovered a memory management issue with the DLLs, where for whatever reason, sometimes when LibJWT would free a buffer allocated by Jansson, it would result in an AV in the heap code. To deal with Windows runtime issues with DLLs, I added the ability to set malloc, free, and realloc functions to the API, and this method propagates those down to Jansson, which also has this ability. I also added a "jwt_free_str" function that should be used to free strings allocated by jwt_encode_str. The malloc/free thing required me to rename all the allocation and free calls in the code to jalloc, jfree, etc.
Anyway, I would like to make a branch and submit a PR for this so I can get comments on it. Please let me know how I can go about doing that. Either I can become a contributor, or I can upload the patch file. Let me know.