Commit Graph

347 Commits

Author SHA1 Message Date
Jonas Borchelt
4e3dd40cfe Replace deprecated wstring_convert (#290)
Co-authored-by: Jonas Borchelt <jonas.borchelt@icloud.com>
2023-05-16 12:57:05 +02:00
hlounent
a068ebd661 Fix build with GCC 13 (#287)
Include <cstdint> for fixed width integers used by base64 library.

Co-authored-by: Hannu Lounento <hannu.lounento@vaisala.com>
2023-04-22 23:33:27 +02:00
Dennis Yakovlev
c2b43e67c1 Added convenience function for binary DER to PEM (#283) 2023-03-14 17:00:41 +01:00
Stéphane Janel
73f2341923 Fix typo in readme (#276) 2023-01-15 19:38:22 +01:00
Dominik Thalhammer
aca3217a3e Update README.md (#269) 2022-11-05 15:03:37 +01:00
gizmocuz
9730001c41 💄 Cast der_signature.length() to 'long' to silence compile warning (#270)
Co-authored-by: Dominik Thalhammer <dominik@thalhammer.it>
2022-11-03 20:12:22 +01:00
Dominik Thalhammer
649530a6f0 ⬆️ Upgrade various ci packages being deprecated soon (#268) 2022-10-31 20:25:38 +01:00
Chris Mc
fb8fe65234 Refactor traits validation to reduce code bloat (#261)
Co-authored-by: Dominik Thalhammer <dominik@thalhammer.it>
2022-10-31 19:54:19 +01:00
Chris Mc
03ad09b996 ⬆️ Update tested JSON libraries (#260)
* bump the json libraries being used

* bost json dropped the standalone mode in 1.79 d20a814685

Co-authored-by: Dominik Thalhammer <dominik@thalhammer.it>
2022-10-23 17:16:24 -07:00
Dominik Thalhammer
24953a6e82 👷 Cache cmake for min-req CI (#267)
The CMake min-req CI action takes ages to complete which is really annoying if you have to wait for it to finish in addition to wasting compute ressources. Turns out the vast majority of its time is spent building cmake every time, which is clearly not necessary. This change updates the workflow to cache the built cmake version and restore it if needed cutting ~7.5 minutes of the build.
2022-10-23 19:03:33 +02:00
Dominik Thalhammer
02e94cafcb ⏫ Update clang-format to 14.0, pin version (#266) 2022-10-23 11:57:38 +02:00
Chris Mc
8e0fb8e438 Fix Nuget workflow (#264) 2022-10-19 21:56:05 +02:00
Diogo Strube (Exp1nt)
74abd24078 NuGet Pkg using GitHub Actions (#262)
This PR is related to discussion https://github.com/Thalhammer/jwt-cpp/issues/243 and is a 3 file contribution:

- `nuget\jwt-cpp.nuspec` contains all the descriptions of the NuGet package, including authors, and the path of files to be copied.
- `nuget\jwt-cpp.targets` automatically set up the "additional include directories" when the package is installed.
- `.github\workflows\nuget.yml` contains the GitHub Action to pack and pub the NuGet package.

Co-authored-by: Diogo Strube de Lima <diogo.strube.lima@gmail.com>
Co-authored-by: Chris Mc <prince.chrismc@gmail.com>
Co-authored-by: Dominik Thalhammer <dominik@thalhammer.it>
2022-10-19 08:24:58 +02:00
Chris Mc
aac4b62923 Add helpers to some crypto APIs that vary by version (#256)
Hides API changes between older OpenSSL versions behind a helper function to improve readability and maintainability of the application code.
2022-10-11 08:05:36 +02:00
Dominik Thalhammer
bdc1a07bda 📤 Use nlohmann_json tar release (#259)
* 📤 Use nlohmann_json tar release

This avoids downloading the whole git repository and restricts the download
to the pieces that are actually important, saving time and traffic.
2022-10-09 18:57:28 +02:00
Chris Mc
5032d59124 🧹 Removing extra exception aliases (#257)
* remove exception outside of error namespace

* linter
2022-10-05 09:09:02 +02:00
Chris Mc
95b3dbf0cd 🔒 Bump OpenSSL to latest releases (#255) 2022-10-03 16:16:51 +02:00
Stéphane Janel
07a2f64b0d 📤 Do not embed nlohmann::json directly, use find_package / FetchContent instead (#254)
* Do not embed nlohmann::json directly, use find_package / FetchContent instead

* Clea up traits workflow

Headers are no longer vendored

Co-authored-by: Chris Mc <prince.chrismc@gmail.com>
2022-10-03 11:01:42 +02:00
Chris Mc
cba92ab173 🔭 Allow generic access to JWT header and payload (#251)
* boost print header claims

* type

* update other example

* lint

* update example

* update example

* update examples

* tidy

* renaming to clarity

* delete old check in traits

* return underlying type
2022-10-02 08:47:10 +02:00
Chris Mc
0628011aeb 🔤 Support for Base64url with case insensitive padding (#219)
* stl algs for `alphabet::index`

* refact `jwt::base` to a namespace

instead of a class

* recursive count passing

* test complicated scenarios

* count padding of variable length

* new percent enconding helper

* spelling

* fix gcc 4.8

* trying to avoid the runtime problem on init list with dynamic values

* :qRevert "trying to avoid the runtime problem on init list with dynamic values"

This reverts commit b9be15e06c397e6c2fecc6d60bde90bbb55f84a2.

* switch to vector

* linter

* missing header

* fix gcc 4.8 more

* more tests with new alphabet
2022-09-19 08:52:07 -07:00
Chris Mc
484bdb086a ⚙️ Restore support for GCC-4.8 (#246)
* Create workflow for targeting specific platforms/compilers

starts with a GCC-4.8 CentOS base

* make sure to install dev tools

* Update targets.yml

* Update targets.yml

* Update targets.yml

* Update targets.yml

* install CMake by hand

* try ubuntu with gcc 4.8

* fix action

* actions/checkout@v3

* latest cmake + set compiler for CMake

* install g++

* fix compiler passed to cmake

* try to run in docker container

* in container we are root

* try an update

* assume yes

* revert to using gh runner image

* permissions

* replace `codecvt` when required

* pass locale

* fix linter

* linter

* revert changes to actions (min for pr)
2022-09-17 21:04:40 -07:00
Dominik Thalhammer
25377cb041 Update Codacy url (#245) 2022-09-17 15:18:17 +02:00
Chris Mc
8945d92a5a 📖 Add generating keys to FAQ (#242)
* 📖 Add generating keys to FAQ

* Fix typos

Co-authored-by: Dominik Thalhammer <thalhammer.d@googlemail.com>
2022-09-16 09:07:12 -07:00
Prosperoh
68309438cf Fix as_date()'s std::bad_cast with decimal value (#240)
Signed-off-by: Dominik Thalhammer <dominik@thalhammer.it>
Co-authored-by: Prosperoh <prosperoh@protonmail.com>
Co-authored-by: Dominik Thalhammer <dominik@thalhammer.it>
2022-09-14 13:04:12 +02:00
Dominik Thalhammer
3ed4ff9704 Use EVP_PKEY_up_ref if available (#238) 2022-09-13 08:52:13 +02:00
Chris Mc
c9a511f436 🔒 Update SSL libraries to latest versions (#235)
* Bump test SSL libraries

* Fix copy paste error

* fix bad spacing

* Update README.md

* bump again

* remove libressl 3.5.3

* Update ssl.yml

* put back 3.5.x for failing badge

* Update action.yml

* point URLs back to main since testing worked

* Only publish badge on push

leftover from me testing on my fork 25 days ago 😭

* Trying using 1.1 apis with libressl

https://github.com/libressl-portable/portable/issues/764#issuecomment-1153548504

Co-Authored-By: Theo Buehler <botovq@users.noreply.github.com>

* Limit new APIs to required version

limit change to older supported versions

* Update tests for new libressl APIs

Co-authored-by: Theo Buehler <botovq@users.noreply.github.com>
2022-06-14 09:02:34 -07:00
Kai Takac
9f36be9392 🔎 Allow to retrieve list of claims (#231)
It is now possible to iterate over the list of claims of a JWK
2022-06-12 18:54:46 -07:00
Chris Mc
5d25462e03 🖊️ Note why as_object() is missing in FAQ (#230) 2022-05-17 23:00:31 -07:00
Chris Mc
6aabc2e81b 🏟️ Add verify context trait template specialization (#229)
* Add verify context template specialization

Co-authored-by:  sirzooro <sirzooro@users.noreply.github.com>

* add `verify_context` to all defaults

Co-authored-by: sirzooro <sirzooro@users.noreply.github.com>
2022-05-17 22:49:58 -07:00
Jan Blome
d7e0936d84 🔧 Fix build with OPENSSL_NO_DEPRECATED (#228)
* Add missing include to fix build with OPENSSL_NO_DEPRECATED

Creating and verifying RSA signatures requires some OpenSSL functions
declared in the `openssl/rsa.h` header. When `OPENSSL_NO_DEPRECATED` is
not defined this header gets indirectly included. But with this define
set the function declarations are missing. This commit adds an explicit
include for the file to fix this.

* Remove unused functions in OpenSSLErrorTest

Some functions from OpenSSL redefined in `OpenSSLErrorTest.cpp` use
types that are not available when `OPENSSL_NO_DEPRECATED` is defined.
Since they do not seem to be actually used this commit simply removes
them.

* Test with OPENSSL_NO_DEPRECATED

Co-authored-by: Chris Mc <prince.chrismc@gmail.com>
2022-05-12 16:43:47 -07:00
Chris Mc
0c810e2faa 🧪 Add test for default cmake options (#227) 2022-05-12 11:17:14 -07:00
Kai Takac
5c588fccd6 Allow moving decoded_jwt (#225) 2022-04-12 13:24:31 +02:00
Carlos
e0f89e042d Update Conan Example (#222)
* bump version in conan example

* use latest picojson version
2022-04-06 08:07:28 -07:00
Chris Mc
af50274c8a Improved issue templates with security policy (#217)
* Update bug-report.yml
* Update support-question.yml
* Create feature-request.yml
* Create security.md
2022-03-14 14:57:17 +01:00
Dominik Thalhammer
9d1a010fea Remove source files from INTERFACE add_library (#210)
* Remove source files from add_library
* Enable examples and tests for CMake min-req check.
closes #209
2022-02-11 13:32:50 +01:00
Chris Mc
4a537e9698 Set version to 0.6.0 (#208) 2022-02-11 12:10:06 +01:00
Chris Mc
ba1077f95d Run CMake with relative paths for Hunter (#206) 2022-02-06 14:13:26 +01:00
Chris Mc
dbe0d7fe9d ❓ Note it's not possible to manipulate signed tokens (#207)
resolves #194
2022-02-05 08:31:33 -08:00
Chris Mc
142d2d38e7 🖊️ Update documentation layout (#202)
* split docs into sub pages

* lets see if we can fix the logo size on doxy

* try usine a theme to make it more modern

* fix bad link

* fix broken link

* Update docs/faqs.md

Co-authored-by: Dominik Thalhammer <thalhammer.d@googlemail.com>

* Update faqs.md

Co-authored-by: Dominik Thalhammer <thalhammer.d@googlemail.com>

* Update Doxyfile

Co-authored-by: Dominik Thalhammer <thalhammer.d@googlemail.com>

* Update README.md

* clean up utc vs localtime FAQ

* fix the table image colors

following https://github.com/jothepro/doxygen-awesome-css#css-variables

* fix colors for class index

* enable graphics diagrams

* fix colors

* fix version number

we missed a patch release

* white space

* fix docs not matching code

* Improve SSL selection docs

Co-authored-by: Dominik Thalhammer <thalhammer.d@googlemail.com>
2022-01-30 16:31:20 -08:00
Chris Mc
f43293dc24 ⬆️ Bump all tested SSL libraries (#204)
* Bump all tested SSL libraries

* revert to 1.1.0 

I forgot theres a broken in the scripts
2022-01-30 10:50:29 -08:00
Chris Mc
3bd600762a 💄 Add a lint job to normalize line endings (#200)
* Add job to normalize line endings

* add missing checkout

* continue to comment

* Update action.yml

* normalize line endings
2022-01-24 23:27:50 -08:00
alexeyserbin
97c8782605 🔐 Make it possible to build with OpenSSL 1.0.1 (#199)
* Make it possible to build with OpenSSL 1.0.1

This patch updates the code in the jwt-cpp/jwt.h header and relaxes the
requirement for OpenSSL's version in the top-level CMakeLists.txt to
allow for compiling with OpenSSL 1.0.1.  The patch works around the
non-constantness of the 'sig' parameter in the signature of the
EVP_DigestVerifyFinal() function in versions of OpenSSL prior to 1.0.2.

I verfied it's now possible to compile with OpenSSL 1.0.1, but I guess
it might be possible to compile even with OpenSSL 1.0.0 after tweaking
the version requirement in CMakeLists.txt.

The new EVP_DigestVerifyFinal() signature was introduced in [1] and then
cherry-picked into the main branch as [2].  The update [1] doesn't
contain any functional change per se: even prior to the update,
EVP_DigestVerifyFinal() implementation was de facto treating the 'sig'
parameter as if it were immutable [3].

[1] 1abfa78a8b
[2] 0f7fa1b190
[3] 27007233db/crypto/evp/m_sigver.c (L163-L187)

* Fix formatting in jwt-cpp/jwt.h

This patch doesn't contain any functional modifications.

This is a follow-up to d74c832bd9fae79c2dcaf0def67e3c2c501a6b80.

* Test against OpenSSL 1.0.1u

Co-authored-by: Chris Mc <prince.chrismc@gmail.com>
2022-01-24 23:09:48 -08:00
Chris Mc
e6b92cca0b 🖌️ With hunter use relative CMake install path (#198) 2022-01-24 13:02:30 -08:00
Chris Mc
8254f7cdfb Composite actions for badging (#196)
* Improved badging actions

use new composite if feature to perform more heavy lifting (making the workflows more DRY)

* only make badges on push

* update ssl traits

* replace success/failure with generic write
2022-01-22 17:37:43 -08:00
Chris Mc
5c9787ebca 🚢 Provide trait implementation for supported JSON libraries (#193)
* quick poc for Thalhammer#174

* Copy paste

* Rename include/jwt-cpp/traits/traits.h to include/jwt-cpp/traits/danielaparker-jsoncons/traits.h

* Create traits.h

* adding a namespace

* mustache + action to automate defaults generation

since they should always be the same

* fix order

* traits tests should use traits

* playing with header order

to make clang happy

* install all possible traits 

switch badge name to sha

* Update CMakeLists.txt

* Update traits.h

* try commenting corrected code

* rm typescript

* make sure to implace edit

* dont comment when no diff

* apply linting

* fixup boost-json traits

* move comment and render to composite action

* actions/github-script does not leave context in the usual spot

* enabled globstar

* make sure to forward inputs

* try using env normally

* fix typo

* pass in linter name correctly

* debug print

* fix linting issues

* more debug printing

* fix linting issues

* fix typpo + more rebug print

* apply linting

* more debug

* try npm install global to be less intrusive

* wip render traits tests

* Update lint.yml

* global install does not work

* Update action.yml

* Update defaults.h

* remove nodejs action poc

* include jsoncons in main test application (for coverage of new files)

* do not exclude json (since it's used by all the traits)

* exclude bundled json libraries

* apply linting

* add jsoncons for coverage testing

* jsoncons set default to a viable version

* exploring ci failure

* Revert "exploring ci failure" it's overlapping symbols

This reverts commit 3d5b7f9f5d4f393f03b84a59557fecdee833c822.

* add missing specialization

* be explicit with the tests

* Create CMakeLists.txt

* Create danielaparker-jsoncons.cpp

* Update lint.yml

* Update traits.yml

* lint

* better access too decoded claims

* more tests on verify

* tweak test

trying to find minimum

* lets enable linting tests

* using env impl for github script

* fix typo

* apply linting

* add boost to the tests (very hacky)

* Update lint.yml

* ceate light boost installer

there is no cmake install anymore so just a blanket copy should do

* remove path requirement

* outline for commit and push linting on comment

* try different webhook target

* more event types

* fix if for more event types

* just a test commit

* Update lint.yml

* Update lint.yml

* Update lint.yml

* Apply automatic changes

* add token

* screw up formatting

* Update lint.yml

* Update lint.yml

* Apply automatic changes

* fix merge conflicts

* missing errors

* playing with globbing

* lint issues

* matrix on comment should give many pushes

* Apply automatic changes

* Update lint.yml

* Apply automatic changes

* Apply automatic changes

* fix rebase

* apply render tests

* Apply automatic changes

* Apply automatic changes

* Delete package-lock.json

* fail linting

* Update .gitignore

* Update lint.yml

* Update lint.yml

* Update lint.yml

* Apply automatic changes

* Update lint.yml

* Update CMakeLists.txt

* refactor boost.json inclusion

- find paths
- compile library
- code coverage
- traits example

* Apply automatic changes

* debug log

* Update action.yml

* debug output

* Update action.yml

* Delete private-boost-json.cpp.in

* Update private-find-boost-json.cmake

* Update CMakeLists.txt

* Update CMakeLists.txt

* Create CMakeLists.txt

* Update boost-json.cpp

* Update boost-json.cpp

* Update boost-json.cpp

* Update boost-json.cpp

* remove old boost tests

* examples to include traits

* fix compilation

* test nlohmann json traits

* linting

* refactor traits to make badges

* try with less expression syntax

* trying single quotes

* advertise traits support

* Update lint.yml

* Update lint.yml

* Update lint.yml

* sync (prince-chrismc/jwt-cpp#16)

* 🔧 Replace RSA related deprecated functions (#189)

* RSA_size() --> EVP_PKEY_size()

* getting rid of deprecated functions in rsa-pss signature creation

* getting rid of deprecated functions in rsa-pss signature verification

* generate_hash not used in pss

* Update lint.yml

* Update lint.yml

* Update lint.yml

Co-authored-by: Marek Klein <kleinmrk@gmail.com>

* Update lint.yml

* make sure to use install `nlohmann-json`

* make action folder match trait names

* add example + badge for kazuho-picojson

* link to new examples

* revert debug code

* dont mix matrix with uses

* fix bad copy paste

* spec interface library so it's no compiled

* fix installer

* fix to interface

* fix example

* attempt 2

* make sure to avoid circular reference

* attempt 3

* white space

* white space

* Update and rename .github/actions/comment-linting/action.yml to .github/actions/process-linting-results/action.yml

* Update lint.yml

* Update action.yml

* Update action.yml

* Update README.md

Co-authored-by: prince-chrismc <prince-chrismc@users.noreply.github.com>
Co-authored-by: Marek Klein <kleinmrk@gmail.com>
2022-01-17 14:05:01 -08:00
Marek Klein
275c750fa1 🔧 Replace deprecated OpenSSL functions (#191)
* do not use deprecated functions in ecdsa context

* check ecdsa key on creation

* add test

* set compiler flags correctly

* set compiler flags correctly attempt 2

Co-authored-by: Chris McArthur <prince.chrismc@gmail.com>
2021-12-12 10:25:43 -08:00
Marek Klein
55aaf31ad8 🔧 Replace RSA related deprecated functions (#189)
* RSA_size() --> EVP_PKEY_size()

* getting rid of deprecated functions in rsa-pss signature creation

* getting rid of deprecated functions in rsa-pss signature verification

* generate_hash not used in pss
2021-11-22 20:18:50 -08:00
Marek Klein
66eea980b5 🗜️ Simplify reading of EC keys (#185)
* simplify reading of EC keys

* fix formatting
2021-11-18 20:26:03 -08:00
Chris Mc
b8e55e2560 ⬆️ Bump WolfSSL to v5.0.0 (#184)
* Update ssl.yml

* Update README.md

* Update ssl.yml

* Update README.md

* update test data to 5.0 impl

* remove older abi version

the data generated changed so the test code no longer supports the old way

something ~4.8 should work
2021-11-17 08:17:57 -08:00
Chris Mc
95eacaade5 🔑 Minimal key usage in RSA examples (#183)
* remove private key
* remove public key
2021-11-11 20:33:10 -08:00