| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/tls.R |
| 3 |
\name{tls_config} |
| 4 |
\alias{tls_config} |
| 5 |
\title{Create TLS Configuration} |
| 6 |
\usage{ |
| 7 |
tls_config(client = NULL, server = NULL, pass = NULL, auth = is.null(server)) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{client}{\strong{either} the character path to a file containing X.509 |
| 11 |
certificate(s) in PEM format, comprising the certificate authority |
| 12 |
certificate chain (and revocation list if present), used to validate |
| 13 |
certificates presented by peers,\cr |
| 14 |
\strong{or} a length 2 character vector comprising [i] the certificate |
| 15 |
authority certificate chain and [ii] the certificate revocation list, or |
| 16 |
empty string \code{""} if not applicable.} |
| 17 |
|
| 18 |
\item{server}{\strong{either} the character path to a file containing the |
| 19 |
PEM-encoded TLS certificate and associated private key (may contain |
| 20 |
additional certificates leading to a validation chain, with the leaf |
| 21 |
certificate first),\cr |
| 22 |
\strong{or} a length 2 character vector comprising [i] the TLS certificate |
| 23 |
(optionally certificate chain) and [ii] the associated private key.} |
| 24 |
|
| 25 |
\item{pass}{(optional) required only if the secret key supplied to \code{server} |
| 26 |
is encrypted with a password. For security, consider providing through a |
| 27 |
function that returns this value, rather than directly.} |
| 28 |
|
| 29 |
\item{auth}{logical value whether to require authentication - by default TRUE |
| 30 |
for client and FALSE for server configurations. If TRUE, the session is |
| 31 |
only allowed to proceed if the peer has presented a certificate and it has |
| 32 |
been validated. If FALSE, authentication is optional, whereby a certificate |
| 33 |
is validated if presented by the peer, but the session allowed to proceed |
| 34 |
otherwise. If neither \code{client} nor \code{server} are supplied, then no |
| 35 |
authentication is performed and this argument has no effect.} |
| 36 |
} |
| 37 |
\value{ |
| 38 |
A 'tlsConfig' object. |
| 39 |
} |
| 40 |
\description{ |
| 41 |
Create a TLS configuration object to be used for secure connections. Specify |
| 42 |
\code{client} to create a client configuration or \code{server} to create a server |
| 43 |
configuration. |
| 44 |
} |
| 45 |
\details{ |
| 46 |
Specify one of \code{client} or \code{server} only, or neither (in which case an empty |
| 47 |
client configuration is created), as a configuration can only be of one type. |
| 48 |
} |
| 49 |
\section{Public Internet HTTPS}{ |
| 50 |
|
| 51 |
|
| 52 |
When making HTTPS requests over the public internet, you should supply a TLS |
| 53 |
configuration to validate server certificates. |
| 54 |
|
| 55 |
Root CA certificates in PEM format may be found at: |
| 56 |
\itemize{ |
| 57 |
\item Linux: \file{/etc/ssl/certs/ca-certificates.crt} or |
| 58 |
\file{/etc/pki/tls/certs/ca-bundle.crt} |
| 59 |
\item macOS: \file{/etc/ssl/cert.pem} |
| 60 |
\item Windows: download from the Common CA Database site run by Mozilla: |
| 61 |
\url{https://www.ccadb.org/resources} (select the Server Authentication SSL/TLS |
| 62 |
certificates text file). \emph{This link is not endorsed; use at your own risk.} |
| 63 |
} |
| 64 |
} |
| 65 |
|
| 66 |
\examples{ |
| 67 |
tls <- tls_config() |
| 68 |
tls |
| 69 |
ncurl("https://postman-echo.com/get", timeout = 1000L, tls = tls) |
| 70 |
|
| 71 |
# client TLS configuration for public internet HTTPS on Linux |
| 72 |
# tls <- tls_config(client = "/etc/ssl/certs/ca-certificates.crt") |
| 73 |
|
| 74 |
} |