12#include <QSharedPointer>
14#include <openssl/bn.h>
15#include <openssl/ec.h>
16#include <openssl/ecdsa.h>
17#include <openssl/evp.h>
27 static QByteArray
point2oct(
const QSharedPointer<const EC_GROUP>& pCurve,
const EC_POINT* pPoint,
bool pCompressed =
false);
29 static QSharedPointer<EC_POINT>
oct2point(
const QSharedPointer<const EC_GROUP>& pCurve,
const QByteArray& pCompressedData);
31 static QSharedPointer<EC_GROUP>
create(EC_GROUP* pEcGroup);
33#if OPENSSL_VERSION_NUMBER < 0x30000000L
34 static QSharedPointer<EC_KEY>
create(EC_KEY* pEcKey);
37 static QSharedPointer<EC_POINT>
create(EC_POINT* pEcPoint);
39 static QSharedPointer<BIGNUM>
create(BIGNUM* pBigNum);
41 static QSharedPointer<EVP_PKEY>
create(EVP_PKEY* pEcGroup);
43 static QSharedPointer<EVP_PKEY_CTX>
create(EVP_PKEY_CTX* pEcGroup);
45#if OPENSSL_VERSION_NUMBER >= 0x30000000L
46 static QByteArray getEncodedPublicKey(
const QSharedPointer<EVP_PKEY>& pKey);
47 static QSharedPointer<BIGNUM> getPrivateKey(
const QSharedPointer<const EVP_PKEY>& pKey);
48 static QSharedPointer<OSSL_PARAM>
create(
const std::function<
bool(OSSL_PARAM_BLD* pBuilder)>& pFunc);
49 static QSharedPointer<EVP_PKEY>
generateKey(
const QSharedPointer<const EC_GROUP>& pCurve);
51 static QSharedPointer<EC_KEY>
generateKey(
const QSharedPointer<const EC_GROUP>& pCurve);
54 static QSharedPointer<EC_GROUP>
createCurve(
int pNid);
60 static auto deleter = [](EC_GROUP* ecCurve)
62 EC_GROUP_free(ecCurve);
65 return QSharedPointer<EC_GROUP>(pEcGroup, deleter);
69#if OPENSSL_VERSION_NUMBER < 0x30000000L
72 static auto deleter = [](EC_KEY* ecKey)
77 return QSharedPointer<EC_KEY>(pEcKey, deleter);
85 static auto deleter = [](EC_POINT* ecPoint)
87 EC_POINT_clear_free(ecPoint);
90 return QSharedPointer<EC_POINT>(pEcPoint, deleter);
96 static auto deleter = [](BIGNUM* bigNum)
98 BN_clear_free(bigNum);
101 return QSharedPointer<BIGNUM>(pBigNum, deleter);
107 static auto deleter = [](EVP_PKEY* key)
112 return QSharedPointer<EVP_PKEY>(pKey, deleter);
118 static auto deleter = [](EVP_PKEY_CTX* ctx)
120 EVP_PKEY_CTX_free(ctx);
123 return QSharedPointer<EVP_PKEY_CTX>(pCtx, deleter);
static QByteArray point2oct(const QSharedPointer< const EC_GROUP > &pCurve, const EC_POINT *pPoint, bool pCompressed=false)
Definition: EcUtil.cpp:31
static QSharedPointer< EC_GROUP > createCurve(int pNid)
Definition: EcUtil.cpp:19
static QSharedPointer< EC_KEY > generateKey(const QSharedPointer< const EC_GROUP > &pCurve)
Definition: EcUtil.cpp:222
static QSharedPointer< EC_POINT > oct2point(const QSharedPointer< const EC_GROUP > &pCurve, const QByteArray &pCompressedData)
Definition: EcUtil.cpp:67
static QSharedPointer< EC_GROUP > create(EC_GROUP *pEcGroup)
Definition: EcUtil.h:58
Implementation of GeneralAuthenticate response APDUs.
Definition: CommandApdu.h:16