问题
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,
回答1:
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
来源:https://stackoverflow.com/questions/39115958/qt-data-decryption-using-private-public-key