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
This commit is contained in:
Chris Mc
2023-12-12 09:49:26 -05:00
committed by GitHub
parent 08bcf77a68
commit 8cb307a8eb
4 changed files with 144 additions and 92 deletions

View File

@@ -59,7 +59,7 @@ TEST(HelperTest, ErrorCodeMessages) {
ASSERT_EQ(std::error_code(static_cast<jwt::error::rsa_error>(i)).message(),
std::error_code(static_cast<jwt::error::rsa_error>(-1)).message());
for (i = 10; i < 17; i++) {
for (i = 10; i < 22; i++) {
ASSERT_NE(std::error_code(static_cast<jwt::error::ecdsa_error>(i)).message(),
std::error_code(static_cast<jwt::error::ecdsa_error>(-1)).message());
}