Skip to contents

Create a TLS configuration object to be used for secure connections. Specify ‘client’ to create a client configuration or ‘server’ to create a server configuration.


tls_config(client = NULL, server = NULL, pass = NULL, auth = is.null(server))



either the character path to a file containing X.509 certificate(s) in PEM format, comprising the certificate authority certificate chain (and revocation list if present), used to validate certificates presented by peers,
or a length 2 character vector comprising [i] the certificate authority certificate chain and [ii] the certificate revocation list, or empty string '' if not applicable.


either the character path to a file containing the PEM-encoded TLS certificate and associated private key (may contain additional certificates leading to a validation chain, with the leaf certificate first),
or a length 2 character vector comprising [i] the TLS certificate (optionally certificate chain) and [ii] the associated private key.


(optional) required only if the secret key supplied to 'server' is encrypted with a password. For security, consider providing through a function that returns this value, rather than directly.


logical value whether to require authentication - by default TRUE for client and FALSE for server configurations. If TRUE, the session is only allowed to proceed if the peer has presented a certificate and it has been validated. If FALSE, authentication is optional, whereby a certificate is validated if presented by the peer, but the session allowed to proceed otherwise. If neither 'client' nor 'server' are supplied, then no authentication is performed and this argument has no effect.


A ‘tlsConfig’ object.


Specify one of ‘client’ or ‘server’ only, or neither (in which case an empty client configuration is created), as a configuration can only be of one type.

For creating client configurations for public internet usage, root CA ceritficates may usually be found at /etc/ssl/certs/ca-certificates.crt on Linux systems. Otherwise, root CA certificates in PEM format are available at the Common CA Database site run by Mozilla: (select the Server Authentication SSL/TLS certificates text file). This link is not endorsed; use at your own risk.


