@@ -2644,6 +2644,68 @@ ossl_ssl_tmp_key(VALUE self)
26442644 return Qnil ;
26452645 return ossl_pkey_new (key );
26462646}
2647+
2648+ #ifdef HAVE_SSL_GET0_PEER_SIGNATURE_NAME
2649+ /*
2650+ * call-seq:
2651+ * ssl.sigalg => String or nil
2652+ *
2653+ * Returns the signature algorithm name, the IANA name of the signature scheme
2654+ * used by the local to sign the TLS handshake.
2655+ */
2656+ static VALUE
2657+ ossl_ssl_get_sigalg (VALUE self )
2658+ {
2659+ SSL * ssl ;
2660+ const char * name ;
2661+
2662+ GetSSL (self , ssl );
2663+ if (!SSL_get0_signature_name (ssl , & name ))
2664+ return Qnil ;
2665+ return rb_str_new_cstr (name );
2666+ }
2667+
2668+ /*
2669+ * call-seq:
2670+ * ssl.peer_sigalg => String or nil
2671+ *
2672+ * Returns the signature algorithm name, the IANA name of the signature scheme
2673+ * used by the peer to sign the TLS handshake.
2674+ */
2675+ static VALUE
2676+ ossl_ssl_get_peer_sigalg (VALUE self )
2677+ {
2678+ SSL * ssl ;
2679+ const char * name ;
2680+
2681+ GetSSL (self , ssl );
2682+ if (!SSL_get0_peer_signature_name (ssl , & name ))
2683+ return Qnil ;
2684+ return rb_str_new_cstr (name );
2685+ }
2686+ #endif
2687+
2688+ #ifdef HAVE_SSL_GET0_GROUP_NAME
2689+ /*
2690+ * call-seq:
2691+ * ssl.group => String or nil
2692+ *
2693+ * Returns the name of the group that was used for the key agreement of the
2694+ * current TLS session establishment.
2695+ */
2696+ static VALUE
2697+ ossl_ssl_get_group (VALUE self )
2698+ {
2699+ SSL * ssl ;
2700+ const char * name ;
2701+
2702+ GetSSL (self , ssl );
2703+ if (!(name = SSL_get0_group_name (ssl )))
2704+ return Qnil ;
2705+ return rb_str_new_cstr (name );
2706+ }
2707+ #endif
2708+
26472709#endif /* !defined(OPENSSL_NO_SOCK) */
26482710
26492711void
@@ -3067,6 +3129,13 @@ Init_ossl_ssl(void)
30673129# ifdef OSSL_USE_NEXTPROTONEG
30683130 rb_define_method (cSSLSocket , "npn_protocol" , ossl_ssl_npn_protocol , 0 );
30693131# endif
3132+ #ifdef HAVE_SSL_GET0_PEER_SIGNATURE_NAME
3133+ rb_define_method (cSSLSocket , "sigalg" , ossl_ssl_get_sigalg , 0 );
3134+ rb_define_method (cSSLSocket , "peer_sigalg" , ossl_ssl_get_peer_sigalg , 0 );
3135+ #endif
3136+ #ifdef HAVE_SSL_GET0_GROUP_NAME
3137+ rb_define_method (cSSLSocket , "group" , ossl_ssl_get_group , 0 );
3138+ #endif
30703139
30713140 rb_define_const (mSSL , "VERIFY_NONE" , INT2NUM (SSL_VERIFY_NONE ));
30723141 rb_define_const (mSSL , "VERIFY_PEER" , INT2NUM (SSL_VERIFY_PEER ));
0 commit comments