gpt4 book ai didi

qt - QSslCertificate::importPkcs12 无法解析 PFX 文件

转载 作者:太空宇宙 更新时间:2023-11-03 12:38:57 25 4
gpt4 key购买 nike

我正在尝试在我的 Qt 应用程序中解压我的 pkcs12 文件 - 但没有成功。我正在构建一个 Qt 控制台应用程序(禁用 GUI)

(我遵循了本指南:https://github.com/trueos/sysadm-ui-qt/blob/master/src-qt5/gui_client/SSLNotes.txt)

Pkcs12创建命令:

"openssl req -newkey rsa:2048 -nodes -keyout test_key.pem"
"openssl req -key test_key -new -x509 -out test_crt.crt"
"openssl pkcs12 -inkey test_key.pem -in test_crt.crt -export -passout stdin -out new.pfx"

Qt代码:

QString password="1234";
QFile pkcs("/Users/test/Desktop/certs/new.pfx");
pkcs.open(QFile::ReadOnly);
QSslKey key;
QSslCertificate cert;
QList<QSslCertificate> imported_certs;
static bool import=QSslCertificate::importPkcs12(&pkcs,&key,&cert,&imported_certs,QByteArray::fromStdString(password.toStdString()));

pkcs.close();
qDebug()<<import;

已使用 openssl 命令手动提取 key 和文件。

错误信息:

"Unimplemented Code."

有什么想法吗?

最佳答案

尝试像使用 Qt 5.5 一样使用 Qt < 5.6。

在 Qt 5.6 中,默认 SSL 后端从 OpenSSL 更改为 Mac OS 平台上的安全传输。

此问题已作为错误填写:https://bugreports.qt.io/browse/QTBUG-56596

关于qt - QSslCertificate::importPkcs12 无法解析 PFX 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39394029/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com