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

Antonio Iacono antiac at gmail.com
Tue Dec 26 11:44:22 UTC 2017


Hi,

I think I have solved. Maybe you can write better and in fewer lines anyway
this attached code works.

Antonio

2017-12-20 11:07 GMT+01:00 Antonio Iacono <antiac at gmail.com>:

>
> Hi,
> 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
> (data.p7s)
>
> Thanks,
> Antonio
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20171226/4acf1a97/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: buildp7m.c
Type: text/x-csrc
Size: 2650 bytes
Desc: not available
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20171226/4acf1a97/attachment.c>


More information about the openssl-users mailing list