@@ -7856,6 +7856,46 @@ module OpenSSL
7856
7856
# be frozen afterward.
7857
7857
#
7858
7858
class SSLContext
7859
+ type context_params = {
7860
+ ?alpn_protocols=: Array[String]?,
7861
+ ?alpn_select_cb=: (^(Array[String]) -> String?)?,
7862
+ ?keylog_cb=,
7863
+ ?ssl_timeout=: timeout?,
7864
+ ?ciphers=: Array[String]?,
7865
+ ?ciphersuites=,
7866
+ ?tmp_dh=: (^(Session, Integer, Integer) -> PKey::DH)?,
7867
+ ?tmp_dh_callback=(^(Session, Integer, Integer) -> PKey::DH)?,
7868
+ ?ecdh_curves=: String?,
7869
+ ?security_level=: Integer?,
7870
+ ?key=: PKey::PKey?,
7871
+ ?session_cache_mode=: Integer?,
7872
+ ?session_cache_size=: Integer?,
7873
+ ?timeout=: Integer?,
7874
+ ?options=: Integer?,
7875
+ ?servername_cb=: (^(SSLSocket, String) -> SSLContext?)?,
7876
+ ?min_version=: tls_version?,
7877
+ ?max_version=: tls_version?,
7878
+ ?cert=: X509::Certificate?,
7879
+ ?client_ca=: Array[X509::Certificate] | X509::Certificate | nil ,
7880
+ ?ca_file=: String?,
7881
+ ?ca_path=: String?,
7882
+ ?verify_mode=: verify_mode?,
7883
+ ?verify_depth=: Integer?,
7884
+ ?verify_callback=: (^(bool preverify_ok, StoreContext store_ctx) -> boolish)?,
7885
+ ?ssl_version=: tls_version?,
7886
+ ?verify_hostname=: boolish?,
7887
+ ?cert_store=: X509::Store?,
7888
+ ?extra_chain_cert=: Array[X509::Certificate]?,
7889
+ ?client_cert_cb=: (^(Session) -> [ X509::Certificate, PKey::PKey ]??,
7890
+ ?session_id_context=: Integer?,
7891
+ ?session_get_cb=: (^(SSLSocket, Integer) -> Session?)?,
7892
+ ?session_new_cb=: (^(SSLSocket) -> untyped )?,
7893
+ ?session_remove_cb=: (^(SSLContext, Session) -> void )?,
7894
+ ?renegotiation_cb=: (^(SSLSocket) -> void )?,
7895
+ ?npn_protocols=: Array[String]?,
7896
+ ?npn_select_cb=: (^(Array[String]) -> String?)?
7897
+ }
7898
+
7859
7899
public
7860
7900
7861
7901
# <!--
@@ -8183,7 +8223,7 @@ module OpenSSL
8183
8223
#
8184
8224
# ctx.npn_protocols = ["http/1.1", "spdy/2"]
8185
8225
#
8186
- def npn_protocols : () -> untyped
8226
+ def npn_protocols : () -> Array[String]?
8187
8227
8188
8228
# <!-- rdoc-file=ext/openssl/ossl_ssl.c -->
8189
8229
# An Enumerable of Strings. Each String represents a protocol to be advertised
@@ -8195,7 +8235,7 @@ module OpenSSL
8195
8235
#
8196
8236
# ctx.npn_protocols = ["http/1.1", "spdy/2"]
8197
8237
#
8198
- def npn_protocols= : (untyped ) -> untyped
8238
+ def npn_protocols= : (Array[String]? protos ) -> Array[String]
8199
8239
8200
8240
# <!-- rdoc-file=ext/openssl/ossl_ssl.c -->
8201
8241
# A callback invoked on the client side when the client needs to select a
@@ -8213,7 +8253,7 @@ module OpenSSL
8213
8253
# protocols.first
8214
8254
# end
8215
8255
#
8216
- def npn_select_cb : () -> untyped
8256
+ def npn_select_cb : () -> (^(Array[String]) -> String? | nil )
8217
8257
8218
8258
# <!-- rdoc-file=ext/openssl/ossl_ssl.c -->
8219
8259
# A callback invoked on the client side when the client needs to select a
@@ -8231,7 +8271,7 @@ module OpenSSL
8231
8271
# protocols.first
8232
8272
# end
8233
8273
#
8234
- def npn_select_cb= : (untyped ) -> untyped
8274
+ def npn_select_cb= : (^(Array[String] ) -> String? alpn_select_callback) -> void
8235
8275
8236
8276
# <!--
8237
8277
# rdoc-file=ext/openssl/ossl_ssl.c
@@ -8414,7 +8454,20 @@ module OpenSSL
8414
8454
# : Number of sessions proposed by clients that were found in the cache but
8415
8455
# had expired due to timeouts
8416
8456
#
8417
- def session_cache_stats : () -> Hash[Symbol, Integer]
8457
+ def session_cache_stats : () -> {
8458
+ accept: Integer,
8459
+ accept_good: Integer,
8460
+ accept_renegotiate: Integer,
8461
+ cache_full: Integer,
8462
+ cache_hits: Integer,
8463
+ cache_misses: Integer,
8464
+ cache_num: Integer,
8465
+ cb_hits: Integer,
8466
+ connect: Integer,
8467
+ connect_good: Integer,
8468
+ connect_renegotiate: Integer,
8469
+ timeouts: Integer
8470
+ }
8418
8471
8419
8472
# <!-- rdoc-file=ext/openssl/ossl_ssl.c -->
8420
8473
# A callback invoked on a server when a session is proposed by the client but
@@ -8504,7 +8557,7 @@ module OpenSSL
8504
8557
# If the verify_mode is not VERIFY_NONE and ca_file, ca_path and cert_store are
8505
8558
# not set then the system default certificate store is used.
8506
8559
#
8507
- def set_params : (? untyped params) -> untyped
8560
+ def set_params : (context_params params) -> untyped
8508
8561
8509
8562
# <!--
8510
8563
# rdoc-file=ext/openssl/ossl_ssl.c
@@ -8689,7 +8742,7 @@ module OpenSSL
8689
8742
8690
8743
DEFAULT_CERT_STORE: X509::Store
8691
8744
8692
- DEFAULT_PARAMS: Hash[Symbol, untyped ]
8745
+ DEFAULT_PARAMS: context_params
8693
8746
8694
8747
DEFAULT_TMP_DH_CALLBACK: Proc
8695
8748
0 commit comments