10#include <QSharedPointer>
12#include <openssl/bn.h>
13#include <openssl/ec.h>
14#include <openssl/ecdsa.h>
15#include <openssl/evp.h>
25 static QByteArray
point2oct(
const QSharedPointer<const EC_GROUP>& pCurve,
const EC_POINT* pPoint,
bool pCompressed =
false);
27 static QSharedPointer<EC_POINT>
oct2point(
const QSharedPointer<const EC_GROUP>& pCurve,
const QByteArray& pCompressedData);
29 static QSharedPointer<EC_GROUP>
create(EC_GROUP* pEcGroup);
31#if OPENSSL_VERSION_NUMBER < 0x30000000L
32 static QSharedPointer<EC_KEY>
create(EC_KEY* pEcKey);
35 static QSharedPointer<EC_POINT>
create(EC_POINT* pEcPoint);
37 static QSharedPointer<BIGNUM>
create(BIGNUM* pBigNum);
39 static QSharedPointer<EVP_PKEY>
create(EVP_PKEY* pEcGroup);
41 static QSharedPointer<EVP_PKEY_CTX>
create(EVP_PKEY_CTX* pEcGroup);
43#if OPENSSL_VERSION_NUMBER >= 0x30000000L
44 static QByteArray getEncodedPublicKey(
const QSharedPointer<EVP_PKEY>& pKey);
45 static QSharedPointer<BIGNUM> getPrivateKey(
const QSharedPointer<const EVP_PKEY>& pKey);
46 static QSharedPointer<OSSL_PARAM>
create(
const std::function<
bool(OSSL_PARAM_BLD* pBuilder)>& pFunc);
47 static QSharedPointer<EVP_PKEY>
generateKey(
const QSharedPointer<const EC_GROUP>& pCurve);
49 static QSharedPointer<EC_KEY>
generateKey(
const QSharedPointer<const EC_GROUP>& pCurve);
52 static QSharedPointer<EC_GROUP>
createCurve(
int pNid);
58 static auto deleter = [](EC_GROUP* ecCurve)
60 EC_GROUP_free(ecCurve);
63 return QSharedPointer<EC_GROUP>(pEcGroup, deleter);
67#if OPENSSL_VERSION_NUMBER < 0x30000000L
70 static auto deleter = [](EC_KEY* ecKey)
75 return QSharedPointer<EC_KEY>(pEcKey, deleter);
83 static auto deleter = [](EC_POINT* ecPoint)
85 EC_POINT_clear_free(ecPoint);
88 return QSharedPointer<EC_POINT>(pEcPoint, deleter);
94 static auto deleter = [](BIGNUM* bigNum)
96 BN_clear_free(bigNum);
99 return QSharedPointer<BIGNUM>(pBigNum, deleter);
105 static auto deleter = [](EVP_PKEY* key)
110 return QSharedPointer<EVP_PKEY>(pKey, deleter);
116 static auto deleter = [](EVP_PKEY_CTX* ctx)
118 EVP_PKEY_CTX_free(ctx);
121 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:56
Implementation of GeneralAuthenticate response APDUs.
Definition: CommandApdu.h:16