Module zotonic_ssl_certs

SSL support functions, create self-signed certificates.

Copyright © 2012-2020 Marc Worrell, Maas-Maarten Zeeman

Authors: Marc Worrell (marc@worrell.nl), Maas-Maarten Zeeman (mmzeeman@xs4all.nl).

Description

SSL support functions, create self-signed certificates

Data Types

options()

options() = #{hostname => string() | binary(), servername => string() | binary()}

Function Index

check_keyfile/1Check if the file contains a valid private key.
ciphers/0Return the list of ciphers for http connections.
decode_cert/1Decode a certificate file, return map with 'common_name', 'subject_alt_names' and 'not_after'.
ensure_self_signed/3Check if all certificates are available in the site's ssl directory.
generate_self_signed/3Generate a self signed certificate with the hostname and servername in the options.
normalize_hostname/1Normalize a hostname, filters invalid characters and lowercases the all alphabetic characters.

Function Details

check_keyfile/1

check_keyfile(Filename::file:filename_all()) -> ok | {error, Reason}

Check if the file contains a valid private key.

ciphers/0

ciphers() -> [string()]

Return the list of ciphers for http connections.

decode_cert/1

decode_cert(CertFile::file:filename_all()) -> {ok, map()} | {error, not_a_certificate}

Decode a certificate file, return map with 'common_name', 'subject_alt_names' and 'not_after'.

ensure_self_signed/3

ensure_self_signed(CertFile::file:filename_all(), PemFile::file:filename_all(), Options::options()) -> ok | {error, term()}

Check if all certificates are available in the site's ssl directory

generate_self_signed/3

generate_self_signed(CertFile::file:filename_all(), PemFile::file:filename_all(), Options::options()) -> ok | {error, term()}

Generate a self signed certificate with the hostname and servername in the options. The hostname and servername both default to inet:gethostname/0. The key is generated in the PemFile and the certificate in the CertFile. If the directory of the PemFile does not exist then it is created.

normalize_hostname/1

normalize_hostname(Hostname::binary() | string()) -> string()

Normalize a hostname, filters invalid characters and lowercases the all alphabetic characters.


Generated by EDoc