A Scripting Language for Web, Linux and Windows

A Scripting Language for Web, Linux and Windows

Module: ssl

Support a wrapper for the following OpenSSL functions. The module must be loaded with dl('ssl');

See also examples SSL Client and HTTP/SSL Webserver.

  • SSL_CTX_new
  • SSL_CTX_free
  • SSL_CTX_set_tlsext_servername_callback
  • SSL_CTX_set_options
  • SSL_CTX_clear_options
  • SSL_CTX_get_options
  • SSL_CTX_set_cipher_list
  • SSL_CTX_load_verify_locations
  • SSL_CTX_use_certificate_chain_file
  • SSL_CTX_use_certificate_file
  • SSL_CTX_use_PrivateKey_file
  • SSL_CTX_check_private_key
  • SSL_new
  • SSL_free
  • SSL_set_cipher_list
  • SSL_get_cipher_list
  • SSL_set_verify_result
  • SSL_get_verify_result
  • SSL_set_fd
  • SSL_copy_session_id
  • SSL_accept
  • SSL_connect
  • SSL_read
  • SSL_write
  • SSL_get_peer_certificate
  • ERR_get_error
  • ERR_lib_error_string

Special helper functions, not part of OpenSSL.

Function/Arguments Return Description
SSL_CTX_load_cert (handle ctx, string certFilename, string keyFilename [, string keyPass]) bool Load certificate and private key file (PEM format) into OpenSSL context. Optional parameter password can be set for encrypted key files. On success true is returned.
SSL_create_selfsigned_cert (string certFilename, string keyFilename , string CN [, number lifetime=315360000, string sigType="sha256", number bits=2048]) bool Create a selfsigned certificate and private key file (RSA key, PEM format). CN is the common name and should be the host e.g. localhost. Optional parameter lifetime is the seconds from now the certificate is valid (default 10 years). Optional sigType can be a signature type from OpenSSL: md5, sha1, mdc2, sha224, sha256, sha384, sah512. bits set the RSA key bits (default 2048). On success true is returned and the certFilename and keyFilename are created.
SSL_FLAG (string name) number Return a OpenSSL constant by name used in SSL_CTX_set_options(), SSL_CTX_get_options(), SSL_CTX_clear_options(). See OpenSSL documentation.
SSL_gets (handle ssl) string Read a line until line break from ssl connection. On success the string is returned otherwise false is returned.
SSL_readln (handle ssl, string &line) bool Same as SSL_gets. Read a line from ssl connection. On success true is returned.

back to Home