2023-03-26 21:25:15 +02:00
|
|
|
# EasySSL
|
2023-07-17 22:52:15 +02:00
|
|
|
This is wrapper library that make using OpenSSL library more simple.
|
2023-03-26 21:25:15 +02:00
|
|
|
This library contains interfaces for the signing and encription data.
|
2023-03-26 19:36:35 +03:00
|
|
|
|
2023-03-26 21:25:15 +02:00
|
|
|
### Supported encription alhorithms:
|
2023-07-17 22:52:15 +02:00
|
|
|
* ECDSA
|
|
|
|
* RSA
|
2023-03-26 21:25:15 +02:00
|
|
|
|
|
|
|
### Supported features
|
|
|
|
* encription
|
|
|
|
* signing
|
|
|
|
* keys creating
|
|
|
|
* asyn auth bse on the asyn encriptions methods
|
|
|
|
|
|
|
|
|
|
|
|
## Build and Include
|
|
|
|
|
|
|
|
* cd yourRepo
|
|
|
|
* git submodule add https://github.com/QuasarApp/easyssl.git # add the repository of Heart into your repo like submodule
|
|
|
|
* git submodule update --init --recursive
|
|
|
|
* Include in your CMakeLists.txt file the main CMakeLists.txt file of Heart library
|
|
|
|
|
|
|
|
```cmake
|
|
|
|
add_subdirectory(easyssl)
|
|
|
|
```
|
|
|
|
|
|
|
|
* link the Heart library to your target
|
|
|
|
```cmake
|
|
|
|
target_link_libraries(yourLib PUBLIC easyssl)
|
|
|
|
```
|
|
|
|
* rebuild yuor project
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
2023-07-17 22:52:15 +02:00
|
|
|
### Encription
|
|
|
|
|
|
|
|
```cpp
|
2023-07-17 23:07:28 +02:00
|
|
|
#include "easyssl/rsassl.h"
|
|
|
|
|
|
|
|
// create a publick and private keys array.
|
|
|
|
int main() {
|
|
|
|
QByteArray pub, priv;
|
|
|
|
EasySSL::RSASSL crypto;
|
|
|
|
crypto.makeKeys(pub, priv)
|
|
|
|
|
|
|
|
auto siganture = crypto.signMessage(message, priv);
|
|
|
|
crypto.checkSign(message, siganture, pub);
|
|
|
|
|
|
|
|
auto encriptedMsg = crypto.encrypt(message, pub);
|
|
|
|
auto decryptedMsg = crypto.decrypt(encriptedMsg, priv);
|
|
|
|
}
|
2023-07-17 22:52:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### Authentication
|
2023-03-26 21:25:15 +02:00
|
|
|
|
|
|
|
```cpp
|
|
|
|
#include <easyssl/authecdsa.h>
|
|
|
|
|
|
|
|
class ECDSA: public EasySSL::AuthECDSA {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
// AsyncKeysAuth interface
|
|
|
|
void setPrivateKey(const QByteArray &newPriv) {
|
|
|
|
_priv = newPriv;
|
|
|
|
}
|
|
|
|
|
|
|
|
QByteArray getPrivateKey() const {
|
|
|
|
return _priv;
|
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
|
|
|
QByteArray _priv;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
ECDSA edsa;
|
|
|
|
QByteArray pub, priv;
|
|
|
|
QString userID;
|
|
|
|
|
|
|
|
// make public and private keys.
|
|
|
|
edsa.makeKeys(pub, priv);
|
|
|
|
edsa.setPrivateKey(priv);
|
|
|
|
edsa.setPublicKey(pub);
|
|
|
|
|
|
|
|
// prepare an authentication object.
|
|
|
|
edsa.prepare();
|
|
|
|
edsa.setPrivateKey({});
|
|
|
|
|
|
|
|
edsa.auth(1000, &userID)
|
|
|
|
|
|
|
|
```
|
2023-03-26 19:36:35 +03:00
|
|
|
|
2023-07-17 23:07:28 +02:00
|
|
|
## Do not forget to help us make this library better...
|
|
|
|
See our main documentation about contributing to [EasySsl](https://github.com/QuasarApp/easyssl/blob/main/CONTRIBUTING.md)
|
|
|
|
|
2023-03-27 09:57:05 +03:00
|
|
|
Full documentation available [here](https://quasarapp.ddns.net:3031/docs/QuasarApp/easyssl/latest/index.html)
|