jwt: Use "long long" for json integers if jansson supports it

On win64 (of course), a long is only 4-bytes, which could lead to
overflows for things like "exp" claims.

We key off of JSON_INTEGER_IS_LONG_LONG in jansson_config.h to sync
with that library. We still avoid exposing jansson.h in jwt.h, so
that's good.

This might break ABI on win64. I'm not sure. It almost certainly
breaks ABI on 32-bit systems where the anonymous union in jwt_value_t
would only have been 4-bytes.

On win64 the union was 8-bytes anyway because of the pointers. Now,
however, we wont be casting claims to 32-bits in this case.

So...bump the SO_VERSION, or not? Time will tell.

Fixes #220

Signed-off-by: Ben Collins <bcollins@libjwt.io>
6 files changed
tree: c2890affd8c180939d62630b41604206ee82b5f7
  1. .github/
  2. cmake/
  3. doxygen/
  4. images/
  5. include/
  6. libjwt/
  7. tests/
  8. tools/
  9. .gitignore
  10. CMakeLists.txt
  11. LICENSE
  12. README.md
README.md

LibJWT - The C JWT Library

codecov

maClara

[!WARNING] Version 3 of LibJWT is a complete overhaul of the code. Please see documentation for usage.

:bulb: Supported Standards

StandardRFCDescription
JWS:page_facing_up: RFC-7515JSON Web Signature
JWE:page_facing_up: RFC-7516JSON Web Encryption
JWK:page_facing_up: RFC-7517JSON Web Keys and Sets
JWA:page_facing_up: RFC-7518JSON Web Algorithms
JWT:page_facing_up: RFC-7519JSON Web Token

[!NOTE] Throughout this documentation you will see links such as the ones above to RFC documents. These are relevant to that particular part of the library and are helpful to understand some of the specific standards that shaped the development of LibJWT.

:construction: Build Prerequisites

Required

Crypto support

  • OpenSSL (>= 3.0.0)
  • GnuTLS (>= 3.6.0)
  • MbedTLS (>= 3.6.0)

[!NOTE] OpenSSL is required and used for JWK(S) operations.

Algorithm support matrix

JWS Algorithm algOpenSSLGnuTLSMbedTLS
HS256 HS384 HS512:white_check_mark::white_check_mark::white_check_mark:
ES256 ES384 ES512:white_check_mark::white_check_mark::white_check_mark:
RS256 RS384 RS512:white_check_mark::white_check_mark::white_check_mark:
EdDSA using ED25519:white_check_mark::white_check_mark::x:
EdDSA using ED448:white_check_mark::white_check_mark: >= 3.8.8:x:
PS256 PS384 PS512:white_check_mark::white_check_mark::white_check_mark:*
ES256K:white_check_mark::x::white_check_mark:

* RSASSA-PSS support in MbedTLS depends on Mbed-TLS/TF-PSA-Crypto#154

Optional

:books: Docs and Source

:link: Current Docs

:link: Legacy Docs v2.1.1

:link: GitHub Repo

:package: Pre-built Packages

LibJWT is available in most Linux distributions as well as through Homebrew for Linux, macOS, and Windows.

:hammer: Build Instructions

With CMake:

$ mkdir build
$ cd build
$ cmake ..
$ make