Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ set(EASYSSL_VERSION "0.${GIT_COMMIT_COUNT}.${GIT_COMMIT_HASH}")
set(EASYSSL_PACKAGE_ID "quasarapp.core.easyssl")

option(EASYSSL_TESTS "This option disables or enables tests of the ${PROJECT_NAME} project" ON)
option(EASYSSL_STATIC_SSL "This option enable or disabled static link ssl libraryes" OFF)
option(BUILD_WITH_OPENSSL "This option enable or disabled build thirdparty libraryes with ${PROJECT_NAME} library (for example openssl)" ON)
option(EASYSSL_STATIC_SSL "This option enable or disabled static link ssl libraries" OFF)
option(BUILD_WITH_OPENSSL "This option enable or disabled build third-party libraries with ${PROJECT_NAME} library (for example openssl)" ON)

if (BUILD_WITH_OPENSSL)
if (QA_WASM32)
Expand All @@ -48,7 +48,7 @@ if (BUILD_WITH_OPENSSL)
endif()

if (ANDROID OR IOS OR NOT QT_VERSION_MAJOR OR QA_WASM32)
set(EASYSSL_TESTS OFF CACHE BOOL "This option force disbled for ANDROID IOS QA_WASM32 and Not Qt projects" FORCE)
set(EASYSSL_TESTS OFF CACHE BOOL "This option force disabled for ANDROID IOS QA_WASM32 and Not Qt projects" FORCE)
endif()

make_directory(Distro)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public:

// ICertificate interface
public:
SelfSignedSertificate create(const SslSrtData& certificateData) const override;
SelfSignedCertificate create(const SslSrtData& certificateData) const override;
};
```

Expand Down
2 changes: 1 addition & 1 deletion docs/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ EasySSL is a Qt wrapper of the OpenSSL 3.0+ library. It simplifies the working w

DEFINES += EASYSSL_LIBRARY

# Link the OpenSSL 3.0+ libraryes:
# Link the OpenSSL 3.0+ libraries:
LIBS += -lcrypto -lssl
```

Expand Down
8 changes: 4 additions & 4 deletions src/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ if (${QT_VERSION_MAJOR})

endif()

