{"id":21955199,"url":"https://github.com/voltone/x509","last_synced_at":"2025-05-15T10:03:37.150Z","repository":{"id":32675914,"uuid":"138734570","full_name":"voltone/x509","owner":"voltone","description":"Elixir package for working with X.509 certificates, Certificate Signing Requests (CSRs), Certificate Revocation Lists (CRLs) and RSA/ECC key pairs","archived":false,"fork":false,"pushed_at":"2024-10-29T12:30:12.000Z","size":322,"stargazers_count":121,"open_issues_count":16,"forks_count":32,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T16:55:20.538Z","etag":null,"topics":["certificate","elixir","pki","x509"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/voltone.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":"2018-06-26T12:25:47.000Z","updated_at":"2024-12-15T13:24:58.000Z","dependencies_parsed_at":"2024-06-27T15:19:25.275Z","dependency_job_id":"4d86e98b-e93c-4c2e-b430-2bfee80a222f","html_url":"https://github.com/voltone/x509","commit_stats":{"total_commits":149,"total_committers":10,"mean_commits":14.9,"dds":0.2684563758389261,"last_synced_commit":"c7864e9668d94d5256b691ac00dcb740592a0d16"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voltone%2Fx509","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voltone%2Fx509/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voltone%2Fx509/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voltone%2Fx509/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/voltone","download_url":"https://codeload.github.com/voltone/x509/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254319716,"owners_count":22051072,"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":["certificate","elixir","pki","x509"],"created_at":"2024-11-29T07:29:48.354Z","updated_at":"2025-05-15T10:03:31.993Z","avatar_url":"https://github.com/voltone.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# X509\n\n[![Github.com](https://github.com/voltone/x509/workflows/CI/badge.svg)](https://github.com/voltone/x509/actions)\n[![Hex.pm](https://img.shields.io/hexpm/v/x509.svg)](https://hex.pm/packages/x509)\n[![Hexdocs.pm](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/x509/)\n[![Hex.pm](https://img.shields.io/hexpm/dt/x509.svg)](https://hex.pm/packages/x509)\n[![Hex.pm](https://img.shields.io/hexpm/l/x509.svg)](https://hex.pm/packages/x509)\n[![Github.com](https://img.shields.io/github/last-commit/voltone/x509.svg)](https://github.com/voltone/x509/commits/master)\n\n\nElixir package for working with X.509 certificates, Certificate Signing Requests (CSRs), Certificate Revocation Lists (CRLs) and RSA/ECC key pairs.\n\nRequires Erlang/OTP 20.1 or later.\n\nDevelopment and public release of this package were made possible by\n[Bluecode](https://bluecode.com/).\n\n## Usage\n\n### As a Certificate Authority (CA)\n\nGenerate a self-signed CA certificate and private key, using the `root_ca`\ntemplate:\n\n```elixir\niex\u003e ca_key = X509.PrivateKey.new_ec(:secp256r1)\n{:ECPrivateKey, ...}\niex\u003e ca = X509.Certificate.self_signed(ca_key,\n...\u003e   \"/C=US/ST=CA/L=San Francisco/O=Acme/CN=ECDSA Root CA\",\n...\u003e   template: :root_ca\n...\u003e)\n{:OTPCertificate, ...}\n```\n\nUse the CA certificate to issue a server certificate, using the default\n`server` template and the given SAN hostnames:\n\n```elixir\niex\u003e my_key = X509.PrivateKey.new_ec(:secp256r1)\n{:ECPrivateKey, ...}\niex\u003e my_cert = my_key |\u003e\n...\u003e X509.PublicKey.derive() |\u003e\n...\u003e X509.Certificate.new(\n...\u003e   \"/C=US/ST=CA/L=San Francisco/O=Acme/CN=Sample\",\n...\u003e   ca, ca_key,\n...\u003e   extensions: [\n...\u003e     subject_alt_name: X509.Certificate.Extension.subject_alt_name([\"example.org\", \"www.example.org\"])\n...\u003e   ]\n...\u003e )\n{:OTPCertificate, ...}\n```\n\nOr sign a certificate based on an incoming CSR:\n\n```elixir\niex\u003e csr = X509.CSR.from_pem!(pem_string)\n{:CertificationRequest, ...}\niex\u003e subject = X509.CSR.subject(csr)\n{:rdnSequence, ...}\niex\u003e my_cert = csr |\u003e\n...\u003e X509.CSR.public_key() |\u003e\n...\u003e X509.Certificate.new(\n...\u003e   subject,\n...\u003e   ca, ca_key,\n...\u003e   extensions: [\n...\u003e     subject_alt_name: X509.Certificate.Extension.subject_alt_name([\"example.org\", \"www.example.org\"])\n...\u003e   ]\n...\u003e )\n```\n\n### With `:public_key` for encryption/signing\n\nPlease refer to the documentation for the `X509.PrivateKey` module for\nexamples showing asymmetrical encryption and decryption, as well as message\nsigning and verification, with Erlang/OTP's `:public_key` APIs.\n\n### For TLS client/server testing\n\nThe `x509.gen.selfsigned` Mix task generates a self-signed certificate for use\nwith a TLS server in development or testing.\n\nThe `X509.Test.Suite` and `X509.Test.Server` modules may be used to create\ntest cases for TLS clients. The [server_test.exs](test/x509/test/server_test.exs)\nfile can serve as a template: update the `request/2` function to invoke of the\nTLS client under test,  make sure it returns the expected response format, and\nupdate the test server's canned response in the test module's setup if\nnecessary.\n\nYou may want to include the X509 package only in the 'dev' and/or 'test'\nenvironments for this use-case, by adding an `only: ...` clause to the\ndependency definition in your Mix file.\n\n## Installation\n\nAdd `x509` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:x509, \"~\u003e 0.8\"}\n  ]\nend\n```\n\nDocumentation can be found at [https://hexdocs.pm/x509](https://hexdocs.pm/x509).\n\n## License\n\nCopyright (c) 2019, Bram Verburg\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n  list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n  this list of conditions and the following disclaimer in the documentation\n  and/or other materials provided with the distribution.\n\n* Neither the name of the copyright holder nor the names of its contributors\n  may be used to endorse or promote products derived from this software\n  without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoltone%2Fx509","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoltone%2Fx509","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoltone%2Fx509/lists"}