Skip to content

Add 'sigalgs=' method for setting accepted signature algorithms #769

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

Closed
wants to merge 3 commits into from

Conversation

mj-vivavis
Copy link

This adds OpenSSL::SSL::SSLContext#sigalgs= method and according unit tests to provide access to the OpenSSL SSL_CTX_set1_sigalgs_list() method. Using this method, the enabled/supported signature algorithms for client/server authentication can be configured.

@mj-vivavis mj-vivavis marked this pull request as draft June 17, 2024 15:18
This adds OpenSSL::SSL::SSLContext#sigalgs= method and according unit tests
to provide access to the OpenSSL SSL_CTX_set1_sigalgs_list() method.
Using this method, authentication signature algorithms can be configured.
@mj-vivavis mj-vivavis force-pushed the add-sigalgs-support branch from 8e538fd to 206e431 Compare June 17, 2024 15:46
@mj-vivavis mj-vivavis marked this pull request as ready for review June 17, 2024 15:48
SSL_CTX *ctx;

if (NIL_P(v))
return v;
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't ssl_ctx.sigalgs = nil be an error (i.e., do nothing and let StringValueCStr() raise TypeError)?

Copy link
Author

Choose a reason for hiding this comment

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

Maybe yes, since one most likely did not expect this to be a no-op. I originally decided to implement it consistent to ctx.ciphersuites = nil, which also silently ignores an nil-Argument.

Copy link
Member

Choose a reason for hiding this comment

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

Good catch... ctx.ciphersuites = nil doesn't seem right either.

Comment on lines +1754 to +1760
def test_sigalgs_method_valid_sigalgs
ssl_ctx = OpenSSL::SSL::SSLContext.new
pend 'sigalgs= method is missing' unless ssl_ctx.respond_to?(:sigalgs=)

ssl_ctx.freeze
assert_raise(FrozenError) { ssl_ctx.sigalgs = '"ECDSA+SHA256:RSA+SHA256"' }
end
Copy link
Member

Choose a reason for hiding this comment

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

This seems unfinished - was it supposed to be the successful path?

There should be a test case that involves an actual TLS session with start_server.

@@ -195,6 +195,7 @@ def find_openssl_library
have_func("EVP_PKEY_check(NULL)", evp_h)
have_func("EVP_PKEY_new_raw_private_key(0, NULL, (unsigned char *)\"\", 0)", evp_h)
have_func("SSL_CTX_set_ciphersuites(NULL, \"\")", ssl_h)
have_func("SSL_CTX_set1_sigalgs(NULL, NULL, 0L)", ssl_h)
Copy link
Member

Choose a reason for hiding this comment

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

Please check SSL_CTX_set1_sigalgs_list() (with _list) as it is the function used in ossl_ssl.c.

@junaruga
Copy link
Member

junaruga commented Jun 3, 2025

Hi @mj-vivavis, I hope you are doing well. Could you rebase this PR on the latest master branch and check the review comments? I want to see the support of the OpenSSL::SSL::SSLContext#sigalgs=. Thank you.

@rhenium
Copy link
Member

rhenium commented Jun 3, 2025

Please see #895

@rhenium rhenium closed this Jun 3, 2025
@junaruga
Copy link
Member

junaruga commented Jun 3, 2025

Please see #895

I would appreciate your work!

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.

3 participants