Andy Jones
Andy Jones

Reputation: 6275

PHP and cURL error with client SSL ceritificates

I'm currently using PHP/cURL to connect to an API (xero.com) using a client certificate/key they provided.

I keep running into this error:

Curl error (56): SSL read: errno -5961

The corresponding cURL error is CURLE_RECV_ERROR.

Google has not been helpful. Any clue on what could cause this? Fixes?

Upvotes: 0

Views: 7253

Answers (2)

Andy Jones
Andy Jones

Reputation: 6275

The solution was that I was using a certificate PEM file with multiple certificates and OpenSSL / cURL was simply using the first certificate (which was the wrong one). The error message did not help.

Once I pulled the correct certificate into its own file everything started magically working.

The moral here is if you're running across this issue, check your key, check your certificate, cross your t's, and dot your i's.

Upvotes: 0

jww
jww

Reputation: 102454

Any clue on what could cause this? Fixes?

According to other reports, it appears your SSL session is timing out. See, for example, Root cause of “curl: (56) SSL read: errno -5961” errors.

The client certificate would be the first thing I would checked, though.

Can you duplicate the problem on the command line with OpenSSL's s_client?


Google has not been helpful.

When you search, you have to quote -5961: "-5961". Otherwise, Google treats it like an exclude predicate.

Upvotes: 1

Related Questions