{"id":17108468,"url":"https://github.com/g-andrade/tls_certificate_check","last_synced_at":"2025-04-05T16:09:09.620Z","repository":{"id":41831729,"uuid":"264746019","full_name":"g-andrade/tls_certificate_check","owner":"g-andrade","description":"CA store + Partial chain handler","archived":false,"fork":false,"pushed_at":"2025-03-07T10:49:21.000Z","size":856,"stargazers_count":22,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T15:09:14.583Z","etag":null,"topics":["castore","certificate-authority","https","ssl","tls"],"latest_commit_sha":null,"homepage":"https://hexdocs.pm/tls_certificate_check/","language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/g-andrade.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-17T19:58:20.000Z","updated_at":"2025-03-07T10:49:24.000Z","dependencies_parsed_at":"2023-10-15T18:03:04.455Z","dependency_job_id":"99e052ab-b703-4b1d-9808-715c5f7a9561","html_url":"https://github.com/g-andrade/tls_certificate_check","commit_stats":{"total_commits":312,"total_committers":6,"mean_commits":52.0,"dds":"0.15705128205128205","last_synced_commit":"ad13a7acaa788c166ec3959b0247cc8c46db3dbd"},"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g-andrade%2Ftls_certificate_check","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g-andrade%2Ftls_certificate_check/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g-andrade%2Ftls_certificate_check/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g-andrade%2Ftls_certificate_check/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/g-andrade","download_url":"https://codeload.github.com/g-andrade/tls_certificate_check/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247361691,"owners_count":20926643,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["castore","certificate-authority","https","ssl","tls"],"created_at":"2024-10-14T16:05:26.871Z","updated_at":"2025-04-05T16:09:09.580Z","avatar_url":"https://github.com/g-andrade.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tls\\_certificate\\_check\n\n[![Hex downloads](https://img.shields.io/hexpm/dt/tls_certificate_check.svg)](https://hex.pm/packages/tls_certificate_check)\n[![License](https://img.shields.io/hexpm/l/tls_certificate_check.svg)](https://github.com/g-andrade/tls_certificate_check/blob/master/LICENSE)\n[![Erlang Versions](https://img.shields.io/badge/Erlang%2FOTP-24%20to%2027-blue)](https://www.erlang.org)\n[![CI status](https://github.com/g-andrade/tls_certificate_check/actions/workflows/ci.yml/badge.svg)](https://github.com/g-andrade/tls_certificate_check/actions/workflows/ci.yml)\n[![Latest version](https://img.shields.io/hexpm/v/tls_certificate_check.svg?style=flat)](https://hex.pm/packages/tls_certificate_check)\n[![API reference](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/tls_certificate_check/)\n[![Last commit](https://img.shields.io/github/last-commit/g-andrade/tls_certificate_check.svg)](https://github.com/g-andrade/tls_certificate_check/commits/master)\n\n`tls_certificate_check` is a library for Erlang/OTP and Elixir that\ntries to make it easier to establish [more secure HTTPS\nconnections](https://wiki.mozilla.org/index.php?title=CA/IncludedCertificates\u0026redirect=no)\nin ordinary setups.\n\nOther kinds of TLS/SSL connections may also benefit from it.\n\nIt blends a CA trust store with\n[ssl\\_verify\\_fun](https://github.com/deadtrickster/ssl_verify_fun.erl)\nto verify remote hostnames,\nas well as the boilerplate to validate [misordered\ncertificate chains](https://github.com/elixir-mint/mint/issues/95).\n\nThe\n[OTP-trusted CAs](https://www.erlang.org/doc/man/public_key.html#cacerts_get-0)\n(typically provided by the OS) are used on OTP 25+ unless unavailable or opted-out[^1],\nin which case `tls_certificate_check` falls back to a hardcoded [Mozilla's CA certificate\nstore](https://curl.se/docs/caextract.html), as extracted by `curl`.\nWhen on OTP 24 or older, the lib will initialize using only the latter.\n\nThe trusted authorities' certificates are loaded when the application\nstarts and made available to the API through\n[`persistent_term`](https://erlang.org/doc/man/persistent_term.html)[^2]. After that, they can\nbe explicitly overridden through the API.\n\n### How to use\n\n#### Erlang\n\n##### 1\\. Import as a dependency\n\nrebar.config\n\n``` erlang\n{deps, [\n    % [...]\n    {tls_certificate_check, \"~\u003e 1.27\"}\n]}.\n```\n\nyour\\_application.app.src\n\n``` erlang\n{applications, [\n    kernel,\n    stdlib,\n    % [...]\n    tls_certificate_check\n]}\n```\n\n##### 2\\. Make your connections safer\n\n``` erlang\nHost = \"example.com\",\nOptions = tls_certificate_check:options(Host),\nssl:connect(Host, 443, Options, 5000)\n```\n\n#### Elixir\n\n##### 1\\. Import as a dependency\n\nmix.exs\n\n``` elixir\n  defp deps do\n    [\n      # [...]\n      {:tls_certificate_check, \"~\u003e 1.27\"}\n    ]\n  end\n```\n\n##### 2\\. Make your connections safer\n\n``` elixir\nhost = \"example.com\"\noptions = :tls_certificate_check.options(host)\nhost |\u003e String.to_charlist() |\u003e :ssl.connect(443, options, 5000)\n```\n\n### Advanced Use\n\n#### Overriding Trusted CAs\n\n##### Erlang\n\n```erlang\nPath = certifi:cacertfile(),\ntls_certificate_check:override_trusted_authorities({file, Path})\n```\n\n##### Elixir\n\n```elixir\npath = CAStore.file_path()\n:tls_certificate_check.override_trusted_authorities({:file, path})\n```\n\n### API Reference\n\nThe API reference can be found on\n[HexDocs](https://hexdocs.pm/tls_certificate_check/).\n\n### Tested setup\n\n  - Erlang/OTP 24 or newer\n  - rebar3\n\n### License\n\nMIT License\n\nCopyright (c) 2020-2024 Guilherme Andrade\n\nPermission is hereby granted, free of charge, to any person obtaining a\ncopy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\nOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n---\n\n[^1]: the use of OTP-trusted CAs can be controlled through the `use_otp_trusted_CAs` boolean\noption within application env config.\n\n[^2]: the persistent term key is derived from the CA store's own contents and existing keys\nare not erased until the app terminates gracefully - this minimizes the risk of an impactful\nglobal garbage collection.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fg-andrade%2Ftls_certificate_check","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fg-andrade%2Ftls_certificate_check","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fg-andrade%2Ftls_certificate_check/lists"}