title: TwitteR, ROAuth and Windows: register OK, but certificate verify failed
body: <p>I'm trying to get the number of followers of a large number of Twitter users with <code>twitteR</code>. Many of the <a href="https://stackoverflow.com/questions/8122879/roauth-on-windows-using-r">other</a> <a href="https://stackoverflow.com/questions/7411215/oauth-authentication-with-twitter-api-failed">questions</a> posted have been very useful in getting me this far, but none seem to be directly relevant to my problem, so far as I can see.</p>
  
  <p>I can register my OAuth credentials to a twitter R session, but then I can't seem to do anything at all, I just get is this message:</p>
  
  <p><code>Error in function (type, msg, asError = TRUE)  : 
    SSL certificate problem, verify that the CA cert is OK. Details:
  error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify fail</code> </p>
  
  <p>When I use the <code>twitteR</code> functions without using OAuth they work fine with no errors or warnings, but I bump into limits and protected accounts, which I thought I could avoid with OAuth. </p>
  
  <p>Here are the details:</p>
  
  <pre><code>library(twitteR)
  library(ROAuth)
  library(RCurl)
  #
  # Here's how I register my credentials
  #
  requestURL &lt;-  "https://api.twitter.com/oauth/request_token"
  accessURL =    "https://api.twitter.com/oauth/access_token"
  authURL =      "https://api.twitter.com/oauth/authorize"
  consumerKey =   "------------"
  consumerSecret = "-----------"
  twitCred &lt;- OAuthFactory$new(consumerKey=consumerKey,
                               consumerSecret=consumerSecret,
                               requestURL=requestURL,
                               accessURL=accessURL,
                               authURL=authURL)
  download.file(url="http://curl.haxx.se/ca/cacert.pem",
                destfile="cacert.pem")
  twitCred$handshake(cainfo="cacert.pem")
  To enable the connection, please direct your web browser to: 
  https://api.twitter.com/oauth/authorize?oauth_token=xxxx
  When complete, record the PIN given to you and provide it here: xxxxxx
  registerTwitterOAuth(twitCred)
  [1] TRUE
  # so the OAuth bit appears to be ok...
  #
  # save it for a future sessions...
  save(list="twitCred", file="twitteR_credentials")
  # works, in future I can just
  load("twitteR_credentials")
  registerTwitterOAuth(twitCred)
  #
  # try to get follower numbers, here's where it goes south
  me &lt;- getUser("Rbloggers")
  me$followersCount
  Error in function (type, msg, asError = TRUE)  :
  SSL certificate problem, verify that the CA cert is OK. Details:
  error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
  #
  # another method, same problem
  getUser("Rbloggers")$followersCount
  Error in function (type, msg, asError = TRUE)  : 
  SSL certificate problem, verify that the CA cert is OK. Details:
  error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
  # 
  # Here are the packages and versions I'm using
  sessionInfo() 
  R version 2.14.1 (2011-12-22)
  Platform: i386-pc-mingw32/i386 (32-bit)
  
  locale:
  [1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252   
  [3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C                      
  [5] LC_TIME=English_Australia.1252    
  
  attached base packages:
  [1] stats4    stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
   [1] ROAuth_0.9.2      digest_0.5.1      twitteR_0.99.19   rjson_0.2.6       RCurl_1.91-1.1   
   [6] bitops_1.0-4.1    igraph_0.5.5-4    topicmodels_0.1-4 tm_0.5-7          slam_0.1-23      
  [11] modeltools_0.2-18 lasso2_1.2-12    
  
  loaded via a namespace (and not attached):
  [1] tools_2.14.1
  </code></pre>
  
  <p>How can I get the <code>twitteR</code> functions working after I register my credentials?</p>
  
  <p><strong>UPDATE</strong>: Trying @Btibert3's suggestion gives the same error:</p>
  
  <pre><code>&gt; ## Authenticate with Twitter = this is an important peice of code
  &gt; registerTwitterOAuth(cred)
  [1] TRUE
  &gt; ##########################################################################
  &gt; ## lets test out what our session limits look like
  &gt; ##########################################################################
  &gt; rate.limit &lt;- getCurRateLimitInfo()
  Error in function (type, msg, asError = TRUE)  : 
    SSL certificate problem, verify that the CA cert is OK. Details:
  error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
  </code></pre>
  
  <p><strong>UPDATE</strong> following @flz's suggestion to add <code>cainfo="cacert.pem"</code> everywhere has fixed my problem:</p>
  
  <pre><code>rate.limit &lt;- getCurRateLimitInfo( cainfo="cacert.pem")
  rate.limit
                               resource limit remaining               reset
  1                  /lists/subscribers   180       180 2013-03-27 09:35:37
  2                         /lists/list    15        15 2013-03-27 09:35:37
  3                  /lists/memberships    15        15 2013-03-27 09:35:37
  4                   /lists/ownerships    15        15 2013-03-27 09:35:37
  5                /lists/subscriptions    15        15 2013-03-27 09:35:37
  6                      /lists/members   180       180 2013-03-27 09:35:37
  7             /lists/subscribers/show    15        15 2013-03-27 09:35:37
  8                     /lists/statuses   180       180 2013-03-27 09:35:37
  9                         /lists/show    15        15 2013-03-27 09:35:37
  10                /lists/members/show    15        15 2013-03-27 09:35:37
  11     /application/rate_limit_status   180       179 2013-03-27 09:35:37 (etc)
  </code></pre>
  
  <p>Session Info: </p>
  
  <pre><code>sessionInfo()
  R version 2.15.3 (2013-03-01)
  Platform: x86_64-w64-mingw32/x64 (64-bit)
  
  locale:
  [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
  [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
  [5] LC_TIME=English_United States.1252    
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
  [1] ROAuth_0.9.2   digest_0.6.3   twitteR_1.1.0  rjson_0.2.12   RCurl_1.95-4.1 bitops_1.0-5  
  
  loaded via a namespace (and not attached):
  [1] tools_2.15.3
  </code></pre>