### Install CertMagex for Cowboy Source: https://hexdocs.pm/certmagex/CertMagex.html Add this configuration to your prod.exs for Cowboy. Ensure HTTP is commented out and port 80 is free. ```elixir config , , # ATTENTION: Ensure you comment http: out and port 80 is free! https: [port: 443, sni_fun: &CertMagex.sni_fun/1], ... ``` -------------------------------- ### Install CertMagex for Bandit Source: https://hexdocs.pm/certmagex/CertMagex.html Add this configuration to your prod.exs for Bandit. Ensure HTTP is commented out and port 80 is free. ```elixir config , , # ATTENTION: Ensure you comment http: out and port 80 is free! https: [port: 443, thousand_island_options: [transport_options: [sni_fun: &CertMagex.sni_fun/1]]], ... ``` -------------------------------- ### Get SSL Options for Domain Source: https://hexdocs.pm/certmagex/CertMagex.html Returns the SSL options for a given domain, useful for IP-based SSL certificates. Generates `[cert: cert, key: key]` for merging into existing SSL options. ```elixir ssl_opts(domain) ``` -------------------------------- ### SNI Function for Configuration Source: https://hexdocs.pm/certmagex/CertMagex.html The SNI function to be used in your Phoenix or Cowboy configuration. Example provided for Cowboy. ```elixir sni_fun(domain) ``` -------------------------------- ### Generate Certificate with ACMEv2 (Zerossl) Source: https://hexdocs.pm/certmagex/CertMagex.Acmev2.html Generates a certificate for a given domain using the ACMEv2 protocol. Supports Zerossl, LetsEncrypt, and LetsEncrypt_test. Zerossl requires EAB credentials, which can be provided via email or account key. The function uses HTTP-01 challenge and returns the private key and certificate. ```Elixir @spec gen_cert(domain :: binary()) :: {key :: binary(), cert :: binary()} ``` -------------------------------- ### ssl_opts/1 Source: https://hexdocs.pm/certmagex/CertMagex.html Returns the SSL options for the given domain. This is useful for IP based SSL certificates. ```APIDOC ## ssl_opts(domain) ### Description Returns the SSL options for the given domain. This is useful for IP based SSL certificates. Info: https://letsencrypt.org/2026/01/15/6day-and-ip-general-availability This will generate `[cert: cert, key: key]` that can merged into your existing SSL options. ### Function Signature ssl_opts(domain) ``` -------------------------------- ### cert_print(cert) Source: https://hexdocs.pm/certmagex/CertMagex.Acmev2.html Prints the content of a certificate. ```APIDOC ## cert_print(cert) ### Description Prints a certificate's content. ### Method (Not specified, likely a function call in a programming language) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```elixir cert_print(certificate_binary) ``` ### Response (No specific response format detailed, implies printing to standard output) #### Success Response (No specific success response detailed) #### Response Example (No specific example provided) ``` -------------------------------- ### insert/2 Source: https://hexdocs.pm/certmagex/CertMagex.html Insert a certificate into the cache. Automatically detects all domains in the certificate. ```APIDOC ## insert(cert_priv_key, public_cert) ### Description Insert a certificate into the cache. Automatically detects all domains in the certificate. ### Function Signature insert(cert_priv_key, public_cert) ``` -------------------------------- ### insert(cert_priv_key, public_cert) Source: https://hexdocs.pm/certmagex/index.html Insert a certificate into the cache. Automatically detects all domains in the certificate. ```APIDOC ## insert(cert_priv_key, public_cert) ### Description Insert a certificate into the cache. Automatically detects all domains in the certificate. ### Parameters #### Path Parameters - **cert_priv_key** (string) - Required - The private key of the certificate. - **public_cert** (string) - Required - The public certificate. ### Request Example ```elixir CertMagex.insert("-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----", "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----") ``` ### Response #### Success Response (200) - **:ok** (atom) - Indicates successful insertion. ``` -------------------------------- ### gen_cert(domain) Source: https://hexdocs.pm/certmagex/CertMagex.Acmev2.html Generates a certificate through the ACMEv2 protocol for the specified domain. Supports Zerossl, LetsEncrypt, and LetsEncrypt test providers. For Zerossl, EAB credentials are required and can be configured via email or account key. The function uses HTTP-01 challenge by opening a listening socket on port 80. ```APIDOC ## gen_cert(domain) ### Description Generates a certificate through ACMEv2 protocol for the specified domain. ### Method (Not specified, likely a function call in a programming language) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```elixir gen_cert("example.com") ``` ### Response #### Success Response - **key** (binary) - The generated private key. - **cert** (binary) - The generated certificate. #### Response Example ```elixir {<<1:1024>>, <<1:2048>>} ``` ``` -------------------------------- ### insert(domain, cert_priv_key, public_cert) Source: https://hexdocs.pm/certmagex/index.html Insert a certificate into the cache for a specific domain. ```APIDOC ## insert(domain, cert_priv_key, public_cert) ### Description Insert a certificate into the cache for a specific domain. ### Parameters #### Path Parameters - **domain** (string) - Required - The domain for which to insert the certificate. - **cert_priv_key** (string) - Required - The private key of the certificate. - **public_cert** (string) - Required - The public certificate. ### Request Example ```elixir CertMagex.insert("example.com", "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----", "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----") ``` ### Response #### Success Response (200) - **:ok** (atom) - Indicates successful insertion. ``` -------------------------------- ### insert/3 Source: https://hexdocs.pm/certmagex/CertMagex.html Insert a certificate into the cache for a specific domain. ```APIDOC ## insert(domain, cert_priv_key, public_cert) ### Description Insert a certificate into the cache for a specific domain. ### Function Signature insert(domain, cert_priv_key, public_cert) ``` -------------------------------- ### Insert Certificate into Cache Source: https://hexdocs.pm/certmagex/CertMagex.html Use this function to insert a certificate into the cache. It automatically detects all domains within the certificate. ```elixir insert(cert_priv_key, public_cert) ``` -------------------------------- ### ip?(domain) Source: https://hexdocs.pm/certmagex/index.html Returns true if the given string is a valid IPv4 or IPv6 address. ```APIDOC ## ip?(domain) ### Description Returns true if the given string is a valid IPv4 or IPv6 address. ### Parameters #### Path Parameters - **domain** (string) - Required - The string to check. ### Request Example ```elixir CertMagex.ip?("192.168.1.1") CertMagex.ip?("::1") ``` ### Response #### Success Response (200) - **boolean** - True if the string is a valid IP address, false otherwise. ``` -------------------------------- ### ip?/1 Source: https://hexdocs.pm/certmagex/CertMagex.html Returns true if the given string is a valid IPv4 or IPv6 address. ```APIDOC ## ip?(domain) ### Description Returns true if the given string is a valid IPv4 or IPv6 address. ### Function Signature ip?(domain) ``` -------------------------------- ### Insert Certificate for Specific Domain Source: https://hexdocs.pm/certmagex/CertMagex.html Use this function to insert a certificate into the cache for a particular domain. ```elixir insert(domain, cert_priv_key, public_cert) ``` -------------------------------- ### Check if IP Address Source: https://hexdocs.pm/certmagex/CertMagex.html Returns true if the provided string is a valid IPv4 or IPv6 address. ```elixir ip?(domain) ``` -------------------------------- ### sni_fun(domain) Source: https://hexdocs.pm/certmagex/index.html The SNI function to be used in your Phoenix or Cowboy configuration. ```APIDOC ## sni_fun(domain) ### Description The SNI function to be used in your Phoenix or Cowboy configuration. ### Parameters #### Path Parameters - **domain** (string) - Required - The domain for which to get the SNI function. ### Usage Example For Cowboy add this to your prod.exs: ```elixir config , , # ATTENTION: Ensure you comment http: out and port 80 is free! https: [port: 443, sni_fun: &CertMagex.sni_fun/1], ...copy ``` ### Response #### Success Response (200) - **function** - The SNI function. ``` -------------------------------- ### jws_dec(data) Source: https://hexdocs.pm/certmagex/CertMagex.Acmev2.html Prints the content of a JWS (JSON Web Signature). ```APIDOC ## jws_dec(data) ### Description Prints a JWS content. ### Method (Not specified, likely a function call in a programming language) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```elixir jws_dec(jws_data_binary) ``` ### Response (No specific response format detailed, implies printing to standard output) #### Success Response (No specific success response detailed) #### Response Example (No specific example provided) ``` -------------------------------- ### sni_fun/1 Source: https://hexdocs.pm/certmagex/CertMagex.html The SNI function to be used in your Phoenix or Cowboy configuration. ```APIDOC ## sni_fun(domain) ### Description The SNI function to be used in your Phoenix or Cowboy configuration. E.g. for Cowboy add this to your prod.exs: ```elixir config , , # ATTENTION: Ensure you comment http: out and port 80 is free! https: [port: 443, sni_fun: &CertMagex.sni_fun/1], ...copy ``` ### Function Signature sni_fun(domain) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.