diff options
| author | Kazuki Yamaguchi <k@rhe.jp> | 2025-07-31 21:02:36 +0900 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2025-08-01 12:04:06 +0000 |
| commit | 497782856a6054ab6bf3c195b10146161bebcf11 (patch) | |
| tree | c66626cc9976f93ce20cbe40914e4594629713ad /test/prism/ruby/ruby_parser_test.rb | |
| parent | 046780179b582c3f037e5cff27647091f71d6977 (diff) | |
[ruby/openssl] pkcs7: make PKCS7#add_recipient actually useful
Add a simple test case that creates an enveloped-data structure without
using the shorthand method, and fix two issues preventing this from
working correctly.
First, OpenSSL::PKey::PKCS7#add_recipient currently inserts an
incomplete PKCS7_RECIP_INFO object into the PKCS7 object. When
duplicating an unfinalized PKCS7_RECIP_INFO, the internal X509 reference
must also be copied, as it is later used by #add_data to fill the rest.
A similar issue with #add_signer was fixed in commit https://github.com/ruby/openssl/commit/20ca7a27a86e
(pkcs7: keep private key when duplicating PKCS7_SIGNER_INFO,
2021-03-24).
Second, #add_data calls PKCS7_dataFinal(), which for enveloped-data
appears to require the BIO to be flushed explicitly with BIO_flush().
Without this, the last block of the encrypted data would be missing.
https://github.com/ruby/openssl/commit/9595ecf643
Diffstat (limited to 'test/prism/ruby/ruby_parser_test.rb')
0 files changed, 0 insertions, 0 deletions
