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 6636 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
6636
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__,111) : 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__,129) : 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 const QByteArrayMatcher lf("\n");-
105 const QByteArrayMatcher colon(":");-
106 int i = 0;-
107 while (i < der.count()
i < der.count()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
108 int j = colon.indexIn(der, i);-
109 if (j == -1
j == -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
110 break;
never executed: break;
0
111 const QByteArray field = der.mid(i, j - i).trimmed();-
112 j++;-
113-
114 QByteArray value;-
115 do {-
116 i = lf.indexIn(der, j);-
117 if (i == -1
i == -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
118 break;
never executed: break;
0
119 if (!value.isEmpty()
!value.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
120 value += ' ';
never executed: value += ' ';
0
121-
122 bool hasCR = (i
iDescription
TRUEnever evaluated
FALSEnever evaluated
&& der[i-1] == '\r'
der[i-1] == '\r'Description
TRUEnever evaluated
FALSEnever evaluated
);
0
123 int length = i -(hasCR
hasCRDescription
TRUEnever evaluated
FALSEnever evaluated
? 1: 0) - j;
0
124 value += der.mid(j, length).trimmed();-
125 j = ++i;-
126 }
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
127 if (i == -1
i == -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
128 break;
never executed: break;
0
129-
130 headers->insert(field, value);-
131 }
never executed: end of block
0
132 der = der.mid(i);-
133 }
never executed: end of block
0
134-
135 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
136}-
137QSslKey::QSslKey(const QByteArray &encoded, QSsl::KeyAlgorithm algorithm,-
138 QSsl::EncodingFormat encoding, QSsl::KeyType type, const QByteArray &passPhrase)-
139 : d(new QSslKeyPrivate)-
140{-
141 d->type = type;-
142 d->algorithm = algorithm;-
143 if (encoding == QSsl::Der
encoding == QSsl::DerDescription
TRUEevaluated 226 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEevaluated 415 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
)
226-415
144 d->decodeDer(encoded);
executed 226 times by 2 tests: d->decodeDer(encoded);
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
226
145 else-
146 d->decodePem(encoded, passPhrase);
executed 415 times by 4 tests: d->decodePem(encoded, passPhrase);
Executed by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
415
147}-
148QSslKey::QSslKey(QIODevice *device, QSsl::KeyAlgorithm algorithm, QSsl::EncodingFormat encoding,-
149 QSsl::KeyType type, const QByteArray &passPhrase)-
150 : d(new QSslKeyPrivate)-
151{-
152 QByteArray encoded;-
153 if (device
deviceDescription
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
FALSEnever evaluated
)
0-16
154 encoded = device->readAll();
executed 16 times by 2 tests: encoded = device->readAll();
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
16
155 d->type = type;-
156 d->algorithm = algorithm;-
157 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
158 d->decodeDer(encoded);
never executed: d->decodeDer(encoded);
0
159 else-
160 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
161}-
162QSslKey::QSslKey(Qt::HANDLE handle, QSsl::KeyType type)-
163 : d(new QSslKeyPrivate)-
164{-
165-
166 d->opaque = reinterpret_cast<EVP_PKEY *>(handle);-
167-
168-
169-
170 d->algorithm = QSsl::Opaque;-
171 d->type = type;-
172 d->isNull = !d->opaque;-
173}
executed 5 times by 1 test: end of block
Executed by:
  • tst_qsslsocket - unknown status
5
174-
175-
176-
177-
178QSslKey::QSslKey(const QSslKey &other) : d(other.d)-
179{-
180}
executed 1588 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
1588
181-
182-
183-
184-
185QSslKey::~QSslKey()-
186{-
187}-
188-
189-
190-
191-
192-
193-
194-
195QSslKey &QSslKey::operator=(const QSslKey &other)-
196{-
197 d = other.d;-
198 return
executed 796 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 796 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
796
199}-
200bool QSslKey::isNull() const-
201{-
202 return
executed 1319 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 1319 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
1319
203}-
204-
205-
206-
207-
208-
209-
210void QSslKey::clear()-
211{-
212 d = new QSslKeyPrivate;-
213}
never executed: end of block
0
214-
215-
216-
217-
218int QSslKey::length() const-
219{-
220 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
221}-
222-
223-
224-
225-
226QSsl::KeyType QSslKey::type() const-
227{-
228 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
229}-
230-
231-
232-
233-
234QSsl::KeyAlgorithm QSslKey::algorithm() const-
235{-
236 return
executed 1174 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 1174 times by 4 tests: return d->algorithm;
Executed by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
1174
237}-
238-
239-
240-
241-
242-
243-
244-
245QByteArray QSslKey::toDer(const QByteArray &passPhrase) const-
246{-
247 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
248 return
never executed: return QByteArray();
QByteArray();
never executed: return QByteArray();
0
249-
250-
251 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
252 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
253-
254-
255 QMap<QByteArray, QByteArray> headers;-
256 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
257-
258-
259-
260}-
261-
262-
263-
264-
265-
266-
267QByteArray QSslKey::toPem(const QByteArray &passPhrase) const-
268{-
269 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
270}-
271Qt::HANDLE QSslKey::handle() const-
272{-
273 return
executed 91 times by 2 tests: return d->handle();
Executed by:
  • tst_QNetworkReply
  • tst_qsslsocket - unknown status
d->handle();
executed 91 times by 2 tests: return d->handle();
Executed by:
  • tst_QNetworkReply
  • tst_qsslsocket - unknown status
91
274}-
275-
276-
277-
278-
279bool QSslKey::operator==(const QSslKey &other) const-
280{-
281 if (isNull()
isNull()Description
TRUEevaluated 63 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
)
63-232
282 return
executed 63 times by 4 tests: return other.isNull();
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
other.isNull();
executed 63 times by 4 tests: return other.isNull();
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslkey - unknown status
  • tst_qsslsocket - unknown status
63
283 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
284 return
never executed: return isNull();
isNull();
never executed: return isNull();
0
285 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
286 return
never executed: return false;
false;
never executed: return false;
0
287 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
288 return
never executed: return false;
false;
never executed: return false;
0
289 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
290 return
never executed: return false;
false;
never executed: return false;
0
291 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
292 return
never executed: return handle() == other.handle();
handle() == other.handle();
never executed: return handle() == other.handle();
0
293 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
294}-
295QDebug operator<<(QDebug debug, const QSslKey &key)-
296{-
297 QDebugStateSaver saver(debug);-
298 debug.resetFormat().nospace();-
299 debug << "QSslKey("-
300 << (key.type() == QSsl::PublicKey ? "PublicKey" : "PrivateKey")-
301 << ", " << (key.algorithm() == QSsl::Opaque ? "OPAQUE" :-
302 (key.algorithm() == QSsl::Rsa ? "RSA" : ((key.algorithm() == QSsl::Dsa) ? "DSA" : "EC")))-
303 << ", " << key.length()-
304 << ')';-
305 return
never executed: return debug;
debug;
never executed: return debug;
0
306}-
307-
308-
309-
Switch to Source codePreprocessed file

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