tls <- tls_config()
#> < TLS client config | auth mode: none >
ncurl("", timeout = 1000L, tls = tls)
#> $status
#> [1] 200
#> $headers
#> $data
#> [1] "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\">\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n    <title>R: The R Project for Statistical Computing</title>\n\n    <link rel=\"icon\" type=\"image/png\" href=\"/favicon-32x32.png\" sizes=\"32x32\" />\n    <link rel=\"icon\" type=\"image/png\" href=\"/favicon-16x16.png\" sizes=\"16x16\" />\n\n    <!-- Bootstrap -->\n    <link href=\"/css/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"/css/R.css\" rel=\"stylesheet\">\n\n    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->\n    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->\n    <!--[if lt IE 9]>\n      <script src=\"\"></script>\n      <script src=\"\"></script>\n    <![endif]-->\n  </head>\n  <body>\n    <div class=\"container page\">\n      <div class=\"row\">\n        <div class=\"col-xs-12 col-sm-offset-1 col-sm-2 sidebar\" role=\"navigation\">\n<div class=\"row\">\n<div class=\"col-xs-6 col-sm-12\">\n<p><a href=\"/\"><img src=\"/Rlogo.png\" width=\"100\" height=\"78\" alt = \"R\" /></a></p>\n<p><small><a href=\"/\">[Home]</a></small></p>\n<h2 id=\"download\">Download</h2>\n<p><a href=\"\">CRAN</a></p>\n<h2 id=\"r-project\">R Project</h2>\n<ul>\n<li><a href=\"/about.html\">About R</a></li>\n<li><a href=\"/logo/\">Logo</a></li>\n<li><a href=\"/contributors.html\">Contributors</a></li>\n<li><a href=\"/news.html\">What’s New?</a></li>\n<li><a href=\"/bugs.html\">Reporting Bugs</a></li>\n<li><a href=\"/conferences/\">Conferences</a></li>\n<li><a href=\"/search.html\">Search</a></li>\n<li><a href=\"/mail.html\">Get Involved: Mailing Lists</a></li>\n<li><a href=\"\">Get Involved: Contributing</a></li>\n<li><a href=\"\">Developer Pages</a></li>\n<li><a href=\"\">R Blog</a></li>\n</ul>\n</div>\n<div class=\"col-xs-6 col-sm-12\">\n<h2 id=\"r-foundation\">R Foundation</h2>\n<ul>\n<li><a href=\"/foundation/\">Foundation</a></li>\n<li><a href=\"/foundation/board.html\">Board</a></li>\n<li><a href=\"/foundation/members.html\">Members</a></li>\n<li><a href=\"/foundation/donors.html\">Donors</a></li>\n<li><a href=\"/foundation/donations.html\">Donate</a></li>\n</ul>\n<h2 id=\"help-with-r\">Help With R</h2>\n<ul>\n<li><a href=\"/help.html\">Getting Help</a></li>\n</ul>\n<h2 id=\"documentation\">Documentation</h2>\n<ul>\n<li><a href=\"\">Manuals</a></li>\n<li><a href=\"\">FAQs</a></li>\n<li><a href=\"\">The R Journal</a></li>\n<li><a href=\"/doc/bib/R-books.html\">Books</a></li>\n<li><a href=\"/certification.html\">Certification</a></li>\n<li><a href=\"/other-docs.html\">Other</a></li>\n</ul>\n<h2 id=\"links\">Links</h2>\n<ul>\n<li><a href=\"\">Bioconductor</a></li>\n<li><a href=\"\">R-Forge</a></li>\n<li><a href=\"\">R-Hub</a></li>\n<li><a href=\"/gsoc.html\">GSoC</a></li>\n</ul>\n</div>\n</div>\n        </div>\n        <div class=\"col-xs-12 col-sm-7\">\n        <h1>The R Project for Statistical Computing</h1>\n<h2 id=\"getting-started\">Getting Started</h2>\n<p>R is a free software environment for statistical computing and graphics. It compiles and runs on a wide variety of UNIX platforms, Windows and MacOS. To <strong><a href=\"\">download R</a></strong>, please choose your preferred <a href=\"\">CRAN mirror</a>.</p>\n<p>If you have questions about R like how to download and install the software, or what the license terms are, please read our <a href=\"\">answers to frequently asked questions</a> before you send an email.</p>\n<h2 id=\"news\">News</h2>\n<ul>\n<li>We are deeply sorry to announce that our friend and colleague Friedrich (Fritz) Leisch has died. <a href=\"doc/obit/fritz.html\">Read our tribute to Fritz here</a>.</li>\n<li><a href=\"\"><strong>R version 4.4.0 (Puppy Cup)</strong></a> has been released on 2024-04-24.</li>\n<li><a href=\"\"><strong>R version 4.3.3 (Angel Food Cake)</strong></a> (wrap-up of 4.3.x) was released on 2024-02-29.</li>\n<li><a href=\"\"><strong>Registration for useR! 2024</strong></a> has opened with early bird deadline March 31 2024.</li>\n<li>You can support the R Foundation with a renewable subscription as a <a href=\"\">supporting member</a>.</li>\n</ul>\n<h2 id=\"news-via-mastodon\">News via Mastodon</h2>\n<!--\nMastodon widget from\nFiles mastodon-feed-timeline.css and mastodon-feed-timeline.js are from this source\n-->\n<link rel=\"stylesheet\" href=\"mastodon-timeline.css\" />\n<script src=\"mastodon-timeline.js\"></script>\n<link rel=\"stylesheet\" href=\"mastodon-timeline.css\" />\n<script src=\"mastodon-timeline.js\"></script>\n<div class=\"mt-timeline\">\n<div id=\"mt-body\" class=\"mt-body\" data-role=\"feed\">\n<pre><code>&lt;div class=&quot;loading-spinner&quot;&gt;&lt;/div&gt;</code></pre>\n</div>\n</div>\n<h2 id=\"social-media\">Social Media</h2>\n<!-- rel=\"me\" required to verify on Mastodon -->\n<p>Follow the R Foundation on <a rel=\"me\" href=\"\">Mastodon</a>, <a href=\"\">Twitter</a>, or <a href=\"\">LinkedIn</a>.</p>\n<!--- (Boilerplate for release run-in)\n-   [**R version 3.1.3 (Smooth Sidewalk) prerelease versions**]( will appear starting February 28. Final release is scheduled for 2015-03-09.\n-->\n        </div>\n      </div>\n      <div class=\"raw footer\">\n        &copy; The R Foundation. For queries about this web site, please contact\n\t<script type='text/javascript'>\n<!--\nvar s=\"=b!isfg>#nbjmup;xfcnbtufsAs.qspkfdu/psh#?uif!xfcnbtufs=0b?\";\nm=\"\"; for (i=0; i<s.length; i++) {if(s.charCodeAt(i) == 28){m+= '&';} else if (s.charCodeAt(i) == 23) {m+= '!';} else {m+=String.fromCharCode(s.charCodeAt(i)-1);}}document.write(m);//-->\n\t</script>;\n        for queries about R itself, please consult the \n        <a href=\"help.html\">Getting Help</a> section.\n      </div>\n    </div>\n    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->\n    <script src=\"\"></script>\n    <!-- Include all compiled plugins (below), or include individual files as needed -->\n    <script src=\"/js/bootstrap.min.js\"></script>\n  </body>\n</html>\n"