[openssl-users] Fwd: Create a signed file from detached signature and clear file content

Antonio Iacono antiac at gmail.com
Wed Dec 20 10:07:01 UTC 2017

assuming I have the following:
- data.txt
- data.p7s (the detached signature)

Can I generate the bundled (p7m) signed file ?

I tried:

content = BIO_new_file("data.txt", "rb");
signature = BIO_new_file("data.p7s", "rb");
p7 = d2i_PKCS7_bio(signature, NULL);
PKCS7_set_detached(p7, 0);
bundled = BIO_new_file("bundled.p7m", "wb");
i2d_PKCS7_bio_stream(bundled, p7, content, 0);

but the generated file (bundled.p7m) is identical to the signature file

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20171220/3e22b123/attachment.html>

More information about the openssl-users mailing list