This is wrapper library that make using OpenSSL library more simple. This library contains interfaces for the signing and encryption data.
Supported encryption algorithms:
Supported features
- encryption
- signing
- keys creating
- asyn auth bse on the asyn encryptions methods
Build and Include
CMake
Independet of SSL build
Dependency on the ssl library greatly complicates the deployment of the final product. For fix this issue, you can build EasySSL library with static SSL library. In this case, SSL library code will be saved in your EasySell binary, and deploy of your application will be easily. The ssl code will not available for your application or other libraries, so you will not get conflicts between different major versions ssl libraries if your distribution kit has it.
Just set the EASYSSL_STATIC_SSL option to true.
bash
cmake .. -DEASYSSL_STATIC_SSL=1
The described case may be useful for the Qt 5.15.x, because the QNetwork 5.15 depends on the SSL v1.1 and EasySsl works with the SSL >= 3.0.
Usage
Encryption
int main() {
QByteArray pub, priv;
auto encryptedMsg = crypto.
encrypt(message, pub);
auto decryptedMsg = crypto.
decrypt(encryptedMsg, priv);
}
bool makeKeys(QByteArray &pubKey, QByteArray &privKey) const
makeKeys This method generate the public and private keys of the ECDSA.
The RSASSL class This is wrapper for RSA algorithm of openssl 3.0 libraryry.
QByteArray decrypt(const QByteArray &message, const QByteArray &key) override
decrypt This method has empty implementation.
QByteArray signMessage(const QByteArray &inputData, const QByteArray &key) const override
signMessage This method should be sign the message using the key.
QByteArray encrypt(const QByteArray &message, const QByteArray &key) override
encrypt This method has empty implementation.
bool checkSign(const QByteArray &inputData, const QByteArray &signature, const QByteArray &key) const override
checkSign This method should be check signature of the message using the key.
Authentication
public:
void setPrivateKey(const QByteArray &newPriv) {
_priv = newPriv;
}
return _priv;
};
private:
QByteArray _priv;
};
ECDSA edsa;
QByteArray pub, priv;
QString userID;
edsa.makeKeys(pub, priv);
edsa.setPrivateKey(priv);
edsa.setPublicKey(pub);
edsa.prepare();
edsa.setPrivateKey({});
edsa.auth(1000, &userID)
The AsyncKeysAuth class is temaplate class for works with authorization of a pair of asynchronous key...
virtual QByteArray getPrivateKey() const =0
getPrivateKey This method should be return private key for the public key that saved in this object.
Do not forget to help us make this library better...
See our main documentation about contributing to EasySsl
Full documentation available here