Skip to content

Manually Setting an SSL Certificate File

Shawn Garbett edited this page Jan 25, 2023 · 1 revision

REDCap uses SSL to facilitate authentication. The process is dependent on having an appropriate SSL certificate in place.

The redcapAPI package depends on the certificates bundled in httr. Occasionally, these certificates may fall out of date. Normally, updating the httr package should be enough to resolve the problem, but it's possible that new certificates haven't been bundled into httr yet. If this happens, you can try a couple of things to get new certificates.

Using the development version of httr

It is possible that the version of httr on CRAN doesn't have the updated certificates, but the version on GitHub may. An easy step to take before finding your own certificate bundle would be to run the following (note: you'll need to have the devtools package installed in your library)
devtools::install_github("hadley/httr")

If you still aren't able to authenticate, you will need to find your own certificate bundle.

Finding an Updated Certificate Bundle

The cURL project maintains a link to automatically converted certificates from Mozilla.org. Click on the "ca-bundle.crt" link and save the file to your desired location. This, I believe, is the same file that is stored in httr, so using this certificate bundle will only work if the development version of httr hasn't been updated yet.

Using the Certificate Bundle

The certificate bundle can be given to the redcapConnection function. This will perpetuate the certificate bundle throughout all of your API calls for your project. The recommended call for this is

rcon <- redcapConnection(url=[YOUR_URL], token=[YOUR_TOKEN],`  
            config(cainfo=[cert_location], sslversion=3)`

Using some other certificate

If these solutions don't work, you will probably have to find another certificate file. The best place to start would be with your REDCap administrators. Ask them what certificate they require and they may be able to point you to a solution.

More about SSL

Details on Server SSL Certificates Wikipedia Article on Transport Layer Security and SSL