Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support passing ssl library key handles to algorithms #369

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions include/jwt-cpp/jwt.h
Original file line number Diff line number Diff line change
Expand Up @@ -1570,6 +1570,18 @@ namespace jwt {
throw error::ecdsa_exception(error::ecdsa_error::invalid_key_size);
}

ecdsa(helper::evp_pkey_handle private_key, const EVP_MD* (*md)(), std::string name, size_t siglen)
: pkey(std::move(private_key)), md(md), alg_name(std::move(name)), signature_length(siglen) {
if (pkey) {
check_private_key(pkey.get());
} else {
throw error::ecdsa_exception(error::ecdsa_error::no_key_provided);
}
size_t keysize = EVP_PKEY_bits(pkey.get());
if (keysize != signature_length * 4 && (signature_length != 132 || keysize != 521))
throw error::ecdsa_exception(error::ecdsa_error::invalid_key_size);
}

/**
* Sign jwt data
* \param data The data to sign
Expand Down
Loading