Qt:使用私钥/公钥进行数据解密 [英] Qt: data decryption using private/public key

查看:120
本文介绍了Qt:使用私钥/公钥进行数据解密的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想解密使用私钥加密的数据.我可以按如下方式加载用于解密的公钥:

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:使用私钥/公钥进行数据解密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