241 | | const CertificateInfo& /*certificate*/, const char* message) |
242 | | { |
243 | | String text = "The SSL certificate received from " + |
244 | | m_webFrame->Frame()->document()->url().string() + " could not be " |
245 | | "authenticated for the following reason: " + message + ".\n\n" |
246 | | "The secure connection to the website may be compromised, make sure " |
247 | | "to not send any sensitive information."; |
248 | | |
249 | | // TODO add information about the certificate to the alert |
250 | | // TODO this can be called several times for the same certificate since we |
251 | | // don't store the user choice (we should at least store it for the current |
252 | | // session) |
253 | | |
254 | | BAlert* alert = new BAlert("Unsecure SSL certificate", text.utf8().data(), |
255 | | "Continue", "Stop", NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); |
256 | | |
257 | | int button = alert->Go(); |
258 | | |
259 | | return button == 0; |
| 244 | const CertificateInfo& certificate, const char* message) |
| 245 | { |
| 246 | |
| 247 | if (m_certificateList == NULL || !(m_certificateList->HasString((const_cast<BCertificate&>(certificate.certificate())).Issuer()))) { |
| 248 | |
| 249 | String text = "The SSL certificate received from " + |
| 250 | m_webFrame->Frame()->document()->url().string() + " could not be " |
| 251 | "authenticated for the following reason: " + message + ".\n\n" |
| 252 | "The secure connection to the website may be compromised, make sure " |
| 253 | "to not send any sensitive information.\n\nIssuer: " + (const_cast<BCertificate&>(certificate.certificate())).Issuer().String() |
| 254 | + "\n\nSubject: " + (const_cast<BCertificate&>(certificate.certificate())).Subject().String(); |
| 255 | |
| 256 | // TODO add information about the certificate to the alert |
| 257 | // TODO this can be called several times for the same certificate since we |
| 258 | // don't store the user choice (we should at least store it for the current |
| 259 | // session) |
| 260 | |
| 261 | BAlert* alert = new BAlert("Unsecure SSL certificate", text.utf8().data(), |
| 262 | "Continue", "Stop", NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); |
| 263 | |
| 264 | printf("Dump of invalid certificate: %s\n", (const_cast<BCertificate&>(certificate.certificate())).String().String()); |
| 265 | |
| 266 | int button = alert->Go(); |
| 267 | |
| 268 | if (button == 0) { |
| 269 | // Store it in the list of known invalid certificates |
| 270 | if (m_certificateList == NULL) { |
| 271 | m_certificateList = new BStringList(); |
| 272 | } |
| 273 | m_certificateList->Add((const_cast<BCertificate&>(certificate.certificate())).Issuer()); |
| 274 | } |
| 275 | |
| 276 | return button == 0; |
| 277 | } |
| 278 | else { |
| 279 | return true; |
| 280 | } |