Uh oh!
There was an error while loading. Please reload this page.
Add post-quantum cryptography (PQC) support to SSLConfig - #53
Conversation
junaruga
commented
Jul 29, 2026
I see the following CI failure. Let me fix it. https://github.com/ruby/drb/actions/runs/30444292244/job/90550763624?pr=53 |
Uh oh!
There was an error while loading. Please reload this page.
junaruga
commented
Jul 30, 2026
The cause of the CI failure was that https://github.com/ruby/openssl/blob/v2.2.0/History.md?plain=1#L72-L75 Now use And use the following logic in ML-DSA-NN case. |
I tested this PR in RubyCI's RHEL 9 and OpenBSD servers. In RHEL 9 server, I confirmed the tests passed. The ML-DSA tests are successfully omitted by In OpenBSD server, I confirmed the tests passed as well. The used OpenSSL version was In I was not sure if However, |
@seki or other maintainers, I updated notes section on the first comment. This PR is ready to review. I would appreciate your reviews. |
junaruga
commented
Jul 30, 2026
@rhenium I would appreciate your review for this PR as Ruby OpenSSL (openssl gem) maintainer. |
Uh oh!
There was an error while loading. Please reload this page.
junaruga
commented
Jul 31, 2026
I added and updated the code comments. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
rhenium
commented
Aug 1, 2026
I won't be the one deciding whether to merge this, but I'm not really convinced there's much value in being able to set up a server with multiple self-signed certificates. |
hsbt
commented
Aug 6, 2026
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| # Establish the OpenSSL::SSL::SSLContext with the configuration | ||
| # parameters provided. | ||
| def setup_ssl_context |
There was a problem hiding this comment.
Why do you want to make setup_ssl_context public? It's just for test? If so, we should not make it public. We can use __send__ in test.
There was a problem hiding this comment.
@kou I am waiting for your response on this topic.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
junaruga
commented
Aug 12, 2026
Sorry for my late response. Thanks for your reviews. I will check the reviews and fix for them. |
This commit fixes the following CI failures in Windows. I don't know why this change fixed. Perhaps Bundler's handling with git repository is different. https://github.com/ruby/drb/actions/runs/32029577375/job/95386338154?pr=54 ``` D:/a/drb/drb/test/lib/helper.rb:2:in 'Kernel#require': cannot load such file -- core_assertions (LoadError) from D:/a/drb/drb/test/lib/helper.rb:2:in '<top (required)>' from <internal:D:/rubyinstaller-head-x64/lib/ruby/4.1.0+4/rubygems/core_ext/kernel_require.rb>:139:in 'Kernel#require' rake aborted! Command failed with status (1) D:/a/drb/drb/vendor/bundle/ruby/4.1.0+4/gems/rake-13.4.2/exe/rake:27:in '<top (required)>' D:/rubyinstaller-head-x64/bin/bundle:33:in '<main>' Tasks: TOP => default => test (See full trace by running task with --trace) Error: Process completed with exit code 1. ```
OpenSSL::PKey::RSA#public_key is obsolete according to ruby/openssl#1092.
DRb::DRbSSLSocket::SSLConfig already works with pre-generated ML-DSA cert/key by
:SSLCertificate and :SSLPrivateKey config options.
This commit adds the following features in PQC use cases to #setup_certificate
and #setup_ssl_context.
* Add :SSLCertificates config option accepting an Array of
[certificate, private_key] pairs for multiple certificate
support via OpenSSL::SSL::SSLContext#add_certificate
changing from OpenSSL::SSL::SSLContext#cert and #key.
Because an SSL server that accepts clients with either ML-DSA-NN
or RSA certificates is useful in the use case of PQC migration from RSA
(non-PQC) to ML-DSA (PQC).
:SSLCertificate and :SSLPrivateKey are available for backward compatibility.
But use OpenSSL::SSL::SSLContext#add_certificate internally.
This is a behavior change.
* Add :SSLPrivateKeyAlgorithms option accepting an Array of key
algorithms (RSA, ML-DSA-44, ML-DSA-65, ML-DSA-87) for
multi-certificate generation, defaulting to ["RSA"] for backward
compatibility.
* Add :SSLGroups option to control key exchange group such as ML-KEM in PQC.
* Add :SSLSignatureAlgorithms, :SSLClientSignatureAlgorithms to control
signature algorithms such as ML-DSA-NN in PQC, and RSA in non-PQC.
* Add tool/create_certs.rb to generate test/drb/fixtures/*.{crt,key}
to test with pre-generated certs/keys and add DRbTests::Fixtures module
to read the certs/keys.
* Add test/drb/test_ssl.rb to test lib/drb/ssl.rb at the unit test level.
This approach aligns with test/drb/test_acl.rb to test lib/drb/acl.rb
at the unit test level.
* Add TestDRbSSLPQC, TestDRbSSLPQCMultipleCert in test/drb/test_drbssl.rb.
TestDRbSSLPQC is to test single PQC ML-KEM/ML-DSA server and client.
TestDRbSSLPQCMultipleCert is to test ML-DSA-65 (PQC) and RSA (non-PQC)
multiple certificate server with client certificate verification.
The test is designed for a high-security use case with :SSLVerifyMode
OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT.
Assisted-by: Claude:claude-opus-4-6[1m]I rebased this PR, fixing the things mentioned by reviews. First, I backed up the initial PR into my fork repository's wip/support-pqc-pr1 branch. Now this PR has 3 commits. The 1st commit is the same with #54 to pass the CI. I will remove this commit on this PR after #54 is merged or someone fixed the issue causing failing Windows CI cases. The 2nd commit is for refactoring, which was mentioned in the review. But it is not related to this PR. The 3rd commit is the main commit. I simplified the tests in test/drb/test_drbssl.rb without new service classes and Commit messagesThe 2nd commitRemove OpenSSL::PKey::RSA#public_key OpenSSL::PKey::RSA#public_key is obsolete according to ruby/openssl#1092. The 3rd commit (main commit)Add post-quantum cryptography (PQC) support to SSLConfig DRb::DRbSSLSocket::SSLConfig already works with pre-generated ML-DSA cert/key by This commit adds the following features in PQC use cases to #setup_certificate
Assisted-by: Claude:claude-opus-4-6[1m] |
This PR is related to #52.
Proof of concept
I prepared proof-of-concept scripts for this PR.
The document (
drb/README.md) is here. A list of the sections in thedrb/README.mdis below. The sections without "(development)" test with the current master branch. These work. The sections with "(development)" test with this PR.The script is here. The CI result is here.
Commit message
DRb::DRbSSLSocket::SSLConfig already works
with pre-generated ML-DSA cert/key by
:SSLCertificate and :SSLPrivateKey config options.
This commit adds the following features in PQC use cases to #setup_certificate and #setup_ssl_context.
Assisted-by: Claude:claude-opus-4-6[1m]
Notes
CI cases supporting PQC
PQC (ML-KEM/ML-DSA) works in OpenSSL >= 3.5. OpenSSL 3.5 added the feature. And works in Ruby OpenSSL >= 4.0. Ruby OpenSSL 4.0.0 added some functions in PQC use cases, and fixed a bug.
The
.github/workflows/test.ymluses runner ubuntu-latest, macos-latest, windows-latest.According to https://github.com/actions/runner-images, ubuntu-latest is ubuntu-24.04, macos-latest is macOS-26-arm64, windows-latest is windows-2025-vs2026.
The ubuntu-24.04 uses OpenSSL 3.0.13 which doesn't support PQC. The windows-2025-vs2026 uses OpenSSL 3.6.3 which supports PQC. The macos-26 uses OpenSSL 3.6.2 which supports PQC. The new PQC tests should be executed on the macos-latest and windows-latest CI cases.
test/drb/test_ssl.rb testing lib/drb/ssl.rb as an unit test level
I checked all the existing
test/drb/test_*.rbfiles.So, I created test/drb/test_ssl.rb to test
DRb::DRbSSLSocket::SSLConfigin lib/drb/ssl.rb as an unit test level.tool/create_certs.sh design decisions
The tool/create_certs.sh is inspired by ruby/rubygems#9678. The directory test/drb/fixtures to manage SSL key/cert files is inspired by ruby/openssl managing SSL keys in test/openssl/fixtures/pkey directory. ruby/openssl manages only key files, not certificate files. ruby/openssl is generating testing certificates from the keys in tests.
Testing in RubyCI servers
I plan to test this PR with RHEL 9 server (OpenSSL version is >= 3.5, but OpenSSL config disables PQC by default), which is the case of
support_pqc_handshake?isfalse,and OpenBSD server as I saw the following logic inDRbSSLService, test/drb/test_drbssl.rb.Edited: I confirmed the tests passed in RubyCI RHEL 9 and OpenBSD servers.
drbssl PQC tests
Single cert tests ML-DSA-65
This test with
TestDRbSSLPQCandDRbSSLPQCServiceis inspired by my proof-of-concept "## drbssl (SSL) auto-generated ML-DSA-65 cert". Also closed to theTestDRbSSLCoreandDRbSSLService.Multi cert tests ML-DSA-65/RSA
This test is inspired by my proof-of-concept "drbssl (SSL) pre-generated ML-DSA-65/RSA multi cert with client cert" case, and also inspired by ruby/openssl test/openssl/test_ssl.rb test_pqc_sigalg (https://github.com/ruby/openssl/blob/9796ee8f47003ec78fd8e052bc8dd6d1fcb0ae2b/test/openssl/test_ssl.rb#L2097).
PQC multi cert tests are executed via the following classes.
It is hard to understand the testing framework in test/drb.
In
DRbSSLPQCMultiCertMLDSA65Service, there aremanager_configandclient_config.manager_configis to manage the config used in manager to manage a child process ut_drb_drbssl_pqc_multi_cert.rb in this case. The main test workflow is between the server test/drb/ut_drb_drbssl_pqc_multi_cert.rb and client withclient_configpart. Client withclient_configconnects to the server ut_drb_drbssl_pqc_multi_cert.rb. However, it seems the ut_drb_drbssl_pqc_multi_cert.rb's config is also used as a client to connect to the servermanager_config.