{"id":20492042,"url":"https://github.com/zotonic/zotonic_ssl","last_synced_at":"2025-04-13T17:01:33.888Z","repository":{"id":39863798,"uuid":"246789520","full_name":"zotonic/zotonic_ssl","owner":"zotonic","description":"Useful SSL routines for Erlang projects","archived":false,"fork":false,"pushed_at":"2022-07-14T09:16:18.000Z","size":40,"stargazers_count":3,"open_issues_count":1,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-27T07:51:35.669Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zotonic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-12T09:07:33.000Z","updated_at":"2022-05-24T07:38:32.000Z","dependencies_parsed_at":"2022-09-16T17:50:21.056Z","dependency_job_id":null,"html_url":"https://github.com/zotonic/zotonic_ssl","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zotonic%2Fzotonic_ssl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zotonic%2Fzotonic_ssl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zotonic%2Fzotonic_ssl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zotonic%2Fzotonic_ssl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zotonic","download_url":"https://codeload.github.com/zotonic/zotonic_ssl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248529961,"owners_count":21119581,"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":[],"created_at":"2024-11-15T17:27:23.678Z","updated_at":"2025-04-13T17:01:33.841Z","avatar_url":"https://github.com/zotonic.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Zotonic SSL\n\nUseful SSL routines for Erlang/Elixir projects.\n\n## Certificates\n\n### Generate self-signed certificates\n\nExample:\n\n```erlang\nPemFile = \"/my/secure/path/cert.pem\",\nCertFile = \"/my/secure/path/cert.crt\",\nOptions = #{\n        hostname =\u003e \"localhost.example.com\",\n        servername =\u003e \"MyServerName\"\n    },\nok = zotonic_ssl_certs:ensure_self_signed(CertFile, PemFile, Options).\n```\n\nThe hostname and the servername default to the hostname returned by `inet:gethostname/0`.\n\n\n### Ensure self-signed certificates\n\nSimilar to generating, except that this routine does nothing if the files already exist.\n\n```\nok = zotonic_ssl_certs:ensure_self_signed(CertFile, PemFile, Options).\n```\n\n### Decode a certificate\n\nExtract some information from a certificate.\n\n```erlang\n{ok, Map} = decode_cert(\"path/to/cert.crt\").\n```\n\nKeys returned:\n\n * `not_after` Erlang DateTime with the expiration date (Validity)\n * `common_name` The CN (aka the hostname) for the certificate\n * `subject_alt_names` A list of alternative names the certificate is valid for (SANs)\n\n\n## Write a DH file\n\nThe `zotonic_ssl_dhfile` routines handle the creation of DH (aka DHE) files.\nYou can select from a couple of predefined DH files.\n\n### Generate a DH file\n\n```erlang\nok = zotonic_ssl_dhfile:ensure_dhfile(\"path/to/myfile.dh\").\n```\n\nThis ensures that the path is created and that the DH file is written.\nIt defaults to the `ffdhe3072` DH group.\n\nThe following DH groups are possible: `ffdhe2048`, `ffdhe3072`, `ffdhe4096`\n\nTo generate with a specific DH group:\n\n```erlang\nok = zotonic_ssl_dhfile:ensure_dhfile(\"path/to/myfile.dh\", ffdhe2048).\n```\n\nOr, if no check on the existance of a valid DH file is needed:\n\n```erlang\nok = zotonic_ssl_dhfile:write_dhfile(\"path/to/myfile.dh\").\n```\n\nor\n\n```erlang\nok = zotonic_ssl_dhfile:write_dhfile(\"path/to/myfile.dh\", ffdhe2048).\n```\n\n\n## License\n\nThe Apache License v2.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzotonic%2Fzotonic_ssl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzotonic%2Fzotonic_ssl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzotonic%2Fzotonic_ssl/lists"}