remove EVP_PKEY struct frm public space

This commit is contained in:
Andrei Yankovich 2023-07-18 15:28:58 +02:00
parent afab7047c1
commit 9d91f267b9
7 changed files with 14 additions and 13 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;
};
}

View File

@ -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);

View File

@ -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;

View File

@ -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;