OpenCoverage

qsslerror.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/network/ssl/qsslerror.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6class QSslErrorPrivate-
7{-
8public:-
9 QSslError::SslError error;-
10 QSslCertificate certificate;-
11};-
12QSslError::QSslError()-
13 : d(new QSslErrorPrivate)-
14{-
15 d->error = QSslError::NoError;-
16 d->certificate = QSslCertificate();-
17}
executed 753 times by 9 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslerror - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
753
18-
19-
20-
21-
22-
23-
24QSslError::QSslError(SslError error)-
25 : d(new QSslErrorPrivate)-
26{-
27 d->error = error;-
28 d->certificate = QSslCertificate();-
29}
executed 8 times by 3 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
8
30-
31-
32-
33-
34-
35-
36-
37QSslError::QSslError(SslError error, const QSslCertificate &certificate)-
38 : d(new QSslErrorPrivate)-
39{-
40 d->error = error;-
41 d->certificate = certificate;-
42}
executed 826 times by 8 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
826
43-
44-
45-
46-
47QSslError::QSslError(const QSslError &other)-
48 : d(new QSslErrorPrivate)-
49{-
50 *d.data() = *other.d.data();-
51}
executed 536 times by 9 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslerror - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
536
52-
53-
54-
55-
56QSslError::~QSslError()-
57{-
58}-
59-
60-
61-
62-
63-
64-
65QSslError &QSslError::operator=(const QSslError &other)-
66{-
67 *d.data() = *other.d.data();-
68 return
never executed: return *this;
*this;
never executed: return *this;
0
69}-
70bool QSslError::operator==(const QSslError &other) const-
71{-
72 return
executed 73 times by 3 tests: return d->error == other.d->error && d->certificate == other.d->certificate;
Executed by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
d->error == other.d->error
executed 73 times by 3 tests: return d->error == other.d->error && d->certificate == other.d->certificate;
Executed by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
73
73 && d->certificate == other.d->certificate;
executed 73 times by 3 tests: return d->error == other.d->error && d->certificate == other.d->certificate;
Executed by:
  • tst_QNetworkReply
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
73
74}-
75QSslError::SslError QSslError::error() const-
76{-
77 return
executed 64 times by 3 tests: return d->error;
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslerror - unknown status
  • tst_qsslsocket - unknown status
d->error;
executed 64 times by 3 tests: return d->error;
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslerror - unknown status
  • tst_qsslsocket - unknown status
64
78}-
79-
80-
81-
82-
83-
84-
85QString QSslError::errorString() const-
86{-
87 QString errStr;-
88 switch (d->error) {-
89 case
never executed: case NoError:
NoError:
never executed: case NoError:
0
90 errStr = QSslSocket::tr("No error");-
91 break;
never executed: break;
0
92 case
never executed: case UnableToGetIssuerCertificate:
UnableToGetIssuerCertificate:
never executed: case UnableToGetIssuerCertificate:
0
93 errStr = QSslSocket::tr("The issuer certificate could not be found");-
94 break;
never executed: break;
0
95 case
never executed: case UnableToDecryptCertificateSignature:
UnableToDecryptCertificateSignature:
never executed: case UnableToDecryptCertificateSignature:
0
96 errStr = QSslSocket::tr("The certificate signature could not be decrypted");-
97 break;
never executed: break;
0
98 case
never executed: case UnableToDecodeIssuerPublicKey:
UnableToDecodeIssuerPublicKey:
never executed: case UnableToDecodeIssuerPublicKey:
0
99 errStr = QSslSocket::tr("The public key in the certificate could not be read");-
100 break;
never executed: break;
0
101 case
never executed: case CertificateSignatureFailed:
CertificateSignatureFailed:
never executed: case CertificateSignatureFailed:
0
102 errStr = QSslSocket::tr("The signature of the certificate is invalid");-
103 break;
never executed: break;
0
104 case
never executed: case CertificateNotYetValid:
CertificateNotYetValid:
never executed: case CertificateNotYetValid:
0
105 errStr = QSslSocket::tr("The certificate is not yet valid");-
106 break;
never executed: break;
0
107 case
executed 2 times by 1 test: case CertificateExpired:
Executed by:
  • tst_qsslcertificate - unknown status
CertificateExpired:
executed 2 times by 1 test: case CertificateExpired:
Executed by:
  • tst_qsslcertificate - unknown status
2
108 errStr = QSslSocket::tr("The certificate has expired");-
109 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_qsslcertificate - unknown status
2
110 case
never executed: case InvalidNotBeforeField:
InvalidNotBeforeField:
never executed: case InvalidNotBeforeField:
0
111 errStr = QSslSocket::tr("The certificate's notBefore field contains an invalid time");-
112 break;
never executed: break;
0
113 case
never executed: case InvalidNotAfterField:
InvalidNotAfterField:
never executed: case InvalidNotAfterField:
0
114 errStr = QSslSocket::tr("The certificate's notAfter field contains an invalid time");-
115 break;
never executed: break;
0
116 case
executed 60 times by 5 tests: case SelfSignedCertificate:
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
SelfSignedCertificate:
executed 60 times by 5 tests: case SelfSignedCertificate:
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
60
117 errStr = QSslSocket::tr("The certificate is self-signed, and untrusted");-
118 break;
executed 60 times by 5 tests: break;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
60
119 case
never executed: case SelfSignedCertificateInChain:
SelfSignedCertificateInChain:
never executed: case SelfSignedCertificateInChain:
0
120 errStr = QSslSocket::tr("The root certificate of the certificate chain is self-signed, and untrusted");-
121 break;
never executed: break;
0
122 case
executed 13 times by 3 tests: case UnableToGetLocalIssuerCertificate:
Executed by:
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
UnableToGetLocalIssuerCertificate:
executed 13 times by 3 tests: case UnableToGetLocalIssuerCertificate:
Executed by:
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
13
123 errStr = QSslSocket::tr("The issuer certificate of a locally looked up certificate could not be found");-
124 break;
executed 13 times by 3 tests: break;
Executed by:
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
13
125 case
never executed: case UnableToVerifyFirstCertificate:
UnableToVerifyFirstCertificate:
never executed: case UnableToVerifyFirstCertificate:
0
126 errStr = QSslSocket::tr("No certificates could be verified");-
127 break;
never executed: break;
0
128 case
executed 1 time by 1 test: case InvalidCaCertificate:
Executed by:
  • tst_qsslcertificate - unknown status
InvalidCaCertificate:
executed 1 time by 1 test: case InvalidCaCertificate:
Executed by:
  • tst_qsslcertificate - unknown status
1
129 errStr = QSslSocket::tr("One of the CA certificates is invalid");-
130 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_qsslcertificate - unknown status
1
131 case
never executed: case PathLengthExceeded:
PathLengthExceeded:
never executed: case PathLengthExceeded:
0
132 errStr = QSslSocket::tr("The basicConstraints path length parameter has been exceeded");-
133 break;
never executed: break;
0
134 case
executed 1 time by 1 test: case InvalidPurpose:
Executed by:
  • tst_qsslsocket - unknown status
InvalidPurpose:
executed 1 time by 1 test: case InvalidPurpose:
Executed by:
  • tst_qsslsocket - unknown status
1
135 errStr = QSslSocket::tr("The supplied certificate is unsuitable for this purpose");-
136 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_qsslsocket - unknown status
1
137 case
never executed: case CertificateUntrusted:
CertificateUntrusted:
never executed: case CertificateUntrusted:
0
138 errStr = QSslSocket::tr("The root CA certificate is not trusted for this purpose");-
139 break;
never executed: break;
0
140 case
never executed: case CertificateRejected:
CertificateRejected:
never executed: case CertificateRejected:
0
141 errStr = QSslSocket::tr("The root CA certificate is marked to reject the specified purpose");-
142 break;
never executed: break;
0
143 case
never executed: case SubjectIssuerMismatch:
SubjectIssuerMismatch:
never executed: case SubjectIssuerMismatch:
0
144 errStr = QSslSocket::tr("The current candidate issuer certificate was rejected because its"-
145 " subject name did not match the issuer name of the current certificate");-
146 break;
never executed: break;
0
147 case
never executed: case AuthorityIssuerSerialNumberMismatch:
AuthorityIssuerSerialNumberMismatch:
never executed: case AuthorityIssuerSerialNumberMismatch:
0
148 errStr = QSslSocket::tr("The current candidate issuer certificate was rejected because"-
149 " its issuer name and serial number was present and did not match the"-
150 " authority key identifier of the current certificate");-
151 break;
never executed: break;
0
152 case
executed 1 time by 1 test: case NoPeerCertificate:
Executed by:
  • tst_qsslsocket - unknown status
NoPeerCertificate:
executed 1 time by 1 test: case NoPeerCertificate:
Executed by:
  • tst_qsslsocket - unknown status
1
153 errStr = QSslSocket::tr("The peer did not present any certificate");-
154 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_qsslsocket - unknown status
1
155 case
executed 11 times by 2 tests: case HostNameMismatch:
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
HostNameMismatch:
executed 11 times by 2 tests: case HostNameMismatch:
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
11
156 errStr = QSslSocket::tr("The host name did not match any of the valid hosts"-
157 " for this certificate");-
158 break;
executed 11 times by 2 tests: break;
Executed by:
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
11
159 case
never executed: case NoSslSupport:
NoSslSupport:
never executed: case NoSslSupport:
0
160 break;
never executed: break;
0
161 case
executed 1 time by 1 test: case CertificateBlacklisted:
Executed by:
  • tst_qsslsocket - unknown status
CertificateBlacklisted:
executed 1 time by 1 test: case CertificateBlacklisted:
Executed by:
  • tst_qsslsocket - unknown status
1
162 errStr = QSslSocket::tr("The peer certificate is blacklisted");-
163 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_qsslsocket - unknown status
1
164 default
executed 2 times by 1 test: default:
Executed by:
  • tst_qsslcertificate - unknown status
:
executed 2 times by 1 test: default:
Executed by:
  • tst_qsslcertificate - unknown status
2
165 errStr = QSslSocket::tr("Unknown error");-
166 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_qsslcertificate - unknown status
2
167 }-
168-
169 return
executed 92 times by 7 tests: return errStr;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
errStr;
executed 92 times by 7 tests: return errStr;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
92
170}-
171-
172-
173-
174-
175-
176-
177-
178QSslCertificate QSslError::certificate() const-
179{-
180 return
executed 2 times by 1 test: return d->certificate;
Executed by:
  • tst_qsslerror - unknown status
d->certificate;
executed 2 times by 1 test: return d->certificate;
Executed by:
  • tst_qsslerror - unknown status
2
181}-
182-
183-
184-
185-
186-
187-
188uint qHash(const QSslError &key, uint seed) noexcept-
189{-
190-
191 seed ^= qHash(key.error()) + 0x9e3779b9 + (seed << 6) + (seed >> 2);-
192 seed ^= qHash(key.certificate()) + 0x9e3779b9 + (seed << 6) + (seed >> 2);-
193 return
executed 2 times by 1 test: return seed;
Executed by:
  • tst_qsslerror - unknown status
seed;
executed 2 times by 1 test: return seed;
Executed by:
  • tst_qsslerror - unknown status
2
194}-
195-
196-
197-
198QDebug operator<<(QDebug debug, const QSslError &error)-
199{-
200 debug << error.errorString();-
201 return
never executed: return debug;
debug;
never executed: return debug;
0
202}-
203QDebug operator<<(QDebug debug, const QSslError::SslError &error)-
204{-
205 debug << QSslError(error).errorString();-
206 return
never executed: return debug;
debug;
never executed: return debug;
0
207}-
208-
209-
210-
Switch to Source codePreprocessed file

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