Commit 0d9d4ddd authored by Dawit Alemayehu's avatar Dawit Alemayehu

Use QSslCertificate's fromDevice instead fromPath to import certificates.

QSslCertificate::fromPath seems to have problem importing certs in DER format.

CCBUG: 333079
REVIEW: 121092
parent 6ae2b000
......@@ -298,9 +298,13 @@ void CaCertificatesPage::addCertificateClicked()
foreach (const QString &certFile, certFiles) {
// trying both formats is easiest to program and most user-friendly if somewhat sloppy
const int prevCertCount = certs.count();
certs += QSslCertificate::fromPath(certFile, QSsl::Pem);
if (prevCertCount == certs.count()) {
certs += QSslCertificate::fromPath(certFile, QSsl::Der);
QFile file (certFile);
if (file.open(QIODevice::ReadOnly)) {
certs += QSslCertificate::fromDevice(&file, QSsl::Pem);
if (prevCertCount == certs.count()) {
file.reset();
certs += QSslCertificate::fromDevice(&file, QSsl::Der);
}
}
if (prevCertCount == certs.count()) {
kDebug(7029) << "failed to load certificate file" << certFile;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment