All Projects → QuasarApp → Qt-Secret

QuasarApp / Qt-Secret

Licence: LGPL-3.0 license
Simple encryption library supporting RSA and AES algorithms.

Programming Languages

C++
36643 projects - #6 most used programming language
QML
638 projects
CMake
9771 projects
QMake
1090 projects
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Qt-Secret

Low Latency Android Ios Linux Windows Tvos Macos Interactive Audio Platform
🇸Superpowered Audio, Networking and Cryptographics SDKs. High performance and cross platform on Android, iOS, macOS, tvOS, Linux, Windows and modern web browsers.
Stars: ✭ 1,121 (+471.94%)
Mutual labels:  aes, rsa
Hltool
Go 开发常用工具库, Google2步验证客户端,AES加密解密,RSA加密解密,钉钉机器人,邮件发送,JWT生成解析,Log,BoltDB操作,图片操作,json操作,struct序列化
Stars: ✭ 151 (-22.96%)
Mutual labels:  aes, rsa
Encryptlab
A Free and Comprehensive Encrypt and Decrypt Tools Website with example code in Node.js, Website is looking for a new server.
Stars: ✭ 69 (-64.8%)
Mutual labels:  aes, rsa
Dbtransitencryption
Secure data before sending it over the internet
Stars: ✭ 20 (-89.8%)
Mutual labels:  aes, rsa
Jsrsasign
The 'jsrsasign' (RSA-Sign JavaScript Library) is an opensource free cryptography library supporting RSA/RSAPSS/ECDSA/DSA signing/validation, ASN.1, PKCS#1/5/8 private/public key, X.509 certificate, CRL, OCSP, CMS SignedData, TimeStamp, CAdES JSON Web Signature/Token in pure JavaScript.
Stars: ✭ 2,760 (+1308.16%)
Mutual labels:  aes, rsa
Mirage Crypto
Cryptographic primitives for MirageOS
Stars: ✭ 39 (-80.1%)
Mutual labels:  aes, rsa
Encryptor4j
Strong encryption for Java simplified
Stars: ✭ 92 (-53.06%)
Mutual labels:  aes, rsa
Netcore.encrypt
NETCore encrypt and decrpty tool,Include aes,des,rsa,md5,sha1,sha256,sha384,sha512
Stars: ✭ 339 (+72.96%)
Mutual labels:  aes, rsa
Encrypt
🔒 A set of high-level APIs over PointyCastle for two-way cryptography.
Stars: ✭ 199 (+1.53%)
Mutual labels:  aes, rsa
Encrypt Body Spring Boot Starter
(停止维护,替代品搜索:https://github.com/search?l=Java&q=encrypt&type=Repositories )SpringBoot控制器统一的响应体加密与请求体解密的注解处理方式,支持MD5/SHA/AES/DES/RSA
Stars: ✭ 198 (+1.02%)
Mutual labels:  aes, rsa
Swcrypt
RSA public/private key generation, RSA, AES encryption/decryption, RSA sign/verify in Swift with CommonCrypto in iOS and OS X
Stars: ✭ 632 (+222.45%)
Mutual labels:  aes, rsa
oseid
Microchip AVR based smartcard/token with ECC and RSA cryptography
Stars: ✭ 17 (-91.33%)
Mutual labels:  aes, rsa
Phpseclib
PHP Secure Communications Library
Stars: ✭ 4,627 (+2260.71%)
Mutual labels:  aes, rsa
optiga-trust-m
OPTIGA™ Trust M Software Framework
Stars: ✭ 86 (-56.12%)
Mutual labels:  aes, rsa
Heimdall
Heimdall is a wrapper around the Security framework for simple encryption/decryption operations.
Stars: ✭ 369 (+88.27%)
Mutual labels:  aes, rsa
Hybrid Crypto Js
RSA+AES hybrid encryption implementation for JavaScript. Works with Node.js, React Native and modern browsers.
Stars: ✭ 87 (-55.61%)
Mutual labels:  aes, rsa
Aes Rsa Java
AES+RSA结合应用java示例
Stars: ✭ 295 (+50.51%)
Mutual labels:  aes, rsa
Goencrypt
go语言封装的各种对称加密和非对称加密,可以直接使用,包括3重DES,AES的CBC和CTR模式,还有RSA非对称加密,ECC椭圆曲线的加密和数字签名
Stars: ✭ 297 (+51.53%)
Mutual labels:  aes, rsa
Cry
Cross platform PoC ransomware written in Go
Stars: ✭ 179 (-8.67%)
Mutual labels:  aes, rsa
crypto.js
base on crypto module
Stars: ✭ 13 (-93.37%)
Mutual labels:  aes, rsa

Qt-Secret Logo

Fast encryption library supporting RSA and AES algorithms.

Futures

The Qt-Secret library supports the following algorithms:

RSA

The current implementation supports the following key sizes:

Supported sizes

  • RSA64
  • RSA128
  • RSA256
  • RSA512
  • RSA1024
  • RSA2048
  • RSA3072
  • RSA4096
  • RSA6144
  • RSA8192

Supported futures

  • Encryption and decryption of messages.
  • Signature and verification of the message signature.

AES

AES implementation was borrowed from bricke, because it fulfills the goals of this library.

Individual thanks bricke for implementing the AES encryption class.

AES Levels

The class supports all AES key lengths

  • AES_128
  • AES_192
  • AES_256

Modes

The class supports the following operating modes

  • ECB
  • CBC
  • CFB
  • OFB

Padding

By default the padding method is ISO, however, the class supports:

  • ZERO
  • PKCS7
  • ISO

Build

with qmake

DEFINE+=WITHOUT_GUI fot build without gui example, if you want build gui example remove this line. For build the gui example you need to install qml controls 2 in you os. Try sudo apt install qml-module-qtquick-controls2 qtdeclarative5-dev qtdeclarative5-qtquick2-plugin

  • make -j8
  • make test #(for testing)

with cmake

Include

for qmake projects

  • cd yourRepo
  • git submodule add https://github.com/QuasarApp/Qt-Secret.git # add the repository of Qt-Secret into your repo like submodule
  • git submodule update --init --recursive
  • Add to the list of libraries for the Qt-Secret assembly. For example, you can create Main.Pro in which connect Qt-Secret and your project.pro files as subprojects.

Main.pro:

TEMPLATE = subdirs
CONFIG += ordered

SUBDIRS += \
           Qt-Secret \
           MyProject
  • Include in your MyProject.pro file the pri file of Qt-Secret library
include($$PWD/../Qt-Secret/src/Qt-Secret.pri)
  • Rebuild your project

For cmake projects

  • cd yourRepo
  • git submodule add https://github.com/QuasarApp/Qt-Secret.git # add the repository of Qt-Secret into your repo like submodule
  • git submodule update --init --recursive
  • Include in your CMakeLists.txt file the main CMakeLists.txt file of Qt-Secret library
  add_subdirectory(Qt-Secret)
  target_link_libraries(MyBinary PUBLIC Qt-Secret)
  • Rebuild your project

Note

By Default Qt-Secret makes as a static library. If you want to create a shared library just add the BUILD_SHARED_LIBS into your main CMakeLists.txt file. Example :

set(BUILD_SHARED_LIBS ON)
add_subdirectory(Qt-Secret)
target_link_libraries(MyBinary PUBLIC Qt-Secret)

For other build systems

  • cd yourRepo
  • git submodule add https://github.com/QuasarApp/Qt-Secret.git # add the repository of Qt-Secret into your repo like submodule
  • git submodule update --init --recursive
  • Add the rule for build Qt-Secret
  • Add INCLUDEPATH and LIBS for your build system
  • Rebuild your project

Detailed instructions of include in QtCreator see here.

Usage

RSA

Encryption and decryption of messages.

#include <qrsaencryption.h>
#include <QDebug>

bool testEncryptAndDecryptExample() {

    QByteArray pub, priv;
    QRSAEncryption e(QRSAEncryption::Rsa::RSA_2048);
    e.generatePairKey(pub, priv); // or other rsa size

    QByteArray msg = "test message";

    auto encryptMessage = e.encode(msg, pub);

    if (encryptMessage == msg)
        return false;

    auto decodeMessage = e.decode(encryptMessage, priv);

    return decodeMessage == msg;
}

int main() {
    if (testEncryptAndDecryptExample()) {
        qInfo() << "Success!";
    }
}

Signature and verification of the message signature.

#include <qrsaencryption.h>
#include <QDebug>

bool testExample() {
    QByteArray pub, priv;
    QRSAEncryption e(QRSAEncryption::Rsa::RSA_2048);
    e.generatePairKey(pub, priv); // or other rsa size

    QByteArray msg = "test message";

    auto signedMessage = e.signMessage(msg, priv);

    if (e.checkSignMessage(signedMessage, pub)) {
        qInfo() <<" message signed success";
        return true;
    }

    return false;

}

int main() {
    if (testExample()) {
        qInfo() <<"success!";
    }
}

AES

Sample code using a 128bit key in ECB mode

#include "qaesencryption.h"

QAESEncryption encryption(QAESEncryption::AES_128, QAESEncryption::ECB);
QByteArray encodedText = encryption.encode(plainText, key);

QByteArray decodedText = encryption.decode(encodedText, key);

Example for 256bit CBC using QString

#include <QCryptographicHash>
#include "qaesencryption.h"

QAESEncryption encryption(QAESEncryption::AES_256, QAESEncryption::CBC);

QString inputStr("The Advanced Encryption Standard (AES), also known by its original name Rijndael "
                 "is a specification for the encryption of electronic data established by the U.S. "
                "National Institute of Standards and Technology (NIST) in 2001");
QString key("your-string-key");
QString iv("your-IV-vector");

QByteArray hashKey = QCryptographicHash::hash(key.toLocal8Bit(), QCryptographicHash::Sha256);
QByteArray hashIV = QCryptographicHash::hash(iv.toLocal8Bit(), QCryptographicHash::Md5);

QByteArray encodeText = encryption.encode(inputStr.toLocal8Bit(), hashKey, hashIV);
QByteArray decodeText = encryption.decode(encodeText, hashKey, hashIV);

QString decodedString = QString(encryption.removePadding(decodeText));

//decodedString == inputStr !!! 

Example via static invocation

Static invocation without creating instances, 256 bit key, ECB mode, starting from QString text/key

#include <QCryptographicHash>
#include "qaesencryption.h"

QString inputStr("The Advanced Encryption Standard (AES), also known by its original name Rijndael "
                 "is a specification for the encryption of electronic data established by the U.S. "
                "National Institute of Standards and Technology (NIST) in 2001");
QString key("your-string-key");
QString iv("your-IV-vector");

QByteArray hashKey = QCryptographicHash::hash(key.toLocal8Bit(), QCryptographicHash::Sha256);
QByteArray hashIV = QCryptographicHash::hash(iv.toLocal8Bit(), QCryptographicHash::Md5);

//Static invocation
QByteArray encrypted = QAESEncryption::Crypt(QAESEncryption::AES_256, QAESEncryption::CBC, 
                        inputStr.toLocal8Bit(), hashKey, hashIV);
//...
// Removal of Padding via Static function
QString decodedString = QString(QAESEncryption::RemovePadding(decodeText));
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].