ruby/ext/openssl
Kazuki Yamaguchi 497782856a [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 20ca7a27a8
(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.

9595ecf643
2025-08-01 12:04:06 +00:00
..
lib [ruby/openssl] lib/openssl.rb: require files in alphabetical order 2025-07-27 12:16:33 +00:00
depend Update dependencies for addition of set.h to public headers 2025-07-11 15:24:23 +09:00
extconf.rb [ruby/openssl] ssl: add SSLSocket#sigalg, #peer_sigalg, #group 2025-07-22 16:51:02 +00:00
History.md [ruby/openssl] Ruby/OpenSSL 3.3.0 2024-12-22 03:33:03 +09:00
openssl.gemspec Use Dir.glob and base keyword arg for the installer of Ruby package 2025-07-01 11:50:11 +09:00
openssl_missing.h [ruby/openssl] ts: use TS_VERIFY_CTX_set0_{store,certs}() on OpenSSL 3.4 2025-01-23 01:45:52 +09:00
ossl.c [ruby/openssl] ossl.c: avoid using sk_*() functions with NULL 2025-02-11 16:42:25 +00:00
ossl.h [ruby/openssl] ossl.h: include <openssl/provider.h> in ossl.h 2025-06-25 17:13:10 +00:00
ossl_asn1.c [ruby/openssl] asn1: align UTCTime year range with RFC 5280 2025-07-12 13:25:24 +00:00
ossl_asn1.h [ruby/openssl] Mark variables and functions as static whenever possible 2024-12-07 07:55:47 +00:00
ossl_bio.c [ruby/openssl] Fix references to the license text 2024-06-08 10:59:17 +00:00
ossl_bio.h [ruby/openssl] Fix references to the license text 2024-06-08 10:59:17 +00:00
ossl_bn.c [ruby/openssl] bn: avoid ossl_bn_new(NULL) 2025-07-27 12:17:23 +00:00
ossl_bn.h [ruby/openssl] Mark variables and functions as static whenever possible 2024-12-07 07:55:47 +00:00
ossl_cipher.c [ruby/openssl] cipher: remove Cipher#encrypt(password, iv) form 2025-05-15 16:50:25 +00:00
ossl_cipher.h [ruby/openssl] Mark variables and functions as static whenever possible 2024-12-07 07:55:47 +00:00
ossl_config.c [ruby/openssl] make configs shareable when frozen 2024-12-07 07:52:02 +00:00
ossl_config.h [ruby/openssl] Fix references to the license text 2024-06-08 10:59:17 +00:00
ossl_digest.c [ruby/openssl] mark initialize_copy as :nodoc: 2025-03-12 16:03:47 +00:00
ossl_digest.h [ruby/openssl] Mark variables and functions as static whenever possible 2024-12-07 07:55:47 +00:00
ossl_engine.c [ruby/openssl] pkey: rename ossl_pkey_new() to ossl_pkey_wrap() 2025-07-27 12:17:25 +00:00
ossl_engine.h [ruby/openssl] Mark variables and functions as static whenever possible 2024-12-07 07:55:47 +00:00
ossl_hmac.c [ruby/openssl] mark initialize_copy as :nodoc: 2025-03-12 16:03:47 +00:00
ossl_hmac.h [ruby/openssl] Mark variables and functions as static whenever possible 2024-12-07 07:55:47 +00:00
ossl_kdf.c [ruby/openssl] Require OpenSSL 1.1.0 or later 2025-01-20 17:12:57 +00:00
ossl_kdf.h
ossl_ns_spki.c [ruby/openssl] pkey: rename ossl_pkey_new() to ossl_pkey_wrap() 2025-07-27 12:17:25 +00:00
ossl_ns_spki.h [ruby/openssl] Mark variables and functions as static whenever possible 2024-12-07 07:55:47 +00:00
ossl_ocsp.c [ruby/openssl] ocsp: refactor ossl_ocspcertid_new() 2025-07-27 12:17:25 +00:00
ossl_ocsp.h [ruby/openssl] Mark variables and functions as static whenever possible 2024-12-07 07:55:47 +00:00
ossl_pkcs7.c [ruby/openssl] pkcs7: make PKCS7#add_recipient actually useful 2025-08-01 12:04:06 +00:00
ossl_pkcs7.h [ruby/openssl] ts: avoid using OpenSSL::PKCS7's internals 2024-12-07 07:55:46 +00:00
ossl_pkcs12.c [ruby/openssl] pkey: rename ossl_pkey_new() to ossl_pkey_wrap() 2025-07-27 12:17:25 +00:00
ossl_pkcs12.h [ruby/openssl] Mark variables and functions as static whenever possible 2024-12-07 07:55:47 +00:00
ossl_pkey.c [ruby/openssl] pkey: rename ossl_pkey_new() to ossl_pkey_wrap() 2025-07-27 12:17:25 +00:00
ossl_pkey.h [ruby/openssl] pkey: rename ossl_pkey_new() to ossl_pkey_wrap() 2025-07-27 12:17:25 +00:00
ossl_pkey_dh.c [ruby/openssl] mark initialize_copy as :nodoc: 2025-03-12 16:03:47 +00:00
ossl_pkey_dsa.c [ruby/openssl] mark initialize_copy as :nodoc: 2025-03-12 16:03:47 +00:00
ossl_pkey_ec.c [ruby/openssl] bn: avoid ossl_bn_new(NULL) 2025-07-27 12:17:23 +00:00
ossl_pkey_rsa.c [ruby/openssl] mark initialize_copy as :nodoc: 2025-03-12 16:03:47 +00:00
ossl_provider.c [ruby/openssl] ossl.h: include <openssl/provider.h> in ossl.h 2025-06-25 17:13:10 +00:00
ossl_provider.h [ruby/openssl] add OpenSSL Provider support 2023-06-19 17:45:51 +09:00
ossl_rand.c [ruby/openssl] Require OpenSSL 1.1.1 or later 2025-01-21 18:14:14 +00:00
ossl_rand.h [ruby/openssl] Mark variables and functions as static whenever possible 2024-12-07 07:55:47 +00:00
ossl_ssl.c [ruby/openssl] pkey: rename ossl_pkey_new() to ossl_pkey_wrap() 2025-07-27 12:17:25 +00:00
ossl_ssl.h [ruby/openssl] Fix references to the license text 2024-06-08 10:59:17 +00:00
ossl_ssl_session.c [ruby/openssl] mark initialize_copy as :nodoc: 2025-03-12 16:03:47 +00:00
ossl_ts.c [ruby/openssl] ts: use TS_VERIFY_CTX_set0_{store,certs}() on OpenSSL 3.4 2025-01-23 01:45:52 +09:00
ossl_ts.h [ruby/openssl] Fix references to the license text 2024-06-08 10:59:17 +00:00
ossl_x509.c [ruby/openssl] Require OpenSSL 1.1.1 or later 2025-01-21 18:14:14 +00:00
ossl_x509.h [ruby/openssl] Mark variables and functions as static whenever possible 2024-12-07 07:55:47 +00:00
ossl_x509attr.c Reapply "[ruby/openssl] x509: disallow ossl_x509{,attr,crl,ext,revoked,name}*_new(NULL)" 2025-07-31 18:45:53 +09:00
ossl_x509cert.c Reapply "[ruby/openssl] x509: disallow ossl_x509{,attr,crl,ext,revoked,name}*_new(NULL)" 2025-07-31 18:45:53 +09:00
ossl_x509crl.c Reapply "[ruby/openssl] x509: disallow ossl_x509{,attr,crl,ext,revoked,name}*_new(NULL)" 2025-07-31 18:45:53 +09:00
ossl_x509ext.c Reapply "[ruby/openssl] x509: disallow ossl_x509{,attr,crl,ext,revoked,name}*_new(NULL)" 2025-07-31 18:45:53 +09:00
ossl_x509name.c Reapply "[ruby/openssl] x509: disallow ossl_x509{,attr,crl,ext,revoked,name}*_new(NULL)" 2025-07-31 18:45:53 +09:00
ossl_x509req.c [ruby/openssl] pkey: rename ossl_pkey_new() to ossl_pkey_wrap() 2025-07-27 12:17:25 +00:00
ossl_x509revoked.c Reapply "[ruby/openssl] x509: disallow ossl_x509{,attr,crl,ext,revoked,name}*_new(NULL)" 2025-07-31 18:45:53 +09:00
ossl_x509store.c [ruby/openssl] x509store: fix StoreContext#current_cert 2025-07-31 09:45:35 +00:00