|
| 1 | +# Contributing in to EeasySSL |
| 2 | +This is a wrap library for the Qt developers. So if you think that is a good library, and you use it in your projects - you can add new improvements and create a pull request with new features. |
| 3 | + |
| 4 | +## What can you do for this Library ? |
| 5 | +1. You can add a support of new encryption algorithms |
| 6 | +2. You can implement new certificate generator. |
| 7 | + |
| 8 | +## Adding new implementation of crypto algorithms |
| 9 | +All Algorithms must be pass simple test. Encrypt, decrypt short and long data arrays. This simple test already implemented, and you just need to add it into main test file. |
| 10 | + |
| 11 | +### Example |
| 12 | +Adding supporting RSA algorithm to this library. |
| 13 | + |
| 14 | +1. Create implementation of the iCrypto interface. |
| 15 | + ```cpp |
| 16 | + |
| 17 | + #include "icrypto.h" |
| 18 | + |
| 19 | + /** |
| 20 | + * @brief The RSASSL class This is wrapper for RSA algorithm of openssl 3.0 libraryry. |
| 21 | + */ |
| 22 | + class EASYSSL_EXPORT RSASSL: public EasySSL::ICrypto { |
| 23 | + |
| 24 | + // override main methods of the interface. |
| 25 | + EVP_PKEY *makeRawKeys() const override; |
| 26 | + Features supportedFeatures() const override; |
| 27 | + QSsl::KeyAlgorithm keyAlgorithm() const override; |
| 28 | + QByteArray signMessage(const QByteArray &inputData, const QByteArray &key) const override; |
| 29 | + bool checkSign(const QByteArray &inputData, const QByteArray &signature, const QByteArray &key) const override; |
| 30 | + QByteArray decrypt(const QByteArray &message, const QByteArray &key) override; |
| 31 | + QByteArray encrypt(const QByteArray &message, const QByteArray &key) override; |
| 32 | + |
| 33 | + } |
| 34 | + ``` |
| 35 | +Full implementation of the RSA you can see here. |
| 36 | + |
| 37 | +2. Add your class to the tests Using The Template class "[CryptoTest](https://github.com/QuasarApp/easyssl/blob/main/tests/units/cryptotest.h)". See The [tstMain.cpp](https://github.com/QuasarApp/easyssl/blob/main/tests/tstMain.cpp) file |
| 38 | +``` cpp |
| 39 | + TestCase(cryptoTestRSA, CryptoTest<EasySSL::RSASSL>) |
| 40 | +``` |
| 41 | +
|
| 42 | +## Adding new implementation of Certificate generator. |
| 43 | +
|
| 44 | +1. Create implementation of the iCrypto interface. And override the create method. |
| 45 | +```cpp |
| 46 | + /** |
| 47 | + * @brief The X509 class This is wrapper of the ssl objects. |
| 48 | + */ |
| 49 | + class EASYSSL_EXPORT X509: public ICertificate |
| 50 | + { |
| 51 | + public: |
| 52 | + X509(const QSharedPointer<ICrypto>& generator); |
| 53 | + |
| 54 | + // ICertificate interface |
| 55 | + public: |
| 56 | + SelfSignedSertificate create(const SslSrtData& certificateData) const override; |
| 57 | + }; |
| 58 | +``` |
| 59 | + |
| 60 | +Full implementation of x509 certificate format you can see here. |
| 61 | + |
| 62 | +2. Add your class to the tests Using The Template class "[CrtTest]()". See The [tstMain.cpp](https://github.com/QuasarApp/easyssl/blob/main/tests/tstMain.cpp) file |
| 63 | + |
| 64 | +```cpp |
| 65 | + #include "crttest.h" |
| 66 | + |
| 67 | + using CrtTestX509ECDSA = CrtTest<EasySSL::X509, EasySSL::ECDSASSL>; |
| 68 | + TestCase(crtTestX509ECDSA, CrtTestX509ECDSA) |
| 69 | + |
| 70 | +``` |
| 71 | +
|
| 72 | +## Extra rools |
| 73 | +1. All shared tools or useful functions located on the EasySSLUtils class. |
| 74 | +2. All implementation must contains goxygen xml comments (documentation) |
| 75 | +
|
| 76 | +
|
| 77 | +# Thank you |
| 78 | +
|
0 commit comments