An SSL::Context
represents a generic secure socket protocol configuration.
For both server and client applications exist more specialized subclassses SSL::Context::Server
and SSL::Context::Client
which need to be instantiated appropriately.
"TLS_AES_128_GCM_SHA256 TLS_AES_256_GCM_SHA384 TLS_CHACHA20_POLY1305_SHA256 ECDHE-ECDSA-AES128-GCM-SHA256 ECDHE-RSA-AES128-GCM-SHA256 ECDHE-ECDSA-AES256-GCM-SHA384 ECDHE-RSA-AES256-GCM-SHA384 ECDHE-ECDSA-CHACHA20-POLY1305 ECDHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES128-GCM-SHA256 DHE-RSA-AES256-GCM-SHA384 !RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS"
The list of secure ciphers on intermediate compatibility level as per Mozilla recommendations.
The oldest clients supported by this configuration are:
This list represents version 5.4 of the intermediate configuration available at https://ssl-config.mozilla.org/guidelines/5.4.json.
See https://wiki.mozilla.org/Security/Server_Side_TLS for details.
"TLS_AES_128_GCM_SHA256 TLS_AES_256_GCM_SHA384 TLS_CHACHA20_POLY1305_SHA256 !RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS"
The list of secure ciphers on modern compatibility level as per Mozilla recommendations.
The oldest clients supported by this configuration are:
This list represents version 5.4 of the modern configuration available at https://ssl-config.mozilla.org/guidelines/5.4.json.
See https://wiki.mozilla.org/Security/Server_Side_TLS for details.
"TLS_AES_128_GCM_SHA256 TLS_AES_256_GCM_SHA384 TLS_CHACHA20_POLY1305_SHA256 ECDHE-ECDSA-AES128-GCM-SHA256 ECDHE-RSA-AES128-GCM-SHA256 ECDHE-ECDSA-AES256-GCM-SHA384 ECDHE-RSA-AES256-GCM-SHA384 ECDHE-ECDSA-CHACHA20-POLY1305 ECDHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES128-GCM-SHA256 DHE-RSA-AES256-GCM-SHA384 DHE-RSA-CHACHA20-POLY1305 ECDHE-ECDSA-AES128-SHA256 ECDHE-RSA-AES128-SHA256 ECDHE-ECDSA-AES128-SHA ECDHE-RSA-AES128-SHA ECDHE-ECDSA-AES256-SHA384 ECDHE-RSA-AES256-SHA384 ECDHE-ECDSA-AES256-SHA ECDHE-RSA-AES256-SHA DHE-RSA-AES128-SHA256 DHE-RSA-AES256-SHA256 AES128-GCM-SHA256 AES256-GCM-SHA384 AES128-SHA256 AES256-SHA256 AES128-SHA AES256-SHA DES-CBC3-SHA !RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS"
The list of secure ciphers on old compatibility level as per Mozilla recommendations.
The oldest clients supported by this configuration are:
This list represents version 5.4 of the old configuration available at https://ssl-config.mozilla.org/guidelines/5.4.json.
See https://wiki.mozilla.org/Security/Server_Side_TLS for details.
Adds modes to the TLS context.
Adds options to the TLS context.
Sets the given OpenSSL::X509VerifyFlags
in this context, additionally to the already set ones.
Specifies an ALPN protocol to negotiate with the remote endpoint.
Sets the path to a file containing all CA certificates, in PEM format, used to validate the peers certificate.
Sets the path to a directory containing all CA certificates used to validate the peers certificate.
Specify the path to the certificate chain file to use.
Specify a list of TLS ciphers to use or discard.
Sets this context verify param to the default one of the given name.
Returns the current modes set on the TLS context.
Returns the current options set on the TLS context.
Specify the path to the private key to use.
Removes modes from the TLS context.
Removes options from the TLS context.
Sets the default paths for ca_certiifcates=
and #ca_certificates_path=
.
Adds a temporary ECDH key curve to the TLS context.
Returns the current verify mode.
Sets the verify mode.
Reference
Reference
Object
Object
Adds modes to the TLS context.
Adds options to the TLS context.
Example:
context.add_options( OpenSSL::SSL::Options::ALL | # various workarounds OpenSSL::SSL::Options::NO_SSL_V2 | # disable overly deprecated SSLv2 OpenSSL::SSL::Options::NO_SSL_V3 # disable deprecated SSLv3 )
Sets the given OpenSSL::X509VerifyFlags
in this context, additionally to the already set ones.
Specifies an ALPN protocol to negotiate with the remote endpoint. This is required to negotiate HTTP/2 with browsers, since browser vendors decided not to implement HTTP/2 over insecure connections.
Example:
context.alpn_protocol = "h2"
Sets the path to a file containing all CA certificates, in PEM format, used to validate the peers certificate.
Sets the path to a directory containing all CA certificates used to validate the peers certificate. The certificates should be in PEM format and the c_rehash(1)
utility must have been run in the directory.
Specify the path to the certificate chain file to use. In server mode this is presented to the client, in client mode this used as client certificate.
Specify a list of TLS ciphers to use or discard.
This affects only TLSv1.2 and below.
Sets this context verify param to the default one of the given name.
Depending on the OpenSSL version, the available defaults are default
, pkcs7
, smime_sign
, ssl_client
and ssl_server
.
Returns the current modes set on the TLS context.
Returns the current options set on the TLS context.
Specify the path to the private key to use. The key must in PEM format. The key must correspond to the entity certificate set by #certificate_chain=
.
Removes modes from the TLS context.
Removes options from the TLS context.
Example:
context.remove_options(OpenSSL::SSL::Options::NO_SSL_V3)
Sets the default paths for ca_certiifcates=
and #ca_certificates_path=
.
Adds a temporary ECDH key curve to the TLS context. This is required to enable the EECDH cipher suites. By default the prime256 curve will be used.
Returns the current verify mode. See the SSL_CTX_set_verify(3)
manpage for more details.
Sets the verify mode. See the SSL_CTX_set_verify(3)
manpage for more details.
© 2012–2020 Manas Technology Solutions.
Licensed under the Apache License, Version 2.0.
https://crystal-lang.org/api/0.35.1/OpenSSL/SSL/Context.html