diff --git a/src/lib/src/public/easyssl/ecdsassl.cpp b/src/lib/src/public/easyssl/ecdsassl.cpp index 4173e8e..a629c3a 100644 --- a/src/lib/src/public/easyssl/ecdsassl.cpp +++ b/src/lib/src/public/easyssl/ecdsassl.cpp @@ -8,6 +8,7 @@ #include "ecdsassl.h" +#include <openssl/types.h> #include <openssl/ecdsa.h> // for ECDSA_do_sign, ECDSA_do_verify #include <openssl/obj_mac.h> // for NID_secp192k1 #include <openssl/evp.h> @@ -29,7 +30,7 @@ ECDSASSL::ECDSASSL(EllipticCurveStandart curveStandart) { setCurve(curveStandart); } -EVP_PKEY * ECDSASSL::makeRawKeys() const { +void * ECDSASSL::makeRawKeys() const { EVP_PKEY *pkey = nullptr; EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_from_name(nullptr, "EC", nullptr); diff --git a/src/lib/src/public/easyssl/ecdsassl.h b/src/lib/src/public/easyssl/ecdsassl.h index 90ee0cd..ec96909 100644 --- a/src/lib/src/public/easyssl/ecdsassl.h +++ b/src/lib/src/public/easyssl/ecdsassl.h @@ -37,7 +37,6 @@ class EASYSSL_EXPORT ECDSASSL: public EasySSL::ICrypto public: ECDSASSL(EllipticCurveStandart curveStandart = EllipticCurveStandart::P_256); - EVP_PKEY * makeRawKeys() const override; Features supportedFeatures() const override; QSsl::KeyAlgorithm keyAlgorithm() const override; @@ -69,6 +68,8 @@ public: */ void setCurve(EllipticCurveStandart newCurve); + void * makeRawKeys() const override; + private: const char *getCStr(EllipticCurveStandart value) const; EllipticCurveStandart _curve = EllipticCurveStandart::P_256; diff --git a/src/lib/src/public/easyssl/icrypto.cpp b/src/lib/src/public/easyssl/icrypto.cpp index 9ce0f49..dd024ce 100644 --- a/src/lib/src/public/easyssl/icrypto.cpp +++ b/src/lib/src/public/easyssl/icrypto.cpp @@ -15,7 +15,7 @@ namespace EasySSL { bool EasySSL::ICrypto::makeKeys(QByteArray &pubKey, QByteArray &privKey) const { - EVP_PKEY *keys = makeRawKeys(); + EVP_PKEY *keys = static_cast<EVP_PKEY *>(makeRawKeys()); if (!keys) return false; diff --git a/src/lib/src/public/easyssl/icrypto.h b/src/lib/src/public/easyssl/icrypto.h index f211ae2..eb9d5f7 100644 --- a/src/lib/src/public/easyssl/icrypto.h +++ b/src/lib/src/public/easyssl/icrypto.h @@ -12,7 +12,6 @@ #include "global.h" #include "qssl.h" #include <QByteArray> -#include <openssl/types.h> namespace EasySSL { @@ -42,12 +41,6 @@ public: */ bool makeKeys(QByteArray &pubKey, QByteArray &privKey) const; - /** - * @brief makeKeys This method generate the public and private keys of the ECDSA. - * @return pointer to generated keys. - */ - virtual EVP_PKEY * makeRawKeys() const = 0; - /** * @brief keyAlgorithm This method should be return Qt Key algorithm (needed for generate cetrificates.) * @return @@ -98,6 +91,12 @@ public: virtual bool checkSign(const QByteArray& message, const QByteArray& signature, const QByteArray& key) const = 0; + + /** + * @brief makeKeys This method generate the public and private keys of the ECDSA. + * @return pointer to generated keys. This method must return EVP_PKEY* structure. + */ + virtual void * makeRawKeys() const = 0; }; } diff --git a/src/lib/src/public/easyssl/rsassl.cpp b/src/lib/src/public/easyssl/rsassl.cpp index 38c0174..6fa830f 100644 --- a/src/lib/src/public/easyssl/rsassl.cpp +++ b/src/lib/src/public/easyssl/rsassl.cpp @@ -21,7 +21,7 @@ RSASSL::RSASSL(RSAPadding padding) { setPadding(padding); } -EVP_PKEY * RSASSL::makeRawKeys() const { +void *RSASSL::makeRawKeys() const { EVP_PKEY *pkey = nullptr; EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_from_name(nullptr, "RSA", nullptr); diff --git a/src/lib/src/public/easyssl/rsassl.h b/src/lib/src/public/easyssl/rsassl.h index 9de70d4..3ec0e84 100644 --- a/src/lib/src/public/easyssl/rsassl.h +++ b/src/lib/src/public/easyssl/rsassl.h @@ -46,7 +46,7 @@ class EASYSSL_EXPORT RSASSL: public EasySSL::ICrypto public: RSASSL(RSAPadding padding = PKCS1_OAEP_PADDING); - EVP_PKEY *makeRawKeys() const override; + void *makeRawKeys() const override; Features supportedFeatures() const override; QSsl::KeyAlgorithm keyAlgorithm() const override; diff --git a/src/lib/src/public/easyssl/x509.cpp b/src/lib/src/public/easyssl/x509.cpp index 3b629e0..3a04a90 100644 --- a/src/lib/src/public/easyssl/x509.cpp +++ b/src/lib/src/public/easyssl/x509.cpp @@ -22,7 +22,7 @@ SelfSignedSertificate X509::create(const SslSrtData &certificateData) const { return {}; } - EVP_PKEY *pkey = keyGenerator()->makeRawKeys(); + EVP_PKEY *pkey = static_cast<EVP_PKEY *>(keyGenerator()->makeRawKeys()); ::X509 * x509 = nullptr; X509_NAME * name = nullptr;