Skip to content

Commit

Permalink
Fix CDoc 1 OID usage
Browse files Browse the repository at this point in the history
IB-7935

Signed-off-by: Raul Metsma <[email protected]>
  • Loading branch information
metsma committed Dec 28, 2023
1 parent 4384a8c commit 07300ec
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions client/Crypto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <QtNetwork/QSslKey>

#include <openssl/aes.h>
#include <openssl/core_names.h>
#include <openssl/ec.h>
#include <openssl/err.h>
#include <openssl/evp.h>
Expand Down Expand Up @@ -163,9 +164,20 @@ QByteArray Crypto::concatKDF(QCryptographicHash::Algorithm hashAlg, quint32 keyD

QByteArray Crypto::curve_oid(EVP_PKEY *key)
{
ASN1_OBJECT *obj = OBJ_nid2obj(EC_GROUP_get_curve_name(EC_KEY_get0_group(EVP_PKEY_get0_EC_KEY(key))));
std::array<char, 64> group{};
QByteArray buf(50, 0);
buf.resize(int(OBJ_obj2txt(buf.data(), buf.size(), obj, 0)));
size_t size = group.size();
if(EVP_PKEY_get_utf8_string_param(key, OSSL_PKEY_PARAM_GROUP_NAME, group.data(), group.size(), &size) != 1)
{
buf.clear();
return buf;
}

ASN1_OBJECT *obj = OBJ_nid2obj(OBJ_sn2nid(group.data()));
if(int size = OBJ_obj2txt(buf.data(), buf.size(), obj, 1); size != NID_undef)
buf.resize(size);
else
buf.clear();
return buf;
}

Expand Down

0 comments on commit 07300ec

Please sign in to comment.