OpenCoverage

qsslkey_p.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/network/ssl/qsslkey_p.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8QSslKey::QSslKey()-
9 : d(new QSslKeyPrivate)-
10{-
11}
executed 13280 times by 17 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslellipticcurve - unknown status
  • tst_qsslerror - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
13280
12-
13-
14-
15-
16QByteArray QSslKeyPrivate::pemHeader() const-
17{-
18 if (type == QSsl::PublicKey
type == QSsl::PublicKeyDescription
TRUEevaluated 590 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEevaluated 576 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
)
576-590
19 return
executed 590 times by 2 tests: return ([]() -> QByteArray { enum { Size = sizeof("-----BEGIN PUBLIC KEY-----") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "-----BEGIN PUBLIC KEY-----" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }());
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
([]() -> QByteArray { enum { Size = sizeof("-----BEGIN PUBLIC KEY-----") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "-----BEGIN PUBLIC KEY-----" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return
executed 590 times by 2 tests: return ba;
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
ba;
executed 590 times by 2 tests: return ba;
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
}());
executed 590 times by 2 tests: return ([]() -> QByteArray { enum { Size = sizeof("-----BEGIN PUBLIC KEY-----") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "-----BEGIN PUBLIC KEY-----" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }());
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
590
20 else if (algorithm == QSsl::Rsa
algorithm == QSsl::RsaDescription
TRUEevaluated 289 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEevaluated 287 times by 1 test
Evaluated by:
  • tst_qsslkey - unknown status
)
287-289
21 return
executed 289 times by 2 tests: return ([]() -> QByteArray { enum { Size = sizeof("-----BEGIN RSA PRIVATE KEY-----") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "-----BEGIN RSA PRIVATE KEY-----" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }());
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
([]() -> QByteArray { enum { Size = sizeof("-----BEGIN RSA PRIVATE KEY-----") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "-----BEGIN RSA PRIVATE KEY-----" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return
executed 289 times by 2 tests: return ba;
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
ba;
executed 289 times by 2 tests: return ba;
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
}());
executed 289 times by 2 tests: return ([]() -> QByteArray { enum { Size = sizeof("-----BEGIN RSA PRIVATE KEY-----") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "-----BEGIN RSA PRIVATE KEY-----" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }());
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
289
22 else if (algorithm == QSsl::Dsa
algorithm == QSsl::DsaDescription
TRUEevaluated 164 times by 1 test
Evaluated by:
  • tst_qsslkey - unknown status
FALSEevaluated 123 times by 1 test
Evaluated by:
  • tst_qsslkey - unknown status
)
123-164
23 return
executed 164 times by 1 test: return ([]() -> QByteArray { enum { Size = sizeof("-----BEGIN DSA PRIVATE KEY-----") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "-----BEGIN DSA PRIVATE KEY-----" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }());
Executed by:
  • tst_qsslkey - unknown status
([]() -> QByteArray { enum { Size = sizeof("-----BEGIN DSA PRIVATE KEY-----") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "-----BEGIN DSA PRIVATE KEY-----" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return
executed 164 times by 1 test: return ba;
Executed by:
  • tst_qsslkey - unknown status
ba;
executed 164 times by 1 test: return ba;
Executed by:
  • tst_qsslkey - unknown status
}());
executed 164 times by 1 test: return ([]() -> QByteArray { enum { Size = sizeof("-----BEGIN DSA PRIVATE KEY-----") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "-----BEGIN DSA PRIVATE KEY-----" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }());
Executed by:
  • tst_qsslkey - unknown status
164
24 else if (algorithm == QSsl::Ec
algorithm == QSsl::EcDescription
TRUEevaluated 123 times by 1 test
Evaluated by:
  • tst_qsslkey - unknown status
FALSEnever evaluated
)
0-123
25 return
executed 123 times by 1 test: return ([]() -> QByteArray { enum { Size = sizeof("-----BEGIN EC PRIVATE KEY-----") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "-----BEGIN EC PRIVATE KEY-----" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }());
Executed by:
  • tst_qsslkey - unknown status
([]() -> QByteArray { enum { Size = sizeof("-----BEGIN EC PRIVATE KEY-----") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "-----BEGIN EC PRIVATE KEY-----" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return
executed 123 times by 1 test: return ba;
Executed by:
  • tst_qsslkey - unknown status
ba;
executed 123 times by 1 test: return ba;
Executed by:
  • tst_qsslkey - unknown status
}());
executed 123 times by 1 test: return ([]() -> QByteArray { enum { Size = sizeof("-----BEGIN EC PRIVATE KEY-----") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "-----BEGIN EC PRIVATE KEY-----" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }());
Executed by:
  • tst_qsslkey - unknown status
123
26-
27 do { ((!(false)) ? qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached",__FILE__,116) : qt_noop()); __builtin_unreachable(); } while (0);-
28 return
never executed: return QByteArray();
QByteArray();
never executed: return QByteArray();
0
29}-
30-
31-
32-
33-
34QByteArray QSslKeyPrivate::pemFooter() const-
35{-
36 if (type == QSsl::PublicKey
type == QSsl::PublicKeyDescription
TRUEevaluated 590 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEevaluated 576 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
)
576-590
37 return
executed 590 times by 2 tests: return ([]() -> QByteArray { enum { Size = sizeof("-----END PUBLIC KEY-----") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "-----END PUBLIC KEY-----" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }());
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
([]() -> QByteArray { enum { Size = sizeof("-----END PUBLIC KEY-----") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "-----END PUBLIC KEY-----" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return
executed 590 times by 2 tests: return ba;
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
ba;
executed 590 times by 2 tests: return ba;
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
}());
executed 590 times by 2 tests: return ([]() -> QByteArray { enum { Size = sizeof("-----END PUBLIC KEY-----") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "-----END PUBLIC KEY-----" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }());
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
590
38 else if (algorithm == QSsl::Rsa
algorithm == QSsl::RsaDescription
TRUEevaluated 289 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEevaluated 287 times by 1 test
Evaluated by:
  • tst_qsslkey - unknown status
)
287-289
39 return
executed 289 times by 2 tests: return ([]() -> QByteArray { enum { Size = sizeof("-----END RSA PRIVATE KEY-----") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "-----END RSA PRIVATE KEY-----" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }());
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
([]() -> QByteArray { enum { Size = sizeof("-----END RSA PRIVATE KEY-----") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "-----END RSA PRIVATE KEY-----" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return
executed 289 times by 2 tests: return ba;
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
ba;
executed 289 times by 2 tests: return ba;
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
}());
executed 289 times by 2 tests: return ([]() -> QByteArray { enum { Size = sizeof("-----END RSA PRIVATE KEY-----") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "-----END RSA PRIVATE KEY-----" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }());
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
289
40 else if (algorithm == QSsl::Dsa
algorithm == QSsl::DsaDescription
TRUEevaluated 164 times by 1 test
Evaluated by:
  • tst_qsslkey - unknown status
FALSEevaluated 123 times by 1 test
Evaluated by:
  • tst_qsslkey - unknown status
)
123-164
41 return
executed 164 times by 1 test: return ([]() -> QByteArray { enum { Size = sizeof("-----END DSA PRIVATE KEY-----") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "-----END DSA PRIVATE KEY-----" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }());
Executed by:
  • tst_qsslkey - unknown status
([]() -> QByteArray { enum { Size = sizeof("-----END DSA PRIVATE KEY-----") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "-----END DSA PRIVATE KEY-----" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return
executed 164 times by 1 test: return ba;
Executed by:
  • tst_qsslkey - unknown status
ba;
executed 164 times by 1 test: return ba;
Executed by:
  • tst_qsslkey - unknown status
}());
executed 164 times by 1 test: return ([]() -> QByteArray { enum { Size = sizeof("-----END DSA PRIVATE KEY-----") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "-----END DSA PRIVATE KEY-----" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }());
Executed by:
  • tst_qsslkey - unknown status
164
42 else if (algorithm == QSsl::Ec
algorithm == QSsl::EcDescription
TRUEevaluated 123 times by 1 test
Evaluated by:
  • tst_qsslkey - unknown status
FALSEnever evaluated
)
0-123
43 return
executed 123 times by 1 test: return ([]() -> QByteArray { enum { Size = sizeof("-----END EC PRIVATE KEY-----") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "-----END EC PRIVATE KEY-----" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }());
Executed by:
  • tst_qsslkey - unknown status
([]() -> QByteArray { enum { Size = sizeof("-----END EC PRIVATE KEY-----") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "-----END EC PRIVATE KEY-----" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return
executed 123 times by 1 test: return ba;
Executed by:
  • tst_qsslkey - unknown status
ba;
executed 123 times by 1 test: return ba;
Executed by:
  • tst_qsslkey - unknown status
}());
executed 123 times by 1 test: return ([]() -> QByteArray { enum { Size = sizeof("-----END EC PRIVATE KEY-----") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "-----END EC PRIVATE KEY-----" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }());
Executed by:
  • tst_qsslkey - unknown status
123
44-
45 do { ((!(false)) ? qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached",__FILE__,134) : qt_noop()); __builtin_unreachable(); } while (0);-
46 return
never executed: return QByteArray();
QByteArray();
never executed: return QByteArray();
0
47}-
48-
49-
50-
51-
52-
53-
54QByteArray QSslKeyPrivate::pemFromDer(const QByteArray &der, const QMap<QByteArray, QByteArray> &headers) const-
55{-
56 QByteArray pem(der.toBase64());-
57-
58 const int lineWidth = 64;-
59 const int newLines = pem.size() / lineWidth;-
60 const bool rem = pem.size() % lineWidth;-
61-
62-
63 for (int i = 0; i < newLines
i < newLinesDescription
TRUEevaluated 1254 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEevaluated 226 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
; ++i)
226-1254
64 pem.insert((i + 1) * lineWidth + i, '\n');
executed 1254 times by 2 tests: pem.insert((i + 1) * lineWidth + i, '\n');
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
1254
65 if (rem
remDescription
TRUEevaluated 218 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qsslkey - unknown status
)
8-218
66 pem.append('\n');
executed 218 times by 2 tests: pem.append('\n');
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
218
67-
68 QByteArray extra;-
69 if (!headers.isEmpty()
!headers.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 226 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
) {
0-226
70 QMap<QByteArray, QByteArray>::const_iterator it = headers.constEnd();-
71 do {-
72 --it;-
73 extra += it.key() + ": " + it.value() + '\n';-
74 }
never executed: end of block
while (it != headers.constBegin()
it != headers.constBegin()Description
TRUEnever evaluated
FALSEnever evaluated
);
0
75 extra += '\n';-
76 }
never executed: end of block
0
77 pem.prepend(pemHeader() + '\n' + extra);-
78 pem.append(pemFooter() + '\n');-
79-
80 return
executed 226 times by 2 tests: return pem;
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
pem;
executed 226 times by 2 tests: return pem;
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
226
81}-
82-
83-
84-
85-
86-
87-
88QByteArray QSslKeyPrivate::derFromPem(const QByteArray &pem, QMap<QByteArray, QByteArray> *headers) const-
89{-
90 const QByteArray header = pemHeader();-
91 const QByteArray footer = pemFooter();-
92-
93 QByteArray der(pem);-
94-
95 const int headerIndex = der.indexOf(header);-
96 const int footerIndex = der.indexOf(footer);-
97 if (headerIndex == -1
headerIndex == -1Description
TRUEnever evaluated
FALSEevaluated 940 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
|| footerIndex == -1
footerIndex == -1Description
TRUEnever evaluated
FALSEevaluated 940 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
)
0-940
98 return
never executed: return QByteArray();
QByteArray();
never executed: return QByteArray();
0
99-
100 der = der.mid(headerIndex + header.size(), footerIndex - (headerIndex + header.size()));-
101-
102 if (der.contains("Proc-Type:")
der.contains("Proc-Type:")Description
TRUEnever evaluated
FALSEevaluated 940 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
) {
0-940
103-
104 int i = 0;-
105 while (i < der.count()
i < der.count()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
106 int j = der.indexOf(':', i);-
107 if (j == -1
j == -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
108 break;
never executed: break;
0
109 const QByteArray field = der.mid(i, j - i).trimmed();-
110 j++;-
111-
112 QByteArray value;-
113 do {-
114 i = der.indexOf('\n', j);-
115 if (i == -1
i == -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
116 break;
never executed: break;
0
117 if (!value.isEmpty()
!value.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
118 value += ' ';
never executed: value += ' ';
0
119-
120 bool hasCR = (i
iDescription
TRUEnever evaluated
FALSEnever evaluated
&& der[i-1] == '\r'
der[i-1] == '\r'Description
TRUEnever evaluated
FALSEnever evaluated
);
0
121 int length = i -(hasCR
hasCRDescription
TRUEnever evaluated
FALSEnever evaluated
? 1: 0) - j;
0
122 value += der.mid(j, length).trimmed();-
123 j = ++i;-
124 }
never executed: end of block
while (i < der.count()
i < der.count()Description
TRUEnever evaluated
FALSEnever evaluated
&& (der.at(i) == ' '
der.at(i) == ' 'Description
TRUEnever evaluated
FALSEnever evaluated
|| der.at(i) == '\t'
der.at(i) == '\t'Description
TRUEnever evaluated
FALSEnever evaluated
));
0
125 if (i == -1
i == -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
126 break;
never executed: break;
0
127-
128 headers->insert(field, value);-
129 }
never executed: end of block
0
130 der = der.mid(i);-
131 }
never executed: end of block
0
132-
133 return
executed 940 times by 2 tests: return QByteArray::fromBase64(der);
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
QByteArray::fromBase64(der);
executed 940 times by 2 tests: return QByteArray::fromBase64(der);
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
940
134}-
135QSslKey::QSslKey(const QByteArray &encoded, QSsl::KeyAlgorithm algorithm,-
136 QSsl::EncodingFormat encoding, QSsl::KeyType type, const QByteArray &passPhrase)-
137 : d(new QSslKeyPrivate)-
138{-
139 d->type = type;-
140 d->algorithm = algorithm;-
141 if (encoding == QSsl::Der
encoding == QSsl::DerDescription
TRUEevaluated 226 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEevaluated 417 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
)
226-417
142 d->decodeDer(encoded);
executed 226 times by 2 tests: d->decodeDer(encoded);
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
226
143 else-
144 d->decodePem(encoded, passPhrase);
executed 417 times by 4 tests: d->decodePem(encoded, passPhrase);
Executed by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
417
145}-
146QSslKey::QSslKey(QIODevice *device, QSsl::KeyAlgorithm algorithm, QSsl::EncodingFormat encoding,-
147 QSsl::KeyType type, const QByteArray &passPhrase)-
148 : d(new QSslKeyPrivate)-
149{-
150 QByteArray encoded;-
151 if (device
deviceDescription
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEnever evaluated
)
0-16
152 encoded = device->readAll();
executed 16 times by 2 tests: encoded = device->readAll();
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
16
153 d->type = type;-
154 d->algorithm = algorithm;-
155 if (encoding == QSsl::Der
encoding == QSsl::DerDescription
TRUEnever evaluated
FALSEevaluated 16 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
)
0-16
156 d->decodeDer(encoded);
never executed: d->decodeDer(encoded);
0
157 else-
158 d->decodePem(encoded, passPhrase);
executed 16 times by 2 tests: d->decodePem(encoded, passPhrase);
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
16
159}-
160QSslKey::QSslKey(Qt::HANDLE handle, QSsl::KeyType type)-
161 : d(new QSslKeyPrivate)-
162{-
163-
164 d->opaque = reinterpret_cast<EVP_PKEY *>(handle);-
165-
166-
167-
168 d->algorithm = QSsl::Opaque;-
169 d->type = type;-
170 d->isNull = !d->opaque;-
171}
executed 5 times by 1 test: end of block
Executed by:
  • tst_qsslsocket - unknown status
5
172-
173-
174-
175-
176QSslKey::QSslKey(const QSslKey &other) : d(other.d)-
177{-
178}
executed 2828 times by 9 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
2828
179-
180-
181-
182-
183QSslKey::~QSslKey()-
184{-
185}-
186-
187-
188-
189-
190-
191-
192-
193QSslKey &QSslKey::operator=(const QSslKey &other)-
194{-
195 d = other.d;-
196 return
executed 805 times by 8 tests: return *this;
Executed by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
*this;
executed 805 times by 8 tests: return *this;
Executed by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
805
197}-
198bool QSslKey::isNull() const-
199{-
200 return
executed 1418 times by 6 tests: return d->isNull;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
d->isNull;
executed 1418 times by 6 tests: return d->isNull;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
1418
201}-
202-
203-
204-
205-
206-
207-
208void QSslKey::clear()-
209{-
210 d = new QSslKeyPrivate;-
211}
never executed: end of block
0
212-
213-
214-
215-
216int QSslKey::length() const-
217{-
218 return
executed 745 times by 2 tests: return d->length();
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
d->length();
executed 745 times by 2 tests: return d->length();
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
745
219}-
220-
221-
222-
223-
224QSsl::KeyType QSslKey::type() const-
225{-
226 return
executed 688 times by 2 tests: return d->type;
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
d->type;
executed 688 times by 2 tests: return d->type;
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
688
227}-
228-
229-
230-
231-
232QSsl::KeyAlgorithm QSslKey::algorithm() const-
233{-
234 return
executed 1180 times by 4 tests: return d->algorithm;
Executed by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
d->algorithm;
executed 1180 times by 4 tests: return d->algorithm;
Executed by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
1180
235}-
236-
237-
238-
239-
240-
241-
242-
243QByteArray QSslKey::toDer(const QByteArray &passPhrase) const-
244{-
245 if (d->isNull
d->isNullDescription
TRUEnever evaluated
FALSEevaluated 1052 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
|| d->algorithm == QSsl::Opaque
d->algorithm == QSsl::OpaqueDescription
TRUEnever evaluated
FALSEevaluated 1052 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
)
0-1052
246 return
never executed: return QByteArray();
QByteArray();
never executed: return QByteArray();
0
247-
248-
249 if (d->type == QSsl::PrivateKey
d->type == QSsl::PrivateKeyDescription
TRUEevaluated 576 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEevaluated 476 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
&& !passPhrase.isEmpty()
!passPhrase.isEmpty()Description
TRUEevaluated 112 times by 1 test
Evaluated by:
  • tst_qsslkey - unknown status
FALSEevaluated 464 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
)
112-576
250 return
executed 112 times by 1 test: return QByteArray();
Executed by:
  • tst_qsslkey - unknown status
QByteArray();
executed 112 times by 1 test: return QByteArray();
Executed by:
  • tst_qsslkey - unknown status
112
251-
252-
253 QMap<QByteArray, QByteArray> headers;-
254 return
executed 940 times by 2 tests: return d->derFromPem(toPem(passPhrase), &headers);
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
d->derFromPem(toPem(passPhrase), &headers);
executed 940 times by 2 tests: return d->derFromPem(toPem(passPhrase), &headers);
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
940
255-
256-
257-
258}-
259-
260-
261-
262-
263-
264-
265QByteArray QSslKey::toPem(const QByteArray &passPhrase) const-
266{-
267 return
executed 1752 times by 2 tests: return d->toPem(passPhrase);
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
d->toPem(passPhrase);
executed 1752 times by 2 tests: return d->toPem(passPhrase);
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
1752
268}-
269Qt::HANDLE QSslKey::handle() const-
270{-
271 return
executed 93 times by 2 tests: return d->handle();
Executed by:
  • tst_QNetworkReply
  • tst_qsslsocket - unknown status
d->handle();
executed 93 times by 2 tests: return d->handle();
Executed by:
  • tst_QNetworkReply
  • tst_qsslsocket - unknown status
93
272}-
273-
274-
275-
276-
277bool QSslKey::operator==(const QSslKey &other) const-
278{-
279 if (isNull()
isNull()Description
TRUEevaluated 84 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
FALSEevaluated 232 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
)
84-232
280 return
executed 84 times by 4 tests: return other.isNull();
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
other.isNull();
executed 84 times by 4 tests: return other.isNull();
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
84
281 if (other.isNull()
other.isNull()Description
TRUEnever evaluated
FALSEevaluated 232 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
)
0-232
282 return
never executed: return isNull();
isNull();
never executed: return isNull();
0
283 if (algorithm() != other.algorithm()
algorithm() !=...er.algorithm()Description
TRUEnever evaluated
FALSEevaluated 232 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
)
0-232
284 return
never executed: return false;
false;
never executed: return false;
0
285 if (type() != other.type()
type() != other.type()Description
TRUEnever evaluated
FALSEevaluated 232 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
)
0-232
286 return
never executed: return false;
false;
never executed: return false;
0
287 if (length() != other.length()
length() != other.length()Description
TRUEnever evaluated
FALSEevaluated 232 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
)
0-232
288 return
never executed: return false;
false;
never executed: return false;
0
289 if (algorithm() == QSsl::Opaque
algorithm() == QSsl::OpaqueDescription
TRUEnever evaluated
FALSEevaluated 232 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
)
0-232
290 return
never executed: return handle() == other.handle();
handle() == other.handle();
never executed: return handle() == other.handle();
0
291 return
executed 232 times by 2 tests: return toDer() == other.toDer();
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
toDer() == other.toDer();
executed 232 times by 2 tests: return toDer() == other.toDer();
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
232
292}-
293QDebug operator<<(QDebug debug, const QSslKey &key)-
294{-
295 QDebugStateSaver saver(debug);-
296 debug.resetFormat().nospace();-
297 debug << "QSslKey("-
298 << (key.type() == QSsl::PublicKey ? "PublicKey" : "PrivateKey")-
299 << ", " << (key.algorithm() == QSsl::Opaque ? "OPAQUE" :-
300 (key.algorithm() == QSsl::Rsa ? "RSA" : ((key.algorithm() == QSsl::Dsa) ? "DSA" : "EC")))-
301 << ", " << key.length()-
302 << ')';-
303 return
never executed: return debug;
debug;
never executed: return debug;
0
304}-
305-
306-
307-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9