asdlei00 / crashrpt

Automatically exported from code.google.com/p/crashrpt
0 stars 0 forks source link

HTTPS certificate problem #151

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I've been using CrashRpt for a while sending reports over email.  This
has been working great, but we just encountered a user who cannot send
out emails with CrashRpt, so I wanted to enable sending over HTTPS.
My application has a JBOSS based backend deployment, and as I result I
am trying to use that to receive crash reports. 

I was able to figure out what my problem was.  I didn't have a properly signed 
certificate.

OK I solved the problem for my app, here's the code that I added FYI

    // Add a message to log
    m_Assync->SetProgress(_T("Sending HTTP request..."), 0);
    // Send request

    // This code was copied from http://support.microsoft.com/kb/182888 to address the problem
    // that MVS doesn't have a valid SSL certificate, once we have one, let's go ahead
    // and remove this so we get a valid check
    DWORD extraSSLDwFlags;
    DWORD dwBuffLen = sizeof(extraSSLDwFlags);
    InternetQueryOption (hRequest, INTERNET_OPTION_SECURITY_FLAGS,
    (LPVOID)&extraSSLDwFlags, &dwBuffLen);
    // We have to specifically ignore these 2 errors for MVS
    extraSSLDwFlags |= SECURITY_FLAG_IGNORE_UNKNOWN_CA | SECURITY_FLAG_IGNORE_CERT_CN_INVALID;
    InternetSetOption (hRequest, INTERNET_OPTION_SECURITY_FLAGS,
                        &extraSSLDwFlags, sizeof (extraSSLDwFlags) );
    if(!HttpSendRequestEx( hRequest, &BufferIn, NULL, 0, 0))
    {
        m_Assync->SetProgress(_T("HttpSendRequestEx has failed."), 0);
    // We w
    DWORD dw = GetLastError();
    WCHAR szTest[10]; // WCHAR is the same as wchar_t
    // swprintf_s is the same as sprintf_s for wide characters
    swprintf_s(szTest, 10, L"%d", dw); // use L"" prefix for wide chars
    m_Assync->SetProgress(szTest, 0);
        goto cleanup;
    }

Original issue reported on code.google.com by zexspect...@gmail.com on 10 May 2012 at 6:18

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r1350.

Original comment by zexspect...@gmail.com on 26 Aug 2012 at 4:02

GoogleCodeExporter commented 9 years ago
CrashSender1400.exe + WinXP  - error https
ERROR_WINHTTP_SECURE_CERT_REV_FAILED  12057
Indicates that revocation cannot be checked because the revocation server was 
offline (equivalent to CRYPT_E_REVOCATION_OFFLINE).

Fix:
Index: C:/src-l2/l2/trunk/crashrpt/reporting/crashsender/HttpRequestSender.cpp
===================================================================
--- 
C:/src-l2/l2/trunk/crashrpt/reporting/crashsender/HttpRequestSender.cpp (revisio
n 26)
+++ 
C:/src-l2/l2/trunk/crashrpt/reporting/crashsender/HttpRequestSender.cpp (working
 copy)
@@ -161,6 +161,8 @@
    (LPVOID)&extraSSLDwFlags, &dwBuffLen);
    // We have to specifically ignore these 2 errors for MVS
    extraSSLDwFlags |= SECURITY_FLAG_IGNORE_UNKNOWN_CA | SECURITY_FLAG_IGNORE_CERT_CN_INVALID;
+   extraSSLDwFlags |= SECURITY_FLAG_IGNORE_REVOCATION | 
SECURITY_FLAG_IGNORE_WRONG_USAGE 
+        | SECURITY_FLAG_IGNORE_CERT_CN_INVALID | 
SECURITY_FLAG_IGNORE_CERT_DATE_INVALID;
    InternetSetOption (hRequest, INTERNET_OPTION_SECURITY_FLAGS,
                         &extraSSLDwFlags, sizeof (extraSSLDwFlags) );

Original comment by Pavel.Pimenov@gmail.com on 25 Oct 2012 at 4:53

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by zexspect...@gmail.com on 25 Oct 2012 at 4:56

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r1448.

Original comment by zexspect...@gmail.com on 8 Nov 2012 at 4:27