set(PUBLIC_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/public")
set(PRIVATE_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/private")
set(PUBLIC_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/public")
set(PRIVATE_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/private")


add_library(${CURRENT_PROJECT} ${SOURCE_CPP} ${SOURCE_QRC})
Expand Down Expand Up @@ -104,8 +104,8 @@ if (BUILD_SHARED_LIBS AND (BUILD_WITH_OPENSSL OR EASYSSL_STATIC_SSL))
endif()
endif()

target_include_directories(${CURRENT_PROJECT} PUBLIC ${PUBLIC_INCUDE_DIR})
target_include_directories(${CURRENT_PROJECT} PRIVATE ${PRIVATE_INCUDE_DIR})
target_include_directories(${CURRENT_PROJECT} PUBLIC ${PUBLIC_INCLUDE_DIR})
target_include_directories(${CURRENT_PROJECT} PRIVATE ${PRIVATE_INCLUDE_DIR})

set(LANGS ${CMAKE_CURRENT_SOURCE_DIR}/languages/en.ts)

Expand Down
2 changes: 1 addition & 1 deletion src/lib/src/private/easysslutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ BIO* EasySSLUtils::byteArrayToBio(const QByteArray& byteArray) {
return bio;
}

QByteArray EasySSLUtils::extractPublcKey(EVP_PKEY *ssl_keys) {
QByteArray EasySSLUtils::extractPublicKey(EVP_PKEY *ssl_keys) {
if (!ssl_keys)
return {};

Expand Down
8 changes: 4 additions & 4 deletions src/lib/src/private/easysslutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class EasySSLUtils {
static BIGNUM* bignumFromArray(const QByteArray& array);

/**
* @brief bioToByteArray This method converts the openssl BIO to the QByteArry
* @param bio input arrary.
* @brief bioToByteArray This method converts the openssl BIO to the QByteArray
* @param bio input array.
* @return Qt Array
*/
static QByteArray bioToByteArray(BIO *bio);
Expand All @@ -55,11 +55,11 @@ class EasySSLUtils {
static BIO *byteArrayToBio(const QByteArray &byteArray);

/**
* @brief extractPublcKey This method extracts the public key from the ssl (pem) structure.
* @brief extractPublicKey This method extracts the public key from the ssl (pem) structure.
* @param ssl_keys These are objects of the ssl keys.
* @return bytes array of the extracted key.
*/
static QByteArray extractPublcKey(EVP_PKEY* ssl_keys);
static QByteArray extractPublicKey(EVP_PKEY* ssl_keys);

/**
* @brief extractPrivateKey This method extracts the private key from the ssl (pem) structure.
Expand Down
2 changes: 1 addition & 1 deletion src/lib/src/public/easyssl.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace EasySSL {

/**
* @brief init main initialize method of The easyssl library
* @return true if library initialized successfull
* @return true if library initialized successful
*/
bool EASYSSL_EXPORT init();

Expand Down
20 changes: 10 additions & 10 deletions src/lib/src/public/easyssl/asynckeysauth.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
namespace EasySSL {

/**
* @brief The AsyncKeysAuth class is temaplate class for works with authorization of a pair of asynchronous keys
* @brief The AsyncKeysAuth class is template class for works with authorization of a pair of asynchronous keys
* This class contains base implementation for the authentication using async encryption. The base encryption algorithm defined on the template argument **CryptoImplementation**.
* You can use any crypto algorithm.
*
* ## Exampel of use:
* ## Example of use:
*
* @code{cpp}
* #include <easyssl.h>
Expand All @@ -45,22 +45,22 @@ namespace EasySSL {
* SIG = PRIV.signMessage(S)
* * Client prepare a auth request for server = R:
* R = {U,SIG,PUB}
* * Cleint send R to server
* * Client send R to server
*
* * -----
*
* ** Server Part **
*
* * Server receive R from client.
* * Server compare U time with current unix time.
* * If the diferrence more then allowed value then server reject an auth
* * If the difference more then allowed value then server reject an auth
* * Server make S value as a client
* * Server check SIG value and comapre it with S value
* * Server check SIG value and compare it with S value
* * If message sign is valid then server accept an auth else reject.
* * After accept server create new user with ID = sha256(PUB) or
* if user alredy exits make them as a logined user.
* if user already exits make them as a logined user.
*
* @tparam CryptoImplementation This is internal implementaion of base encryption functions.
* @tparam CryptoImplementation This is internal implementation of base encryption functions.
* @see iCrypto class.
*
*/
Expand Down Expand Up @@ -109,7 +109,7 @@ class AsyncKeysAuth: public CryptoImplementation
}

/**
* @brief prepare This method will generate signature for autentication of client. Please inboke this method before send request to server.
* @brief prepare This method will generate signature for authentication of client. Please inboke this method before send request to server.
* @return true if signature generated sucessuful.
*/
bool prepare() {
Expand All @@ -135,7 +135,7 @@ class AsyncKeysAuth: public CryptoImplementation

/**
* @brief setUnixTime This method sets new value of the unixTime propertye.
* @param newUnixTime This is new unix time value. Unix time sets in secunds from 1970 year
* @param newUnixTime This is new unix time value. Unix time sets in seconds from 1970 year
*/
void setUnixTime(unsigned int newUnixTime) {
_unixTime = newUnixTime;
Expand All @@ -151,7 +151,7 @@ class AsyncKeysAuth: public CryptoImplementation
}

/**
* @brief isValid this method check this ibject to valid.
* @brief isValid this method check this object to valid.
* @return return true if object contains valid signature else false.
* @note Invoke the AsyncKeysAuth::prepare method before check valid of object. All object that not be preparred is invalid.
*/
Expand Down
14 changes: 7 additions & 7 deletions src/lib/src/public/easyssl/ecdsassl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
namespace EasySSL {


ECDSASSL::ECDSASSL(EllipticCurveStandart curveStandart) {
setCurve(curveStandart);
ECDSASSL::ECDSASSL(EllipticCurveStandard curveStandard) {
setCurve(curveStandard);
}

void * ECDSASSL::makeRawKeys() const {
Expand Down Expand Up @@ -132,11 +132,11 @@ bool ECDSASSL::checkSign(const QByteArray &inputData,
}

auto pkey = EasySSLUtils::byteArrayToBio(key);
auto rsaPublickKey = PEM_read_bio_PUBKEY(pkey, nullptr, nullptr, nullptr);
auto rsaPublicKey = PEM_read_bio_PUBKEY(pkey, nullptr, nullptr, nullptr);
BIO_free(pkey);

// Initialize the verification operation
if (EVP_DigestVerifyInit(mdctx, NULL, EVP_sha256(), NULL, rsaPublickKey) != 1) {
if (EVP_DigestVerifyInit(mdctx, NULL, EVP_sha256(), NULL, rsaPublicKey) != 1) {
EasySSLUtils::printlastOpenSSlError();

EVP_MD_CTX_free(mdctx);
Expand Down Expand Up @@ -173,15 +173,15 @@ QByteArray ECDSASSL::encrypt(const QByteArray &, const QByteArray &) {
return {};
}

ECDSASSL::EllipticCurveStandart ECDSASSL::curve() const {
ECDSASSL::EllipticCurveStandard ECDSASSL::curve() const {
return _curve;
}

void ECDSASSL::setCurve(EllipticCurveStandart newCurve) {
void ECDSASSL::setCurve(EllipticCurveStandard newCurve) {
_curve = newCurve;
}

const char *ECDSASSL::getCStr(EllipticCurveStandart value) const {
const char *ECDSASSL::getCStr(EllipticCurveStandard value) const {
switch (value) {
case P_256: return "P-256";
case P_384: return "P-384";
Expand Down
20 changes: 10 additions & 10 deletions src/lib/src/public/easyssl/ecdsassl.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ namespace EasySSL {
class EASYSSL_EXPORT ECDSASSL: public EasySSL::ICrypto
{
/**
* @brief The EllipticCurveStandart enum List of supported Elliptic Curve Standarts
* @brief The EllipticCurveStandard enum List of supported Elliptic Curve Standards
*/
enum EllipticCurveStandart {
enum EllipticCurveStandard {
/// Private key (point on Elliptic Curve ) based on 256 bit prime number
P_256,
/// Private key (point on Elliptic Curve ) based on 384 bit prime number
Expand All @@ -36,7 +36,7 @@ class EASYSSL_EXPORT ECDSASSL: public EasySSL::ICrypto
};

public:
ECDSASSL(EllipticCurveStandart curveStandart = EllipticCurveStandart::P_256);
ECDSASSL(EllipticCurveStandard curveStandard = EllipticCurveStandard::P_256);
Features supportedFeatures() const override;
QSsl::KeyAlgorithm keyAlgorithm() const override;

Expand All @@ -58,21 +58,21 @@ class EASYSSL_EXPORT ECDSASSL: public EasySSL::ICrypto
/**
* @brief curve This method returns the current curve method. Using only for generating new pair of keys.
* @return current cursve type.
* @see EllipticCurveStandart
* @see EllipticCurveStandard
*/
EllipticCurveStandart curve() const;
EllipticCurveStandard curve() const;

/**
* @brief setCurve This method sets new curve standart value.
* @param newCurve this is new value of curve standart.
* @brief setCurve This method sets new curve standard value.
* @param newCurve this is new value of curve standard.
*/
void setCurve(EllipticCurveStandart newCurve);
void setCurve(EllipticCurveStandard newCurve);

void * makeRawKeys() const override;

private:
const char *getCStr(EllipticCurveStandart value) const;
EllipticCurveStandart _curve = EllipticCurveStandart::P_256;
const char *getCStr(EllipticCurveStandard value) const;
EllipticCurveStandard _curve = EllipticCurveStandard::P_256;
};

}
Expand Down
14 changes: 7 additions & 7 deletions src/lib/src/public/easyssl/icertificate.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@
namespace EasySSL {

/**
* @brief The SslSrtData struct This structure contains base information to generate self-signed SSL certification.
* @brief The SslCrtData struct This structure contains base information to generate self-signed SSL certification.
* Use this interface for creating a new certificates algorithms.
*/
struct SslSrtData {
struct SslCrtData {
QString country = "BY";
QString organization = "QuasarApp";
QString commonName = "";
long long endTime = 31536000L; //1 year
};

/**
* @brief The SelfSignedSertificate struct contains qt certificate object and private key of them.
* @brief The SelfSignedCertificate struct contains qt certificate object and private key of them.
*/
struct EASYSSL_EXPORT SelfSignedSertificate {
SelfSignedSertificate(){}
SelfSignedSertificate(const SelfSignedSertificate & other) {
struct EASYSSL_EXPORT SelfSignedCertificate {
SelfSignedCertificate(){}
SelfSignedCertificate(const SelfSignedCertificate & other) {
crt = other.crt;
key = other.key;
};
Expand All @@ -55,7 +55,7 @@ class EASYSSL_EXPORT ICertificate
* @param certificateData This input extra data of certificate.
* @return certificate data with private key.
*/
virtual SelfSignedSertificate create(const SslSrtData& certificateData) const = 0;
virtual SelfSignedCertificate create(const SslCrtData& certificateData) const = 0;

protected:
/**
Expand Down
2 changes: 1 addition & 1 deletion src/lib/src/public/easyssl/icrypto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ bool EasySSL::ICrypto::makeKeys(QByteArray &pubKey, QByteArray &privKey) const
if (!keys)
return false;

pubKey = EasySSLUtils::extractPublcKey(keys);
pubKey = EasySSLUtils::extractPublicKey(keys);
privKey = EasySSLUtils::extractPrivateKey(keys);
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/src/public/easyssl/icrypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ class EASYSSL_EXPORT ICrypto
bool makeKeys(QByteArray &pubKey, QByteArray &privKey) const;

/**
* @brief keyAlgorithm This method should be return Qt Key algorithm (needed for generate cetrificates.)
* @brief keyAlgorithm This method should be return Qt Key algorithm (needed for generate certificates.)
* @return
*/
virtual QSsl::KeyAlgorithm keyAlgorithm() const = 0;

/**
* @brief supportedFeatures This method should return supported featurs of the current encryption algorithm
* @brief supportedFeatures This method should return supported features of the current encryption algorithm
* @return Features list.
* @see Features
*/
Expand Down
6 changes: 3 additions & 3 deletions src/lib/src/public/easyssl/rsassl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ bool RSASSL::checkSign(const QByteArray &inputData, const QByteArray &signature,
}

auto pkey = EasySSLUtils::byteArrayToBio(key);
auto rsaPublickKey = PEM_read_bio_PUBKEY(pkey, nullptr, nullptr, nullptr);
auto rsaPublicKey = PEM_read_bio_PUBKEY(pkey, nullptr, nullptr, nullptr);
BIO_free(pkey);

// Initialize the verification operation
if (EVP_DigestVerifyInit(mdctx, NULL, EVP_sha256(), NULL, rsaPublickKey) != 1) {
if (EVP_DigestVerifyInit(mdctx, NULL, EVP_sha256(), NULL, rsaPublicKey) != 1) {
EasySSLUtils::printlastOpenSSlError();
EVP_MD_CTX_free(mdctx);
return false;
Expand Down Expand Up @@ -148,7 +148,7 @@ QByteArray RSASSL::decrypt(const QByteArray &message, const QByteArray &key) {
const long long maxDencryptedSize = EVP_PKEY_size(rsaPrivateKey);
if (message.length() % maxDencryptedSize) {
qCritical() << "Error wrong encrypted data size.";
qCritical() << "Your key requir size multiple " << maxDencryptedSize;
qCritical() << "Your key require size multiple " << maxDencryptedSize;

return {};
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/src/public/easyssl/rsassl.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class EASYSSL_EXPORT RSASSL: public EasySSL::ICrypto
void setPadding(RSAPadding newPadding);

/**
* @brief bits return cuurrent rsa keys size mode. Using oly for generate keys.
* @brief bits return current rsa keys size mode. Using only for generating keys.
* @return size of the rsa keys.
*/
RSABits bits() const;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/src/public/easyssl/x509.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ X509::X509(const QSharedPointer<ICrypto>& generator): ICertificate(generator) {

}

SelfSignedSertificate X509::create(const SslSrtData &certificateData) const {
SelfSignedSertificate result;
SelfSignedCertificate X509::create(const SslCrtData &certificateData) const {
SelfSignedCertificate result;
if (!(keyGenerator()->supportedFeatures() & ICrypto::Features::Signing)) {
return {};
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/src/public/easyssl/x509.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class EASYSSL_EXPORT X509: public ICertificate

// ICertificate interface
public:
SelfSignedSertificate create(const SslSrtData& certificateData) const override;
SelfSignedCertificate create(const SslCrtData& certificateData) const override;
};

}
Expand Down
Loading
Loading