<div dir="ltr"><div>Hello,</div><div><br></div><div>I am trying to resign a CMS using the openssl tool.</div><div><br></div><div>When I use RSA-PKCS1 everything is working fine.</div><div><br></div><div>When I use RSA-PSS it seems like the asn1 is produced corrupted, I do not see the signature in asn1dump. <br></div><div><br></div><div>I prepared a demo[1] to help people reproduce the issue, tested with openssl-1.1.1i.</div><div><br></div><div>The script output pasted below shows that CMS resign without PSS works correctly, while the same sequence with PSS produces a corrupted CMS file.</div><div><br></div><div>What am I doing wrong?</div><div><br></div><div>Regards,</div><div>Alon Bar-Lev<br></div><div><br></div><div>
<div>[1] <a href="https://github.com/alonbl/openssl-cms-pss">https://github.com/alonbl/openssl-cms-pss</a></div>

</div><div><br></div><div>---</div><div><br></div><div>===============<br>CMS without PSS<br>===============<br>cms -sign 1.cms<br>cms -verify 1.cms<br>hello world<br>Verification successful<br>cms -resign 1.cms to 2.cms<br>cms -verify 2.cms<br>hello world<br>Verification successful<br>===============<br>CMS with PSS<br>===============<br>cms -sign 1.cms<br>cms -verify 1.cms<br>hello world<br>Verification successful<br>cms -resign 1.cms to 2.cms<br>cms -verify 2.cms<br>Error reading S/MIME message<br>140438977062208:error:0D078079:asn1 encoding routines:asn1_item_embed_d2i:field missing:../crypto/asn1/tasn_dec.c:425:Field=algorithm, Type=X509_ALGOR<br>140438977062208:error:0D08303A:asn1 encoding routines:asn1_template_noexp_d2i:nested asn1 error:../crypto/asn1/tasn_dec.c:646:Field=signatureAlgorithm, Type=CMS_SignerInfo<br>140438977062208:error:0D08303A:asn1 encoding routines:asn1_template_noexp_d2i:nested asn1 error:../crypto/asn1/tasn_dec.c:614:Field=signerInfos, Type=CMS_SignedData<br>140438977062208:error:0D08303A:asn1 encoding routines:asn1_template_noexp_d2i:nested asn1 error:../crypto/asn1/tasn_dec.c:646:<br>140438977062208:error:0D08403A:asn1 encoding routines:asn1_template_ex_d2i:nested asn1 error:../crypto/asn1/tasn_dec.c:496:Field=d.signedData, Type=CMS_ContentInfo<br>FATAL: verify 2.cms failed</div><div><br></div><div><br></div></div>