Does Qt support RSA encryption?

Does Qt support rsa encryption, it seems QSslkey does not work. thanks in advance.

+6
source share
3 answers

Qt supports RSA for SSL connections. RSA interfaces are not directly available.

You can see the Qt Cryptographic Architecture project , but it is no longer supported.

+4
source

Qt supports RSA encryption. You must tell QSslKey the correct algorithm: http://doc.qt.io/qt-5/qssl.html#KeyAlgorithm-enum

+3
source

ssl-, Qt-Secret. qmake, .


:

  • git clone 'https://github.com/QuasarApp/Qt-Secret.git'
    cd Qt-Secret
    git submodule update --init --recursive
    qmake -r 
    make -j8
    make test #(for testing)
    

qmake

  • 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 --update
    
  • pro pri Qt-Secret:

    include($$PWD/Qt-Secret/src/Qt-Secret.pri)
    
  • .

  • 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 --update
    
  • Qt-Secret.

  • INCLUDEPATH LIBS .
  • .

RSA

Encryption and decryption of messages.

#include <qrsaencryption.h>

    QByteArray pub, priv;
    QRSAEncryption e(QRSAEncryption::Rsa::RSA_2048);
    e.generatePairKey(pub, priv);
    QByteArray msg = "test message";

    auto encodeData = e.encode(msg, pub);
    auto decodeData = e.decode(encodeData, priv);

Signature and verification of the signature of the message.

#include <qrsaencryption.h>

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

    QByteArray msg = "test message";

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

    if (e.checkSignMessage(signedMessage, pub)) {
        // message signed success
    }

+1
source

All Articles