2019-07-24 20:53:55 +03:00
|
|
|
#include "secretworker.h"
|
|
|
|
|
|
|
|
SecretWorker::SecretWorker(QObject *parent) : QObject(parent)
|
|
|
|
{}
|
|
|
|
|
|
|
|
void SecretWorker::generateKeys(int rsa)
|
|
|
|
{
|
|
|
|
QRSAEncryption::generatePairKeyS(pubKey, privKey, QRSAEncryption::Rsa(rsa));
|
|
|
|
emit showKeysOnQml();
|
|
|
|
}
|
2019-07-31 01:32:47 +03:00
|
|
|
|
2019-08-07 19:53:43 +03:00
|
|
|
void SecretWorker::encryptMessage(QString encPubKey, QString inputText)
|
2019-07-31 01:32:47 +03:00
|
|
|
{
|
2019-08-07 19:53:43 +03:00
|
|
|
message = QRSAEncryption::encodeS(inputText.toUtf8(), encPubKey.toUtf8(), QRSAEncryption::Rsa(encPubKey.length() * 4));
|
2019-07-31 01:32:47 +03:00
|
|
|
emit showMessageOnQml();
|
|
|
|
}
|
|
|
|
|
2019-08-07 19:53:43 +03:00
|
|
|
void SecretWorker::decryptMessage(QString decPrivKey, QString inputMessage)
|
2019-07-31 01:32:47 +03:00
|
|
|
{
|
2019-08-07 19:53:43 +03:00
|
|
|
message = QRSAEncryption::decodeS(inputMessage.toUtf8(), decPrivKey.toUtf8(), QRSAEncryption::Rsa(decPrivKey.length() * 4));
|
2019-07-31 01:32:47 +03:00
|
|
|
emit showMessageOnQml();
|
|
|
|
}
|