Commit Graph

14 Commits

Author SHA1 Message Date
Chris Mc
953aab6fe4 Add helper for making RSA key from exponent and modulus (#307)
* - Added creation of public key from its components
- Split verify function to signature and claims
- Added handling of claims set in json while creating a verifier

* - Added creation of public key from its components
- Split verify function to signature and claims
- Added handling of claims set in json while creating a verifier

* Fixed missing lines

* Added unit tests

* Additional changes

* delete

* refactor free

* remove testing

* align white space

* Update tests/PubKeyTest.cpp

Yes I should have removed it. Used it in testing

Co-authored-by: Chris Mc <prince.chrismc@gmail.com>

* Add support for 1.0.2

* refactor a bit

* user jwt define for SSL API that is cross-library

* add support for no base64 from jwt

* refactor a bit more

* fixup wolfssl + linters

* missing include for openssl 3

* quick draft of openssl 3 implementation

* linter

* add in a health layer of error handling and memory management

* flip function order

* fix typo

* error tests for openssl

* more all helper tests to one file

* update cmake

* update tests

* more negative test cases

* fixup old api calls depending on version

* linter

* fixup return types

* disable failing tests

* fixup copy passed

* disable more tests

* fixup broke tests

* better error code handling

* test asan with more openssl versions

* fix template render path

* fix cache conflict

running different ubuntu docker images for with different GLIB c and cxx ABIs

* add missing lib to tests

* run both openssl versions with asan

* openssl code always calls new and returns an adress in most cases

so always save the pointer to call free?

* go back to old raw2bn implementation

* Revert "openssl code always calls new and returns an adress in most cases"

This reverts commit 45e85b8c667587236ac3dd255d1450bcf22f5723.

* remove add new tests (needs to be a seperate pr)

* fix jwks verify example + run with asan+lsan

* some extra backwards compat for ssl1.1

* compat rsa keygen

* fixup copy paste

* fix typo

* linter

* wolfssl compat

* compat 1.1.0i

* more compat

since they changed the API with ever version

* linter

* fix 1.1.0

* more compat

* more compat

working on the matrix of wolfssl and libress and 1.1.0

* updated example with hardcoded values

* action to install openssl now sets ENV vars for CMake

https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/FindOpenSSL.cmake#L233

https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable

https://gitlab.kitware.com/cmake/cmake/-/issues/24236

* update example to create a valid token

* update asan to latest compiler

* clang tidy

* fix memory leak in openssl 1.1.1

this is theoretically only because of the test code but better safe then sorry

* clang format

* improve docs

* enable one more test

* fix test impl signature

* more test for bio to std::string

* DRY up code with new helper for write_bio_to_string

* fix copy paste + spell checking

* linter

* fix typo

* fix return type

* BIO_get_mem_data is just a define

so fixup error implementation to match

* put extra tests in too many places

its only for certs not just pubkeys

---------

Co-authored-by: ZOHARGO <zohargo@amdocs.com>
Co-authored-by: zgofer1 <zgofer@gmail.com>
2023-12-26 12:23:21 -05:00
Chris Mc
8cb307a8eb Remove duplicated key handlers (#318)
* add a quick test to see if rsa helpers handle ec certs

LoadPublicKeyFromStringReferenceWithEcCert

* run all tests with generic helper

* template out error category and new tests

* linter

* missing enum entry

* does convert_base64_der_to_pem work with ecdsa?

* use correct EC curve functions

* missing extern symbol

* dont change behavior

* typo

* fix tests

* update private key to be more generic

* fixup 2 more tests

* update exception for libressl 3.5.3

https://github.com/Thalhammer/jwt-cpp/actions/runs/7161143039/job/19496334109?pr=318#step:8:248

```
[ RUN      ] OpenSSLErrorTest.ECDSACertificate
/home/runner/work/jwt-cpp/jwt-cpp/tests/OpenSSLErrorTest.cpp:487: Failure
Expected equality of these values:
  ec
    Which is: ecdsa_error:19
  e.expected_ec
    Which is: rsa_error:12
```

* linter

* add missing test

* fix copy paste

* typo part 2
2023-12-12 09:49:26 -05:00
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
Dennis Yakovlev
c2b43e67c1 Added convenience function for binary DER to PEM (#283) 2023-03-14 17:00:41 +01: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
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
de457af919 🐺 Add WolfSSL support (#171)
* outline for wolfssl support

lots of missing symbols

* rm old libressl dockerfile

* ass wolfssl test + dry up workflows

with improved composite action having `use` keyword

* autoreconf

* brute force zap openssl headers

* Update action.yml

* try to access nested headers

* trying to log include headers

* more debug logs

* fix bad variable

* tweaks

* more features

* cleanup

* wolfssl is special like libressl

* test header order

* revert order

* trying wolfssl master

* adding wolfssl compatiblity macros

trying to get access to

1662b01157/wolfssl/ssl.h (L3960)

* trying no newline

to fix tests

* typo

* bad copy paste pt2

* not a new line problem

* typo

* workaround failing helper test

* update cmake test

list(TRANSFORM raised min

* test cmake install with wolfSSL

* add missing EOF

* more generic wolfssl install

since there is no release that works yet

* typo

* debug print

* add more checks

* force HAVE_ECC

* install master

* hunter does not support wolfssl

* pretty job name

* clean up

* Update README.md

* bump to latest master

* Update cmake.yml

* bump coveralls action

* switch badge name to sha

* Update jwt.yml

they published a bad tag =)
2021-09-21 21:30:54 -04:00
Chris Mc
b21d80c22e 🧰 Linting and maintenance (#120)
* some manual fixes to obtain

* fairly close enough

* whitespace fixes

* add comment

* adding clang format + applied

* add editorconfig (supported natively by github web editor)

* apply linting to project

* clean up CI workflows

* zap vcpkg folder

actual one is here
https://github.com/microsoft/vcpkg/tree/master/ports/jwt-cpp

* adding a logo

* thin the lines in the pluses

* use logo + more links to spec and examples

* Create lint.yml

* apply linting
2021-01-11 17:37:14 -05:00
Chris Mc
ca110ade5b 🔧 Improved CMake options and macros to prevent collisions (#109)
* exclude any folder prefixed with build

* seeing how far generator expresstion will go

* refactor cmake + outline some tests

* adding missing install destiniation

* rolling back some changes since the workflow was no support by CMake

* adding missing include

* fixing old variable names being used

* using target_compile_definitions instead of options

* correct options for CI + reporting errors for consumer

* using sudo to install

* fix bad variable

* trying CMAKE_PREFIX_PATH

* removing recursive call

* remove options from generators + dedicated exports target

* remove pthread link lib (unused)

* install targets files + include

* add missing main

* remove install prefix

* revive CMAKE_PREFIX_PATH it's really needed

* fix collision on DISABLE_BASE64 + more cmake tests

* bump cmake version + test minimum

* fix job names

* fix bad replace

* fix bad permissions

* fix install of picojson

* adding missing ifndef and overload for pico and no base64

* linting

* test for version

* trying to find version

* [test] remove semver prerelase from CMake

* fixing some documentation issues

* limit cmake test to only related files

* touch up docs

* making sure new helper supports no base64 mode

* some doc fixes

* Update cmake.yml

* Update .github/workflows/cmake.yml

* Update .gitignore
2020-11-29 15:56:53 +01:00
Jaideep Bajwa
aa258bdfdf Add helper function to convert cert from base64DER to PEM (#106)
* Add helper function to convert cert from base64DER to PEM

This is particularly useful when dealing with JWKs x5c claim which
is encoded as base64 DER. With this helper function the client can
convert x5c claim to PEM, which makes it easy to interact with this
library.
2020-11-08 22:04:51 +01:00
Dominik Thalhammer
9711259ef2 Openssl testing (#90)
* Add error_code support to algorithm::verify

* Add error_code support for signing

* Add error_code overloads to verifying

* Fix missing throw

* Improvements

* Remove unused throwing overloads

* Fix test on older gtest

* Found bug and added more testing

* Move exceptions into error namespace

* Initial implementation of openssl tests

* Fix tests for older compilers

* Only enable openssl test on openssl >=1.1
2020-07-21 18:47:10 +02:00
Christopher McArthur
a9a1b80eda adding tests to cmake 2020-01-19 17:25:51 -05:00
Christopher McArthur
bb42fd9472 moving tests to a subdir 2020-01-19 15:08:20 -05:00