Skip to content

ssl: add SSLSocket#peer_signature_digest_name, #peer_signature_name, #group_name #908

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

junaruga
Copy link
Member

@rhenium This PR is related to #894 - Add features to get the following data from a TLS client.

  • Peer signing digest
  • Peer signature type
  • Negotiated TLS1.3 group

Note I added the #include <openssl/obj_mac.h> for NID_undef and #include <openssl/objects.h> for the OBJ_nid2sn().

I am not sure about the best location where I should put these new logic, the functions and unit tests in the files. I would appreciate if you tell me the best location.

You can also just cherry-pick this PR or refer to this PR or create your new PR.

Could you review the PR? Thank you!

assert_equal('X25519MLKEM768', ssl.group_name)
else
assert_equal('x25519', ssl.group_name)
end
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note I am investigating which commit between the OpenSSL 3.5 and 3.4 made this change in the SSL_get0_group_name(). I haven't found the change in the OpenSSL documents.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can force one with SSLContext#groups= now. Perhaps you can just add assertions in the existing tests for it?

@junaruga junaruga force-pushed the wip/ssl-client-data branch from 45025e0 to b13cd03 Compare July 11, 2025 17:10
GetSSL(self, ssl);
if (!SSL_get0_peer_signature_name(ssl, &name))
return Qnil;
return rb_str_new2(name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return rb_str_new2(name);
return rb_str_new_cstr(name);

new2 is a soft-deprecated macro for this function.

@rhenium
Copy link
Member

rhenium commented Jul 11, 2025

Honestly, I'm not so sure if there are actual demand for these methods, though I have no objection to adding them if they turn out to be useful.

SSLSocket#peer_signature_digest_name seems redundant if we also add #peer_signature_name.

Re #peer_signature_name, do we also want the local-side counterpart (SSL_get0_signature_name())? Also, should we use "sigalg" instead, to match SSLContext#{,client_}sigalgs? Alternatively, maybe we should rename those to use "signatures".

[BTW, the peer/local split in the getter functions is a pity, since the methods (the corresponding OpenSSL API) for setting the allowed signature algorithms use the server/client split instead.]

As for #group_name, I think just #group is fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants