问题描述
我想解密使用私钥加密的数据.我可以按如下方式加载用于解密的公钥:
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();
但是如何使用密钥解密数据?我知道有像QCA( http://delta.affinix.com/qca/),但是可以使用内置的Qt函数来做到这一点吗?
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?
此致
推荐答案
我得出的结论是Qt不支持此功能.一个好的解决方法是使用EVP OpenSSL函数: https://wiki.openssl.org/index.php/EVP_Authenticated_Encryption_and_Decryption
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
这篇关于Qt:使用私钥/公钥进行数据解密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!