cURL / Mailing Lists / curl-library / Single Mail


Raw communication over a SSL/TSL connection

From: Victor Dodon <>
Date: Tue, 19 Nov 2013 12:13:15 +0200

I am trying to talk to the Apple services in order to send push
notifications for the iOS devices. From the Apple Developer Library:

"Connection trust between a provider and APNs is also established through
TLS peer-to-peer authentication. The procedure is similar to that described
in “Service-to-Device Connection Trust.” The provider initiates a TLS
connection, gets the server certificate from APNs, and validates that
certificate. Then the provider sends its provider certificate to APNs,
which validates it on its end. Once this procedure is complete, a secure
TLS connection has been established; APNs is now satisfied that the
connection has been made by a legitimate provider."

So the application must create a SSL connection to the apple push services
and the communicate using a binary protocol.

From the curl library I use curl_easy_{send,recv} only after setting
CURLSETOPT_CONNECT_ONLY and performing a curl_easy_perform and after the
socket becomes available for writing.

Even if I don't set the certificate for the handle it always sends all the
data using the curl_easy_send but when I try to recv I always receive
unsupported protocol.

I something that I miss, is the any example of a binary communication over
a SSL connection?

Here is the code:

Thank you very much,

List admin:
Received on 2013-11-19