Heart/Heart/AbstractSpace/authecdsa.h

56 lines
1.5 KiB
C
Raw Normal View History

2022-02-10 20:06:39 +03:00
//#
//# Copyright (C) 2021-2022 QuasarApp.
//# Distributed under the GPLv3 software license, see the accompanying
//# Everyone is permitted to copy and distribute verbatim copies
//# of this license document, but changing it is not allowed.
//#
#ifndef AUTHECDSA_H
#define AUTHECDSA_H
2022-02-22 19:25:12 +03:00
#include "heart_global.h"
2022-02-10 20:06:39 +03:00
2022-02-22 17:02:14 +03:00
#ifdef USE_HEART_SSL
2022-02-10 20:06:39 +03:00
#include "abstractdata.h"
#include <asynckeysauth.h>
2022-02-13 18:45:11 +03:00
2022-02-22 19:25:12 +03:00
#include <openssl/ec.h> // for EC_GROUP_new_by_curve_name, EC_GROUP_free, EC_KEY_new, EC_KEY_set_group, EC_KEY_generate_key,EC_KEY_free
2022-02-10 20:06:39 +03:00
namespace QH {
/**
* @brief The AuthECDSA class is ecdsa implementation of the Async authentication. This implementation based on Openssl library.
*/
2022-02-13 20:08:19 +03:00
class HEARTSHARED_EXPORT AuthECDSA: public QH::AsyncKeysAuth
2022-02-10 20:06:39 +03:00
{
public:
AuthECDSA();
/**
* @brief makeKeys This static method generate the public and private keys of the ECDSA.
* @param pubKey This is result public key.
* @param privKey This is result private key.
* @return true if keys generated successful.
*/
static bool makeKeys(QByteArray &pubKey, QByteArray &privKey);
// AsyncKeysAuth interface
protected:
QByteArray signMessage(const QByteArray &inputData, const QByteArray &key) const override;
bool checkSign(const QByteArray &inputData, const QByteArray &signature, const QByteArray &key) const override;
2022-02-13 18:45:11 +03:00
private:
static bool prepareKeyAdnGroupObjects(EC_KEY **eckey, EC_GROUP **ecgroup);
2022-02-10 20:06:39 +03:00
};
}
2022-02-22 17:02:14 +03:00
#endif
2022-02-10 20:06:39 +03:00
#endif // AUTHECDSA_H