How to use the SSL Certificate?


#1

I’m trying to connect to Twitter API v1.1 using SSL as instructed here: https://dev.twitter.com/discussions/24239 and here https://dev.twitter.com/docs/security/using-ssl

However I have no idea how to use the certificate to connect!! I keep getting a NULL http_code when tryign to connect.

Quite frankly the part I’m having trouble is the certificate. How or what exactly do I include inside the .CRT file???
Am I suppose to go to https://www.symantec.com/page.jsp?id=roots and copy and paste all of that .CER files into one file?? Am I suppose to use one of these files??

Can someone please give a more detailed information on how to use the certificate to connect??


#2

Every HTTP client in every library/language has a configuration that sets what path the certificates must to be located and what format you should follow to store them there, there is no single pattern. Search in forums of the language or library you are using to do this connection and you might find procedures you should follow to install the certificates.


#3

I’m using PHP

I don’t think the way I’m setting the path to the certificate is a problem at all. I mean, after all its pretty straightforward.

Looking at the example in the link above, this code is really not hard to follow.
curl_setopt($connection, CURLOPT_SSL_VERIFYPEER, True);
curl_setopt($connection, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($connection, CURLOPT_CAINFO, “path:/ca-bundle.crt”);

What I’m having trouble with is what should be inside the ca-bundle.crt ???

When I go to https://www.symantec.com/page.jsp?id=roots there are dozens of files I can download. Which one do i download?? What should be inside the ca-bundle.crt ??


#4

Given that you are using PHP, which uses curl, please follow the procedures:

  1. download http://curl.haxx.se/ca/cacert.pem and save it somewhere. (this pem file already has Verisign root needed for api.twitter.com)
  2. update php.ini – add curl.cainfo = “PATH_TO/cacert.pem”

Otherwise you will need to do the following for every cURL resource:

curl_setopt ($ch, CURLOPT_CAINFO, “PATH_TO/cacert.pem”);

Reference: http://stackoverflow.com/a/16495053/2933153


#5

Ok.

Thank you, however even though I originally thought that the cert file was the problem, it is not. Ever since Jan 15, when I try to connect to Twitter API, I get a NULL http_code. I had thought that this was due to the cert file being wrong but after downloading that cert file, it still does not work.

Do you know why I may be receiving a NULL http_code upon connection attempt?? I am using abraham’s twitter oauth code.


#6

Honestly is there some kind of example code for connecting to Twitter using SSL?? It would help tremendously.


#7

For example codes in PHP, read carefully these repos READMEs and execute their examples:



Specially: https://github.com/themattharris/tmhOAuthExamples/blob/master/cli/tweet.php


#8

STILL not working.

What’s frustrating is that I get nothing returned!! No error messages or anything.

What are the reasons why I would get a NULL returned?? Is it possible that I’m banned somehow?? Shouldn’t I get some kind of http error code returned upon failure??


#9

Can you paste here the log you are getting when trying to connect?


#10

I’m not sure I’m on the right track and it’s VERTY frustrating, since I’m not a “techie”. I can see the new api.twitter.com certificate, but I don’t have the option to verify it. I have no idea what to do next. I am using a Blackberry. Thanks for your help


#11

javax.servlet.ServletException: 403:The request is understood, but it has been refused. An accompanying error message will explain why. This code is used when requests are being denied due to update limits (http://support.twitter.com/forums/10711/entries/15364).
SSL is required
Relevant discussions can be on the Internet at:
http://www.google.co.jp/search?q=6c607809 or
http://www.google.co.jp/search?q=0f1d8125
TwitterException{exceptionCode=[6c607809-0f1d8125], statusCode=403, retryAfter=0, rateLimitStatus=null, version=2.2.0}

please provide solution . how to solve the problem?


#12

my twitter wont open


#13

i get this

Cannot connect to the real twitter.com

Something is currently interfering with your secure connection to twitter.com.

Try to reload this page in a few minutes or after switching to a new network. If you have recently connected to a new Wi-Fi network, finish logging in before reloading.

If you were to visit twitter.com right now, you might share private information with an attacker. To protect your privacy, Chrome will not load the page until it can establish a secure connection to the real twitter.com.