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