View Source mix x509.gen.selfsigned (X509 v0.8.8)

Generates a self-signed certificate for testing.

mix x509.gen.selfsigned
mix x509.gen.selfsigned my-app my-app.local my-app.internal.example.com

Creates a private key and a self-signed certificate in PEM format. These files can be referenced in the certfile and keyfile parameters of an :ssl server.

WARNING: only use the generated certificate for testing in a closed network environment, such as running a development server on localhost. For production, staging, or testing servers on the public internet, obtain a proper certificate, for example from Let's Encrypt.

NOTE: when using Google Chrome, open chrome://flags/#allow-insecure-localhost to enable the use of self-signed certificates on localhost.

arguments

Arguments

The list of hostnames, if none are specified, defaults to:

  • localhost

Other (optional) arguments:

  • --output (-o): the path and base filename for the certificate and key (default: priv/cert/selfsigned)
  • --name (-n): the Common Name value in certificate's subject (default: "Self-signed test certificate")
    • --force (-f): overwrite existing files without prompting for confirmation

Requires OTP 20 or later.