blob: 6d296de85c4fb48e0d9bb8277ce1c3a7b268c1ca [file]
@mainpage Welcome to LibJWT
@section standards \emoji :bulb: Supported Standards
Standard | RFC | Description
-------- | :--------: | ----------------------
``JWS`` | @rfc{7515} | JSON Web Signature
``JWE`` | @rfc{7516} | JSON Web Encryption
``JWK`` | @rfc{7517} | JSON Web Keys and Sets
``JWA`` | @rfc{7518} | JSON Web Algorithms
``JWT`` | @rfc{7519} | JSON 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.
@section building \emoji :construction: Build Prerequisites
@subsection req Required
- A JSON library: either [Jansson](https://github.com/akheron/jansson)
(>= 2.0, the default) or [json-c](https://github.com/json-c/json-c)
(>= 0.16, selected with ``-DWITH_JSON_C=ON``). The two are interchangeable.
- [CMake](https://cmake.org) (>= 3.7)
@subsection req_crypto Crypto support
- OpenSSL (>= 3.0.0)
- GnuTLS (>= 3.8.8)
- MbedTLS (>= 3.6.0)
@note At least one crypto backend is required, but any non-empty combination
works. OpenSSL is enabled by default and can be disabled with
``-DWITH_OPENSSL=OFF``. Each backend parses and converts JWK(S) natively.
@subsection crypto_support Algorithm support matrix
JWS Algorithm ``alg`` | OpenSSL | GnuTLS | MbedTLS
:---------------------------- | :------------------------ | :------------------------ | :------------------------
``HS256`` ``HS384`` ``HS512`` | \emoji :white_check_mark: | \emoji :white_check_mark: | \emoji :white_check_mark:
``ES256`` ``ES384`` ``ES512`` | \emoji :white_check_mark: | \emoji :white_check_mark: | \emoji :white_check_mark:
``RS256`` ``RS384`` ``RS512`` | \emoji :white_check_mark: | \emoji :white_check_mark: | \emoji :white_check_mark:
``EdDSA`` using ``ED25519`` | \emoji :white_check_mark: | \emoji :white_check_mark: | \emoji :x:
``EdDSA`` using ``ED448`` | \emoji :white_check_mark: | \emoji :white_check_mark: | \emoji :x:
``PS256`` ``PS384`` ``PS512`` | \emoji :white_check_mark: | \emoji :white_check_mark: | \emoji :white_check_mark:
``ES256K`` | \emoji :white_check_mark: | \emoji :x: | \emoji :white_check_mark:
@note On the GnuTLS backend, loading a "seed-only" OKP private JWK (an
``Ed25519``/``Ed448`` key with ``d`` but no public coordinate ``x``) requires
GnuTLS >= 3.8.13. Older GnuTLS crashes deriving the public key, so LibJWT
rejects such keys. A key that carries ``x``, any public key, and PEM/DER keys
are unaffected (as are the OpenSSL and MbedTLS backends). The version is checked
at runtime, so upgrading the shared ``libgnutls`` lifts this without rebuilding
LibJWT.
@subsubsection jwe_support JWE
LibJWT supports JWE (RFC 7516) Compact Serialization with a single recipient,
using a key management algorithm (``alg``) plus a content encryption
algorithm (``enc``).
Legend: \emoji :white_check_mark: native implementation ·
\emoji :x: not supported
JWE key management ``alg`` | OpenSSL | GnuTLS | MbedTLS
:---------------------------- | :------------------------ | :------------------------ | :------------------------
``dir`` | \emoji :white_check_mark: | \emoji :white_check_mark: | \emoji :white_check_mark:
``A128KW`` ``A192KW`` ``A256KW`` | \emoji :white_check_mark: | \emoji :white_check_mark: | \emoji :white_check_mark:
``RSA-OAEP`` (SHA-1) | \emoji :white_check_mark: | \emoji :x: | \emoji :white_check_mark:
``RSA-OAEP-256`` | \emoji :white_check_mark: | \emoji :white_check_mark: | \emoji :white_check_mark:
``ECDH-ES`` (+ ``+A128KW``/``+A192KW``/``+A256KW``) | \emoji :white_check_mark: | \emoji :white_check_mark: | \emoji :white_check_mark:
JWE content encryption ``enc`` | OpenSSL | GnuTLS | MbedTLS
:----------------------------- | :------------------------ | :------------------------ | :------------------------
``A128GCM`` ``A192GCM`` ``A256GCM`` | \emoji :white_check_mark: | \emoji :white_check_mark: | \emoji :white_check_mark:
``A128CBC-HS256`` ``A192CBC-HS384`` ``A256CBC-HS512`` | \emoji :white_check_mark: | \emoji :white_check_mark: | \emoji :white_check_mark:
@note ``ECDH-ES`` supports both Direct Key Agreement and ``+A*KW`` key
wrapping, on the EC curves P-256/384/521 and the OKP curves X25519/X448, with
optional ``apu``/``apv`` PartyInfo. ``RSA1_5`` and ``zip`` are intentionally
not supported. Each backend implements JWE natively. GnuTLS/Nettle cannot
perform RSA-OAEP with SHA-1, so the GnuTLS backend does not support plain
``RSA-OAEP`` (``RSA-OAEP-256`` is native). The ``X25519``/``X448`` OKP curves
require GnuTLS >= 3.8.13 on the GnuTLS backend (checked at runtime).
@subsection optional Optional
- [Check Library](https://github.com/libcheck/check/issues) (>= 0.9.10) for unit
testing
- [Doxygen](https://www.doxygen.nl) (>= 1.13.0) for documentation
@section docs \emoji :open_book: Docs and Source
Guides: @ref examples "Usage Examples" walks the API from the simplest token up;
@ref profiles "Application Profiles" composes the primitives into real-world
recipes (at+jwt, VAPID, PASSporT, OpenID4VCI, DPoP, mTLS, JAdES).
\emoji :link: [Current Docs](https://libjwt.io)
\emoji :link: [Legacy Docs v2.1.1](https://libjwt.io/stable)
\emoji :link: [GitHub Repo](https://github.com/benmcollins/libjwt)
@section prebuilt \emoji :package: Pre-built Packages
LibJWT is available in most Linux distributions as well as through
[Homebrew](https://formulae.brew.sh/formula/libjwt#default)
for Linux, macOS, and Windows.
@section instructions \emoji :hammer: Build Instructions
@subsection cmake With CMake:
@code{.sh}
$ mkdir build
$ cd build
$ cmake ..
$ make
@endcode