diff --git a/client/Crypto.cpp b/client/Crypto.cpp index 1d397b981..33b768c99 100644 --- a/client/Crypto.cpp +++ b/client/Crypto.cpp @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -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 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; }