File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -1570,6 +1570,18 @@ namespace jwt {
1570
1570
throw error::ecdsa_exception (error::ecdsa_error::invalid_key_size);
1571
1571
}
1572
1572
1573
+ ecdsa (helper::evp_pkey_handle private_key, const EVP_MD* (*md)(), std::string name, size_t siglen)
1574
+ : pkey(std::move(private_key)), md(md), alg_name(std::move(name)), signature_length(siglen) {
1575
+ if (pkey) {
1576
+ check_private_key (pkey.get ());
1577
+ } else {
1578
+ throw error::ecdsa_exception (error::ecdsa_error::no_key_provided);
1579
+ }
1580
+ size_t keysize = EVP_PKEY_bits (pkey.get ());
1581
+ if (keysize != signature_length * 4 && (signature_length != 132 || keysize != 521 ))
1582
+ throw error::ecdsa_exception (error::ecdsa_error::invalid_key_size);
1583
+ }
1584
+
1573
1585
/* *
1574
1586
* Sign jwt data
1575
1587
* \param data The data to sign
You can’t perform that action at this time.
0 commit comments