cert_cache v0.1.0 CertCache

A certificate cache.

NOTE: Currently, certificates must be stored on disk in PEM format.

Link to this section Summary

Functions

Certs are loaded from disk on first get, and from cache then after, unless false is passed for the cached param

Link to this section Functions

Link to this function get_cert(filename, cached \\ true)

Certs are loaded from disk on first get, and from cache then after, unless false is passed for the cached param.

Raises File.Error if requested cert file is not found.

Certs are returned in DER format. Pass them directly to erlang ssl via the cert/cacerts/key options instead of passing filenames via the certfile/cacertfile/keyfile options.

ex: (hackney)

mycert = CertCache.get_cert("cert.pem")
:hackney.get(url, ssl_options: [ cacerts: [ mycert ] ])

ex: (HTTPoison)

mycert = CertCache.get_cert("cert.pem")
HTTPoison.get(url, ssl: [ cacerts: [ mycert ] ])
Link to this function start_link(base_dir)