# class OpenSSL::SSL::Context::Client

- OpenSSL::SSL::Context::Client
- OpenSSL::SSL::Context
- Reference
- Object

##
Defined in:

##
Constructors

- .from_hash(params) : self

  Configures a client context from a hash-like interface.

- .insecure(method : LibSSL::SSLMethod = Context.default_method) : self

  Returns a new TLS client context with only the given method set.

- .new(method : LibSSL::SSLMethod = Context.default_method)

### Instance methods inherited from class `OpenSSL::SSL::Context`

add_modes(mode : OpenSSL::SSL::Modes) add_modes, add_options(options : OpenSSL::SSL::Options) add_options, add_x509_verify_flags(flags : OpenSSL::X509VerifyFlags) add_x509_verify_flags, alpn_protocol=(protocol : String) alpn_protocol=, ca_certificates=(file_path : String) ca_certificates=, ca_certificates_path=(dir_path : String) ca_certificates_path=, certificate_chain=(file_path : String) certificate_chain=, ciphers=(ciphers : String) ciphers=, default_verify_param=(name : String) default_verify_param=, finalize finalize, modes modes, options options, private_key=(file_path : String) private_key=, remove_modes(mode : OpenSSL::SSL::Modes) remove_modes, remove_options(options : OpenSSL::SSL::Options) remove_options, set_default_verify_paths set_default_verify_paths, set_tmp_ecdh_key(curve = LibCrypto::NID_X9_62_prime256v1) set_tmp_ecdh_key, to_unsafe : LibSSL::SSLContext to_unsafe, verify_mode verify_mode, verify_mode=(mode : OpenSSL::SSL::VerifyMode) verify_mode=

### Instance methods inherited from class `Reference`

==(other : self)
==(other : JSON::Any)
==(other : YAML::Any)
==(other) ==, dup dup, hash(hasher) hash, inspect(io : IO) : Nil inspect, object_id : UInt64 object_id, pretty_print(pp) : Nil pretty_print, same?(other : Reference)
same?(other : Nil) same?, to_s(io : IO) : Nil to_s

### Constructor methods inherited from class `Reference`

new new

### Instance methods inherited from class `Object`

!=(other) !=, !~(other) !~, ==(other) ==, ===(other : JSON::Any)
===(other : YAML::Any)
===(other) ===, =~(other) =~, __crystal_pseudo_! : Bool __crystal_pseudo_!, __crystal_pseudo_as(type : Class) __crystal_pseudo_as, __crystal_pseudo_as?(type : Class) __crystal_pseudo_as?, __crystal_pseudo_is_a?(type : Class) : Bool __crystal_pseudo_is_a?, __crystal_pseudo_nil? : Bool __crystal_pseudo_nil?, __crystal_pseudo_responds_to?(name : Symbol) : Bool __crystal_pseudo_responds_to?, class class, dup dup, hash(hasher)
hash hash, inspect : String
inspect(io : IO) : Nil inspect, itself itself, not_nil! not_nil!, pretty_inspect(width = 79, newline = "\n", indent = 0) : String pretty_inspect, pretty_print(pp : PrettyPrint) : Nil pretty_print, tap(&) tap, to_json(io : IO)
to_json to_json, to_pretty_json(indent : String = " ")
to_pretty_json(io : IO, indent : String = " ") to_pretty_json, to_s : String
to_s(io : IO) : Nil to_s, to_yaml(io : IO)
to_yaml to_yaml, try(&) try, unsafe_as(type : T.class) forall T unsafe_as

### Class methods inherited from class `Object`

from_json(string_or_io, root : String)
from_json(string_or_io) from_json, from_yaml(string_or_io : String | IO) from_yaml

##
Constructor Detail

def self.from_hash(params) : self #

Configures a client context from a hash-like interface.

    require "openssl"

    context = OpenSSL::SSL::Context::Client.from_hash({"key" => "private.key", "cert" => "certificate.crt", "ca" => "ca.pem"})

Params:

- `key` (required): Path to private key file. See `#private_key=`.
- `cert` (required): Path to the file containing the public certificate chain. See `#certificate_chain=`.
- `verify_mode`: Either `peer`, `force-peer`, `none` or empty (default: `peer`). See `verify_mode=`.
- `ca`: Path to a file containing the CA certificate chain or a directory containing all CA certificates. See `#ca_certificates=` and `#ca_certificates_path=`, respectively. Required if `verify_mode` is `peer`, `force-peer` or empty.

def self.insecure(method : LibSSL::SSLMethod = Context.default_method) : self #

Returns a new TLS client context with only the given method set.

For everything else this uses the defaults of your OpenSSL. Use this only if undoing the defaults that `.new` sets is too much hassle.

def self.new(method : LibSSL::SSLMethod = Context.default_method) #