Qt: data decryption using private/public key

2019-07-29 17:44发布

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条回答
等我变得足够好
2楼-- · 2019-07-29 18:04

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

查看更多
登录 后发表回答