Hyndrix
Hyndrix

Reputation: 4452

Qt: data decryption using private/public key

I want to decrypt data which has been encrypted using a private key. I can load the public key for decryption as follows:

QFile file(":/sample.crt");
file.open(QIODevice::ReadOnly);
const QByteArray bytes = file.readAll();
file.close();

QSslCertificate ssl(bytes, QSsl::Pem);
//Key: ssl.publicKey();

But how can I use the key do decrypt the data? I know that there are 3rd party libraries like QCA (http://delta.affinix.com/qca/) but is it possible to do this with the built-in Qt functions?

Regards,

Upvotes: 1

Views: 1669

Answers (1)

Hyndrix
Hyndrix

Reputation: 4452

I came to the conclusion that Qt does not support this. A good workaround is to use EVP OpenSSL functions: https://wiki.openssl.org/index.php/EVP_Authenticated_Encryption_and_Decryption

Upvotes: 0

Related Questions