Poco + OpenSSL + CA PEM : "Unacceptable certificate" error for 1 out of 2 identical sites
Asked Answered
A

2

11

I am trying to do a SSL handshake with www1.filemail.com. I am using cURL's cacert.pem, but I am getting this error:

Unacceptable certificate from 188.138.81.30: application verification failure

Making the handshake against any other HTTPS website works - including www2.filemail.com. www1 and www2 should be identically configured - and they both work fine in all browsers. They also test fine here (identical certificates and intermediary certificates are sent out for both sites):

Why am I getting this problem with www1 using OpenSSL and the cacert.pem file?

There has to be a difference in the certificate setup of www1 and www2. I have tested with a myriad of tools (openssl, ssllabs etc.) to try to pinpoint the difference - but I always get the exact same results for both sites (except when running my code)

What am I missing here? What's the difference between the sites?

(It should be noted that we are using a relatively cheap wildcard certificate provided by RapidSSL - so I'm guessing it has something to do with intermediate or cross-root certificates - but everything seems to be in order when testing with the tools mentioned above.)


Code:

Poco::SharedPtr<Poco::Net::InvalidCertificateHandler> pCert = new Poco::Net::ConsoleCertificateHandler(false);
Poco::Net::Context::Ptr pContext = new Poco::Net::Context(Poco::Net::Context::CLIENT_USE, "", "", "C:\\cacert.pem", Poco::Net::Context::VERIFY_RELAXED, 9, false, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
Poco::Net::SSLManager::instance().initializeClient(0, pCert, pContext);

URI uri("https://www1.filemail.com");
Poco::Net::SecureStreamSocket ss(Poco::Net::SocketAddress(uri.getHost().c_str(), uri.getPort()));
ss.completeHandshake();
Autolysin answered 14/9, 2016 at 13:1 Comment(1)
Plus One for asking this question in the context of a programming problem. You would not believe how many webapp and webmaster questions we get like this...Farriery
A
3

Günter Obiltschnig helped me out via POCO@Github and got it working by replacing

Poco::Net::SecureStreamSocket ss(Poco::Net::SocketAddress(uri.getHost().c_str(), uri.getPort()));

with

Poco::Net::SecureStreamSocket ss(Poco::Net::SocketAddress(uri.getHost().c_str(), uri.getPort()), uri.getHost());

(including the host name in the constructor of SecureStreamSocket - it is used for certificate verification)

From the POCO documentation:

SecureStreamSocket(
    const SocketAddress & address,
    const std::string & hostName
);

//Creates a secure stream socket using the default client SSL context and connects it to the socket specified by address.
//The given host name is used for certificate verification <=======

I still do not know the exact difference in config between www1 and www2 are, would love if someone could enlighten me on this.

Autolysin answered 17/9, 2016 at 17:5 Comment(0)
F
4

www1 and www2 should be identically configured - and they both work fine in all browsers...

Here are the certificates. A diff shows they are the same end-entity (server) certificate:

$ diff www1.txt www2.txt 
$

Each server is could be a sending a different chain. Use openssl s_client with openssl x509 and -showcerts to get the chain.

www1

$ openssl s_client -connect www1.filemail.com:443 -tls1 -servername www1.filemail.com | openssl x509 -text -noout > www1.txt
depth=1 C = US, O = GeoTrust Inc., CN = RapidSSL SHA256 CA - G3
verify error:num=20:unable to get local issuer certificate
^C
riemann:~$ cat www1.txt 
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 15955 (0x3e53)
    Signature Algorithm: sha256WithRSAEncryption
        Issuer: C = US, O = GeoTrust Inc., CN = RapidSSL SHA256 CA - G3
        Validity
            Not Before: Oct 14 20:14:57 2014 GMT
            Not After : Aug  4 13:09:28 2018 GMT
        Subject: OU = GT83551982, OU = See www.rapidssl.com/resources/cps (c)14, OU = Domain Control Validated - RapidSSL(R), CN = *.filemail.com
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (2048 bit)
                Modulus:
                    00:c5:38:89:72:40:74:77:e2:76:f0:20:ae:d9:91:
                    26:ac:42:85:03:86:ff:2f:a1:94:b7:f3:86:4c:f7:
                    ce:63:46:47:e6:03:73:95:01:07:0b:e0:60:9a:93:
                    c3:b4:14:bc:4e:16:f2:50:12:89:11:42:f5:58:51:
                    74:15:81:d0:ce:6e:e2:85:e8:d2:3a:38:48:a3:02:
                    80:e0:a1:fa:ea:8f:ca:ee:bc:00:b3:b2:64:7f:9c:
                    da:ca:e8:3f:a7:48:af:5c:ed:8e:2f:27:95:19:52:
                    85:d1:15:9b:f5:4d:b7:21:44:89:05:6f:06:92:7b:
                    ab:9e:10:63:be:7e:ce:3b:58:10:68:ae:7a:52:6e:
                    e5:62:bf:ff:56:33:06:51:e5:61:a0:bd:6b:3c:c9:
                    f3:55:54:02:16:f2:56:27:81:be:83:82:53:25:1e:
                    c4:1c:1d:65:da:9f:2c:f7:97:49:3c:e1:03:35:1c:
                    da:c3:02:6d:93:1a:4a:89:53:4c:f5:3e:e7:f9:b9:
                    c0:10:e0:80:77:3a:d9:5d:ed:b1:46:9e:92:7e:86:
                    46:d7:be:fe:af:5a:af:02:b4:1b:d2:2b:08:1d:bc:
                    b5:93:8c:48:45:27:ba:26:69:a9:a8:9f:98:d3:de:
                    2d:f5:70:f5:39:6a:30:3b:8c:01:6c:85:19:a2:a6:
                    9a:65
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Authority Key Identifier: 
                keyid:C3:9C:F3:FC:D3:46:08:34:BB:CE:46:7F:A0:7C:5B:F3:E2:08:CB:59

            Authority Information Access: 
                OCSP - URI:http://gv.symcd.com
                CA Issuers - URI:http://gv.symcb.com/gv.crt

            X509v3 Key Usage: critical
                Digital Signature, Key Encipherment
            X509v3 Extended Key Usage: 
                TLS Web Server Authentication, TLS Web Client Authentication
            X509v3 Subject Alternative Name: 
                DNS:*.filemail.com, DNS:filemail.com
            X509v3 CRL Distribution Points: 

                Full Name:
                  URI:http://gv.symcb.com/gv.crl

            X509v3 Basic Constraints: critical
                CA:FALSE
            X509v3 Certificate Policies: 
                Policy: 2.16.840.1.113733.1.7.54
                  CPS: https://www.rapidssl.com/legal

    Signature Algorithm: sha256WithRSAEncryption
         77:7e:54:47:93:6c:b0:4e:9c:dc:01:47:1f:76:54:9d:f2:42:
         94:c1:94:f8:7b:b4:68:82:fe:6d:66:45:68:e1:bd:df:ba:6d:
         15:a1:6c:b0:79:9e:d7:99:d9:11:7e:84:e9:f1:63:7c:92:25:
         c3:fe:cc:02:1a:61:b9:a3:29:59:18:c2:f1:d2:d7:84:dc:8d:
         28:2e:b5:6e:91:d9:68:65:37:5a:b9:b3:d5:f4:d1:1f:b2:ec:
         2b:0f:e1:50:30:72:f7:04:70:68:26:b0:61:47:44:49:d0:62:
         31:81:53:fa:cc:3a:7b:a1:3b:74:da:c2:3b:7b:5d:9c:23:de:
         69:92:51:fc:ff:8d:7a:ea:fd:b2:68:5f:38:3d:22:f6:a6:4a:
         d7:a0:88:97:06:54:fd:ba:dc:b9:3a:69:25:89:99:0e:81:82:
         c8:63:5c:87:98:bf:70:08:0a:89:20:a1:17:63:31:26:7b:af:
         b3:83:f3:9c:b6:7e:64:52:08:bf:a3:74:d5:0c:26:f6:25:7c:
         b9:cb:27:57:88:7f:af:1c:b5:99:08:4a:fd:c2:b4:ec:7a:40:
         ea:80:ac:e8:88:84:33:53:ab:90:af:bc:bc:ea:6f:88:fe:a8:
         f9:c7:63:a3:74:2c:0b:37:5c:90:39:ad:85:82:6a:e9:ea:a7:
         e1:55:c2:dd

www2

$ openssl s_client -connect www2.filemail.com:443 -tls1 -servername www2.filemail.com | openssl x509 -text -noout > www2.txt
depth=1 C = US, O = GeoTrust Inc., CN = RapidSSL SHA256 CA - G3
verify error:num=20:unable to get local issuer certificate
^C
riemann:~$ cat www2.txt 
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 15955 (0x3e53)
    Signature Algorithm: sha256WithRSAEncryption
        Issuer: C = US, O = GeoTrust Inc., CN = RapidSSL SHA256 CA - G3
        Validity
            Not Before: Oct 14 20:14:57 2014 GMT
            Not After : Aug  4 13:09:28 2018 GMT
        Subject: OU = GT83551982, OU = See www.rapidssl.com/resources/cps (c)14, OU = Domain Control Validated - RapidSSL(R), CN = *.filemail.com
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (2048 bit)
                Modulus:
                    00:c5:38:89:72:40:74:77:e2:76:f0:20:ae:d9:91:
                    26:ac:42:85:03:86:ff:2f:a1:94:b7:f3:86:4c:f7:
                    ce:63:46:47:e6:03:73:95:01:07:0b:e0:60:9a:93:
                    c3:b4:14:bc:4e:16:f2:50:12:89:11:42:f5:58:51:
                    74:15:81:d0:ce:6e:e2:85:e8:d2:3a:38:48:a3:02:
                    80:e0:a1:fa:ea:8f:ca:ee:bc:00:b3:b2:64:7f:9c:
                    da:ca:e8:3f:a7:48:af:5c:ed:8e:2f:27:95:19:52:
                    85:d1:15:9b:f5:4d:b7:21:44:89:05:6f:06:92:7b:
                    ab:9e:10:63:be:7e:ce:3b:58:10:68:ae:7a:52:6e:
                    e5:62:bf:ff:56:33:06:51:e5:61:a0:bd:6b:3c:c9:
                    f3:55:54:02:16:f2:56:27:81:be:83:82:53:25:1e:
                    c4:1c:1d:65:da:9f:2c:f7:97:49:3c:e1:03:35:1c:
                    da:c3:02:6d:93:1a:4a:89:53:4c:f5:3e:e7:f9:b9:
                    c0:10:e0:80:77:3a:d9:5d:ed:b1:46:9e:92:7e:86:
                    46:d7:be:fe:af:5a:af:02:b4:1b:d2:2b:08:1d:bc:
                    b5:93:8c:48:45:27:ba:26:69:a9:a8:9f:98:d3:de:
                    2d:f5:70:f5:39:6a:30:3b:8c:01:6c:85:19:a2:a6:
                    9a:65
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Authority Key Identifier: 
                keyid:C3:9C:F3:FC:D3:46:08:34:BB:CE:46:7F:A0:7C:5B:F3:E2:08:CB:59

            Authority Information Access: 
                OCSP - URI:http://gv.symcd.com
                CA Issuers - URI:http://gv.symcb.com/gv.crt

            X509v3 Key Usage: critical
                Digital Signature, Key Encipherment
            X509v3 Extended Key Usage: 
                TLS Web Server Authentication, TLS Web Client Authentication
            X509v3 Subject Alternative Name: 
                DNS:*.filemail.com, DNS:filemail.com
            X509v3 CRL Distribution Points: 

                Full Name:
                  URI:http://gv.symcb.com/gv.crl

            X509v3 Basic Constraints: critical
                CA:FALSE
            X509v3 Certificate Policies: 
                Policy: 2.16.840.1.113733.1.7.54
                  CPS: https://www.rapidssl.com/legal

    Signature Algorithm: sha256WithRSAEncryption
         77:7e:54:47:93:6c:b0:4e:9c:dc:01:47:1f:76:54:9d:f2:42:
         94:c1:94:f8:7b:b4:68:82:fe:6d:66:45:68:e1:bd:df:ba:6d:
         15:a1:6c:b0:79:9e:d7:99:d9:11:7e:84:e9:f1:63:7c:92:25:
         c3:fe:cc:02:1a:61:b9:a3:29:59:18:c2:f1:d2:d7:84:dc:8d:
         28:2e:b5:6e:91:d9:68:65:37:5a:b9:b3:d5:f4:d1:1f:b2:ec:
         2b:0f:e1:50:30:72:f7:04:70:68:26:b0:61:47:44:49:d0:62:
         31:81:53:fa:cc:3a:7b:a1:3b:74:da:c2:3b:7b:5d:9c:23:de:
         69:92:51:fc:ff:8d:7a:ea:fd:b2:68:5f:38:3d:22:f6:a6:4a:
         d7:a0:88:97:06:54:fd:ba:dc:b9:3a:69:25:89:99:0e:81:82:
         c8:63:5c:87:98:bf:70:08:0a:89:20:a1:17:63:31:26:7b:af:
         b3:83:f3:9c:b6:7e:64:52:08:bf:a3:74:d5:0c:26:f6:25:7c:
         b9:cb:27:57:88:7f:af:1c:b5:99:08:4a:fd:c2:b4:ec:7a:40:
         ea:80:ac:e8:88:84:33:53:ab:90:af:bc:bc:ea:6f:88:fe:a8:
         f9:c7:63:a3:74:2c:0b:37:5c:90:39:ad:85:82:6a:e9:ea:a7:
         e1:55:c2:dd

I am trying to do a SSL handshake towards www1.filemail.com - but I am getting this error:

Unacceptable certificate from 188.138.81.30: application verification failure

RapidSSL SHA256 CA - G3 is a CA; it issued the server's certificate. The server is called the subject. As you work up a chain, the former issuer becomes the current subject. At the top of the chain is the self signed root. At the root, the issuer==subject.

The RapidSSL G3 CA is either (1) self-signed, so its a root CA; or (2) signed by another CA higher in the chain, so its a subordinate CA (i.e., it has an issuer). In this case, the G3 CA is a subordinate and it has an issuer.

It sounds like one server is sending the complete chain needed to validate the server's certificate; and the other server is not. Servers are supposed to send the complete chain to avoid the "which directory" problem in PKI. The "complete chain" is every certificate except the self-signed root (but many send the root, too).

The client must trust the self-signed root a priori, and its why it should not be sent (otherwise, a bad guy can swap-in his own chain). Or, instead of using cacert.pem:

Poco::Net::Context::CLIENT_USE, "", "", "C:\\cacert.pem", ...

You can load RapidSSL SHA256 CA - G3 and use that as the root of the trust. You will avoid the other 300 or so CA's in cacert.pem that are not needed to validate the server chain. Its good security engineering.

You can fetch RapidSSL SHA256 CA - G3 from rapidSSL's site at Intermediate CA Certificate: RapidSSL with SHA-2 (under SHA-1 Root).


UPDATE using RapidSSL SHA256 CA - G3:

Here's the signer's certificate:

$ cat rapidssl.pem 
-----BEGIN CERTIFICATE-----
MIIEJTCCAw2gAwIBAgIDAjp3MA0GCSqGSIb3DQEBCwUAMEIxCzAJBgNVBAYTAlVT
MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i
YWwgQ0EwHhcNMTQwODI5MjEzOTMyWhcNMjIwNTIwMjEzOTMyWjBHMQswCQYDVQQG
EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXUmFwaWRTU0wg
U0hBMjU2IENBIC0gRzMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCv
VJvZWF0eLFbG1eh/9H0WA//Qi1rkjqfdVC7UBMBdmJyNkA+8EGVf2prWRHzAn7Xp
SowLBkMEu/SW4ib2YQGRZjEiwzQ0Xz8/kS9EX9zHFLYDn4ZLDqP/oIACg8PTH2lS
1p1kD8mD5xvEcKyU58Okaiy9uJ5p2L4KjxZjWmhxgHsw3hUEv8zTvz5IBVV6s9cQ
DAP8m/0Ip4yM26eO8R5j3LMBL3+vV8M8SKeDaCGnL+enP/C1DPz1hNFTvA5yT2AM
QriYrRmIV9cE7Ie/fodOoyH5U/02mEiN1vi7SPIpyGTRzFRIU4uvt2UevykzKdkp
YEj4/5G8V1jlNS67abZZAgMBAAGjggEdMIIBGTAfBgNVHSMEGDAWgBTAephojYn7
qwVkDBF9qn1luMrMTjAdBgNVHQ4EFgQUw5zz/NNGCDS7zkZ/oHxb8+IIy1kwEgYD
VR0TAQH/BAgwBgEB/wIBADAOBgNVHQ8BAf8EBAMCAQYwNQYDVR0fBC4wLDAqoCig
JoYkaHR0cDovL2cuc3ltY2IuY29tL2NybHMvZ3RnbG9iYWwuY3JsMC4GCCsGAQUF
BwEBBCIwIDAeBggrBgEFBQcwAYYSaHR0cDovL2cuc3ltY2QuY29tMEwGA1UdIARF
MEMwQQYKYIZIAYb4RQEHNjAzMDEGCCsGAQUFBwIBFiVodHRwOi8vd3d3Lmdlb3Ry
dXN0LmNvbS9yZXNvdXJjZXMvY3BzMA0GCSqGSIb3DQEBCwUAA4IBAQCjWB7GQzKs
rC+TeLfqrlRARy1+eI1Q9vhmrNZPc9ZE768LzFvB9E+aj0l+YK/CJ8cW8fuTgZCp
fO9vfm5FlBaEvexJ8cQO9K8EWYOHDyw7l8NaEpt7BDV7o5UzCHuTcSJCs6nZb0+B
kvwHtnm8hEqddwnxxYny8LScVKoSew26T++TGezvfU5ho452nFnPjJSxhJf3GrkH
uLLGTxN5279PURt/aQ1RKsHWFf83UTRlUfQevjhq7A6rvz17OQV79PP7GqHQyH5O
ZI3NjGFVkP46yl0lD/gdo0p0Vk8aVUBwdSWmMy66S6VdU5oNMOGNX2Esr8zvsJmh
gP8L8mJMcCaY
-----END CERTIFICATE-----

Notice OpenSSL finished with Verify return code: 2 (unable to get issuer certificate). That's fine because you don't care about the issuer. You've rooted your trust at GeoTrust Inc., CN = RapidSSL SHA256 CA - G3, and RapidSSL SHA256 CA - G3 certified/signed the server's certificate.

$ openssl s_client -connect www1.filemail.com:443 -tls1 -servername www1.filemail.com -CAfile rapidssl.pem 
CONNECTED(00000003)
depth=1 C = US, O = GeoTrust Inc., CN = RapidSSL SHA256 CA - G3
verify error:num=2:unable to get issuer certificate
issuer= C = US, O = GeoTrust Inc., CN = GeoTrust Global CA
Server did acknowledge servername extension.
---
Certificate chain
 0 s:/OU=GT83551982/OU=See www.rapidssl.com/resources/cps (c)14/OU=Domain Control Validated - RapidSSL(R)/CN=*.filemail.com
   i:/C=US/O=GeoTrust Inc./CN=RapidSSL SHA256 CA - G3
 1 s:/C=US/O=GeoTrust Inc./CN=RapidSSL SHA256 CA - G3
   i:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIEsDCCA5igAwIBAgICPlMwDQYJKoZIhvcNAQELBQAwRzELMAkGA1UEBhMCVVMx
FjAUBgNVBAoTDUdlb1RydXN0IEluYy4xIDAeBgNVBAMTF1JhcGlkU1NMIFNIQTI1
NiBDQSAtIEczMB4XDTE0MTAxNDIwMTQ1N1oXDTE4MDgwNDEzMDkyOFowgZIxEzAR
BgNVBAsTCkdUODM1NTE5ODIxMTAvBgNVBAsTKFNlZSB3d3cucmFwaWRzc2wuY29t
L3Jlc291cmNlcy9jcHMgKGMpMTQxLzAtBgNVBAsTJkRvbWFpbiBDb250cm9sIFZh
bGlkYXRlZCAtIFJhcGlkU1NMKFIpMRcwFQYDVQQDDA4qLmZpbGVtYWlsLmNvbTCC
ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMU4iXJAdHfidvAgrtmRJqxC
hQOG/y+hlLfzhkz3zmNGR+YDc5UBBwvgYJqTw7QUvE4W8lASiRFC9VhRdBWB0M5u
4oXo0jo4SKMCgOCh+uqPyu68ALOyZH+c2sroP6dIr1ztji8nlRlShdEVm/VNtyFE
iQVvBpJ7q54QY75+zjtYEGiuelJu5WK//1YzBlHlYaC9azzJ81VUAhbyVieBvoOC
UyUexBwdZdqfLPeXSTzhAzUc2sMCbZMaSolTTPU+5/m5wBDggHc62V3tsUaekn6G
Rte+/q9arwK0G9IrCB28tZOMSEUnuiZpqaifmNPeLfVw9TlqMDuMAWyFGaKmmmUC
AwEAAaOCAVgwggFUMB8GA1UdIwQYMBaAFMOc8/zTRgg0u85Gf6B8W/PiCMtZMFcG
CCsGAQUFBwEBBEswSTAfBggrBgEFBQcwAYYTaHR0cDovL2d2LnN5bWNkLmNvbTAm
BggrBgEFBQcwAoYaaHR0cDovL2d2LnN5bWNiLmNvbS9ndi5jcnQwDgYDVR0PAQH/
BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAnBgNVHREEIDAe
gg4qLmZpbGVtYWlsLmNvbYIMZmlsZW1haWwuY29tMCsGA1UdHwQkMCIwIKAeoByG
Gmh0dHA6Ly9ndi5zeW1jYi5jb20vZ3YuY3JsMAwGA1UdEwEB/wQCMAAwRQYDVR0g
BD4wPDA6BgpghkgBhvhFAQc2MCwwKgYIKwYBBQUHAgEWHmh0dHBzOi8vd3d3LnJh
cGlkc3NsLmNvbS9sZWdhbDANBgkqhkiG9w0BAQsFAAOCAQEAd35UR5NssE6c3AFH
H3ZUnfJClMGU+Hu0aIL+bWZFaOG937ptFaFssHme15nZEX6E6fFjfJIlw/7MAhph
uaMpWRjC8dLXhNyNKC61bpHZaGU3Wrmz1fTRH7LsKw/hUDBy9wRwaCawYUdESdBi
MYFT+sw6e6E7dNrCO3tdnCPeaZJR/P+Neur9smhfOD0i9qZK16CIlwZU/brcuTpp
JYmZDoGCyGNch5i/cAgKiSChF2MxJnuvs4PznLZ+ZFIIv6N01Qwm9iV8ucsnV4h/
rxy1mQhK/cK07HpA6oCs6IiEM1OrkK+8vOpviP6o+cdjo3QsCzdckDmthYJq6eqn
4VXC3Q==
-----END CERTIFICATE-----
subject=/OU=GT83551982/OU=See www.rapidssl.com/resources/cps (c)14/OU=Domain Control Validated - RapidSSL(R)/CN=*.filemail.com
issuer=/C=US/O=GeoTrust Inc./CN=RapidSSL SHA256 CA - G3
---
No client certificate CA names sent
Server Temp Key: ECDH, P-521, 521 bits
---
SSL handshake has read 2834 bytes and written 338 bytes
Verification error: unable to get issuer certificate
---
New, SSLv3, Cipher is ECDHE-RSA-AES256-SHA
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1
    Cipher    : ECDHE-RSA-AES256-SHA
    Session-ID: 27390000AF3638FDEA75DDF52B9D937F290593304123134062F049306BBDE87F
    Session-ID-ctx: 
    Master-Key: E8E2613F6267C705CA82EEE4C8A992880A2ABDA9E8D477A10C952764B1F4DD3D39244D3F0AD915B8FEB7E5FA1E8D55FD
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    Start Time: 1473889933
    Timeout   : 7200 (sec)
    Verify return code: 2 (unable to get issuer certificate)
    Extended master secret: yes
----
Farriery answered 14/9, 2016 at 15:19 Comment(4)
Thanks for your research and thoughts so far! Please correct me if I'm wrong - but doesn't both mine and your tests show that both servers are returning the exact same certificate and chain? Could the different behaviour be related to different cipher suites being used?Brooks
I added RSA SHA-2 (under SHA-1 Root) Intermediate CA to my PEM file - but I still get the same error when trying to make a handshake against www1.Brooks
@NjålArneGjermundshaug - You need the CA with the Authority Key identifier (Issuer Key) of C3:9C:F3:FC:D3:46:08:34:BB:CE:46:7F:A0:7C:5B:F3:E2:08:CB:59. You can find it at RapidSSL SHA256 CA - G3. You don't need to add it to cacerts.pem. Just use it as the only certificate since that's the only one that's needed.Farriery
Tried this Poco::Net::Context(Poco::Net::Context::CLIENT_USE, "", "C:\\RapidSSLSHA256CA-G3.pem", "", Poco::Net::Context::VERIFY_RELAXED, 9, false, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"); but this doesn't work either. The SecureStreamSocket never returns from its constructor. The objective is to make it work with the cacert.pem file - since I need to invoke other websites as well. And in order to make it work - I guess I need to pinpoint the differences in www1 and www2.Brooks
A
3

Günter Obiltschnig helped me out via POCO@Github and got it working by replacing

Poco::Net::SecureStreamSocket ss(Poco::Net::SocketAddress(uri.getHost().c_str(), uri.getPort()));

with

Poco::Net::SecureStreamSocket ss(Poco::Net::SocketAddress(uri.getHost().c_str(), uri.getPort()), uri.getHost());

(including the host name in the constructor of SecureStreamSocket - it is used for certificate verification)

From the POCO documentation:

SecureStreamSocket(
    const SocketAddress & address,
    const std::string & hostName
);

//Creates a secure stream socket using the default client SSL context and connects it to the socket specified by address.
//The given host name is used for certificate verification <=======

I still do not know the exact difference in config between www1 and www2 are, would love if someone could enlighten me on this.

Autolysin answered 17/9, 2016 at 17:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.