| Line | Source | Count |
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | | - |
| 12 | | - |
| 13 | | - |
| 14 | | - |
| 15 | | - |
| 16 | | - |
| 17 | | - |
| 18 | | - |
| 19 | | - |
| 20 | | - |
| 21 | | - |
| 22 | | - |
| 23 | | - |
| 24 | | - |
| 25 | | - |
| 26 | | - |
| 27 | | - |
| 28 | | - |
| 29 | | - |
| 30 | | - |
| 31 | | - |
| 32 | | - |
| 33 | | - |
| 34 | | - |
| 35 | | - |
| 36 | | - |
| 37 | | - |
| 38 | | - |
| 39 | | - |
| 40 | | - |
| 41 | | - |
| 42 | | - |
| 43 | | - |
| 44 | | - |
| 45 | | - |
| 46 | | - |
| 47 | | - |
| 48 | | - |
| 49 | | - |
| 50 | | - |
| 51 | | - |
| 52 | | - |
| 53 | | - |
| 54 | | - |
| 55 | | - |
| 56 | | - |
| 57 | | - |
| 58 | | - |
| 59 | | - |
| 60 | | - |
| 61 | | - |
| 62 | | - |
| 63 | | - |
| 64 | | - |
| 65 | | - |
| 66 | | - |
| 67 | | - |
| 68 | | - |
| 69 | | - |
| 70 | | - |
| 71 | | - |
| 72 | | - |
| 73 | | - |
| 74 | | - |
| 75 | | - |
| 76 | | - |
| 77 | | - |
| 78 | | - |
| 79 | | - |
| 80 | | - |
| 81 | | - |
| 82 | | - |
| 83 | | - |
| 84 | | - |
| 85 | | - |
| 86 | | - |
| 87 | | - |
| 88 | | - |
| 89 | | - |
| 90 | | - |
| 91 | | - |
| 92 | | - |
| 93 | #include "qsslerror.h" | - |
| 94 | #include "qsslsocket.h" | - |
| 95 | #ifndef QT_NO_DEBUG_STREAM | - |
| 96 | #include <QtCore/qdebug.h> | - |
| 97 | #endif | - |
| 98 | | - |
| 99 | QT_BEGIN_NAMESPACE | - |
| 100 | | - |
| 101 | class QSslErrorPrivate | - |
| 102 | { | - |
| 103 | public: | - |
| 104 | QSslError::SslError error; | - |
| 105 | QSslCertificate certificate; | - |
| 106 | }; | - |
| 107 | | - |
| 108 | | - |
| 109 | | - |
| 110 | | - |
| 111 | | - |
| 112 | | - |
| 113 | | - |
| 114 | | - |
| 115 | QSslError::QSslError() | - |
| 116 | : d(new QSslErrorPrivate) | - |
| 117 | { | - |
| 118 | d->error = QSslError::NoError; | - |
| 119 | d->certificate = QSslCertificate(); | - |
| 120 | } | - |
| 121 | | - |
| 122 | | - |
| 123 | | - |
| 124 | | - |
| 125 | | - |
| 126 | | - |
| 127 | QSslError::QSslError(SslError error) | - |
| 128 | : d(new QSslErrorPrivate) | - |
| 129 | { | - |
| 130 | d->error = error; | - |
| 131 | d->certificate = QSslCertificate(); | - |
| 132 | } | - |
| 133 | | - |
| 134 | | - |
| 135 | | - |
| 136 | | - |
| 137 | | - |
| 138 | | - |
| 139 | | - |
| 140 | QSslError::QSslError(SslError error, const QSslCertificate &certificate) | - |
| 141 | : d(new QSslErrorPrivate) | - |
| 142 | { | - |
| 143 | d->error = error; | - |
| 144 | d->certificate = certificate; | - |
| 145 | } | - |
| 146 | | - |
| 147 | | - |
| 148 | | - |
| 149 | | - |
| 150 | QSslError::QSslError(const QSslError &other) | - |
| 151 | : d(new QSslErrorPrivate) | - |
| 152 | { | - |
| 153 | *d.data() = *other.d.data(); | - |
| 154 | } | - |
| 155 | | - |
| 156 | | - |
| 157 | | - |
| 158 | | - |
| 159 | QSslError::~QSslError() | - |
| 160 | { | - |
| 161 | } | - |
| 162 | | - |
| 163 | | - |
| 164 | | - |
| 165 | | - |
| 166 | | - |
| 167 | | - |
| 168 | QSslError &QSslError::operator=(const QSslError &other) | - |
| 169 | { | - |
| 170 | *d.data() = *other.d.data(); | - |
| 171 | return *this; | - |
| 172 | } | - |
| 173 | | - |
| 174 | | - |
| 175 | | - |
| 176 | | - |
| 177 | | - |
| 178 | | - |
| 179 | | - |
| 180 | | - |
| 181 | | - |
| 182 | | - |
| 183 | | - |
| 184 | | - |
| 185 | | - |
| 186 | | - |
| 187 | bool QSslError::operator==(const QSslError &other) const | - |
| 188 | { | - |
| 189 | return d->error == other.d->error | - |
| 190 | && d->certificate == other.d->certificate; | - |
| 191 | } | - |
| 192 | | - |
| 193 | | - |
| 194 | | - |
| 195 | | - |
| 196 | | - |
| 197 | | - |
| 198 | | - |
| 199 | | - |
| 200 | | - |
| 201 | | - |
| 202 | | - |
| 203 | | - |
| 204 | | - |
| 205 | | - |
| 206 | QSslError::SslError QSslError::error() const | - |
| 207 | { | - |
| 208 | return d->error; | - |
| 209 | } | - |
| 210 | | - |
| 211 | | - |
| 212 | | - |
| 213 | | - |
| 214 | | - |
| 215 | | - |
| 216 | QString QSslError::errorString() const | - |
| 217 | { | - |
| 218 | QString errStr; | - |
| 219 | switch (d->error) { | - |
| 220 | case NoError: | - |
| 221 | errStr = QSslSocket::tr("No error"); | - |
| 222 | break; | - |
| 223 | case UnableToGetIssuerCertificate: | - |
| 224 | errStr = QSslSocket::tr("The issuer certificate could not be found"); | - |
| 225 | break; | - |
| 226 | case UnableToDecryptCertificateSignature: | - |
| 227 | errStr = QSslSocket::tr("The certificate signature could not be decrypted"); | - |
| 228 | break; | - |
| 229 | case UnableToDecodeIssuerPublicKey: | - |
| 230 | errStr = QSslSocket::tr("The public key in the certificate could not be read"); | - |
| 231 | break; | - |
| 232 | case CertificateSignatureFailed: | - |
| 233 | errStr = QSslSocket::tr("The signature of the certificate is invalid"); | - |
| 234 | break; | - |
| 235 | case CertificateNotYetValid: | - |
| 236 | errStr = QSslSocket::tr("The certificate is not yet valid"); | - |
| 237 | break; | - |
| 238 | case CertificateExpired: | - |
| 239 | errStr = QSslSocket::tr("The certificate has expired"); | - |
| 240 | break; | - |
| 241 | case InvalidNotBeforeField: | - |
| 242 | errStr = QSslSocket::tr("The certificate's notBefore field contains an invalid time"); | - |
| 243 | break; | - |
| 244 | case InvalidNotAfterField: | - |
| 245 | errStr = QSslSocket::tr("The certificate's notAfter field contains an invalid time"); | - |
| 246 | break; | - |
| 247 | case SelfSignedCertificate: | - |
| 248 | errStr = QSslSocket::tr("The certificate is self-signed, and untrusted"); | - |
| 249 | break; | - |
| 250 | case SelfSignedCertificateInChain: | - |
| 251 | errStr = QSslSocket::tr("The root certificate of the certificate chain is self-signed, and untrusted"); | - |
| 252 | break; | - |
| 253 | case UnableToGetLocalIssuerCertificate: | - |
| 254 | errStr = QSslSocket::tr("The issuer certificate of a locally looked up certificate could not be found"); | - |
| 255 | break; | - |
| 256 | case UnableToVerifyFirstCertificate: | - |
| 257 | errStr = QSslSocket::tr("No certificates could be verified"); | - |
| 258 | break; | - |
| 259 | case InvalidCaCertificate: | - |
| 260 | errStr = QSslSocket::tr("One of the CA certificates is invalid"); | - |
| 261 | break; | - |
| 262 | case PathLengthExceeded: | - |
| 263 | errStr = QSslSocket::tr("The basicConstraints path length parameter has been exceeded"); | - |
| 264 | break; | - |
| 265 | case InvalidPurpose: | - |
| 266 | errStr = QSslSocket::tr("The supplied certificate is unsuitable for this purpose"); | - |
| 267 | break; | - |
| 268 | case CertificateUntrusted: | - |
| 269 | errStr = QSslSocket::tr("The root CA certificate is not trusted for this purpose"); | - |
| 270 | break; | - |
| 271 | case CertificateRejected: | - |
| 272 | errStr = QSslSocket::tr("The root CA certificate is marked to reject the specified purpose"); | - |
| 273 | break; | - |
| 274 | case SubjectIssuerMismatch: | - |
| 275 | errStr = QSslSocket::tr("The current candidate issuer certificate was rejected because its" | - |
| 276 | " subject name did not match the issuer name of the current certificate"); | - |
| 277 | break; | - |
| 278 | case AuthorityIssuerSerialNumberMismatch: | - |
| 279 | errStr = QSslSocket::tr("The current candidate issuer certificate was rejected because" | - |
| 280 | " its issuer name and serial number was present and did not match the" | - |
| 281 | " authority key identifier of the current certificate"); | - |
| 282 | break; | - |
| 283 | case NoPeerCertificate: | - |
| 284 | errStr = QSslSocket::tr("The peer did not present any certificate"); | - |
| 285 | break; | - |
| 286 | case HostNameMismatch: | - |
| 287 | errStr = QSslSocket::tr("The host name did not match any of the valid hosts" | - |
| 288 | " for this certificate"); | - |
| 289 | break; | - |
| 290 | case NoSslSupport: | - |
| 291 | break; | - |
| 292 | case CertificateBlacklisted: | - |
| 293 | errStr = QSslSocket::tr("The peer certificate is blacklisted"); | - |
| 294 | break; | - |
| 295 | default: | - |
| 296 | errStr = QSslSocket::tr("Unknown error"); | - |
| 297 | break; | - |
| 298 | } | - |
| 299 | | - |
| 300 | return errStr; | - |
| 301 | } | - |
| 302 | | - |
| 303 | | - |
| 304 | | - |
| 305 | | - |
| 306 | | - |
| 307 | | - |
| 308 | | - |
| 309 | QSslCertificate QSslError::certificate() const | - |
| 310 | { | - |
| 311 | return d->certificate; | - |
| 312 | } | - |
| 313 | | - |
| 314 | | - |
| 315 | | - |
| 316 | | - |
| 317 | | - |
| 318 | | - |
| 319 | uint qHash(const QSslError &key, uint seed) Q_DECL_NOTHROW | - |
| 320 | { | - |
| 321 | | - |
| 322 | seed ^= qHash(key.error()) + 0x9e3779b9 + (seed << 6) + (seed >> 2); | - |
| 323 | seed ^= qHash(key.certificate()) + 0x9e3779b9 + (seed << 6) + (seed >> 2); | - |
| 324 | return seed;executed 2 times by 1 test: return seed;Executed by:- tst_qsslerror - unknown status
| 2 |
| 325 | } | - |
| 326 | | - |
| 327 | #ifndef QT_NO_DEBUG_STREAM | - |
| 328 | | - |
| 329 | QDebug operator<<(QDebug debug, const QSslError &error) | - |
| 330 | { | - |
| 331 | debug << error.errorString(); | - |
| 332 | return debug; | - |
| 333 | } | - |
| 334 | QDebug operator<<(QDebug debug, const QSslError::SslError &error) | - |
| 335 | { | - |
| 336 | debug << QSslError(error).errorString(); | - |
| 337 | return debug; | - |
| 338 | } | - |
| 339 | #endif | - |
| 340 | | - |
| 341 | QT_END_NAMESPACE | - |
| | |