mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
fix p256 public key
This commit is contained in:
parent
a23c4d4159
commit
e27c13284f
1 changed files with 7 additions and 17 deletions
|
|
@ -811,23 +811,13 @@ namespace crypto {
|
|||
) != static_cast<int>(privateSize)) {
|
||||
fail("ECDSA private key encoding failed");
|
||||
}
|
||||
std::size_t publicSize = 0;
|
||||
if (EVP_PKEY_get_octet_string_param(
|
||||
key.get(), OSSL_PKEY_PARAM_PUB_KEY, nullptr, 0, &publicSize
|
||||
) != 1) {
|
||||
fail("ECDSA public key size query failed");
|
||||
}
|
||||
result.publicKey.resize(publicSize);
|
||||
if (EVP_PKEY_get_octet_string_param(
|
||||
key.get(),
|
||||
OSSL_PKEY_PARAM_PUB_KEY,
|
||||
result.publicKey.data(),
|
||||
result.publicKey.size(),
|
||||
&publicSize
|
||||
) != 1) {
|
||||
fail("ECDSA public key export failed");
|
||||
}
|
||||
result.publicKey.resize(publicSize);
|
||||
result.publicKey = ecPrivateKey(
|
||||
curve,
|
||||
std::string_view(
|
||||
reinterpret_cast<const char*>(result.privateKey.data()),
|
||||
result.privateKey.size()
|
||||
)
|
||||
).publicKey;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue