Need some help again. I'm doing the decryption now. Done almost everything, but have a question related to the public key of the recipient. So i encrypted a text into PKCS7 enveloped data. Now, I am reading from that structure the symmetric key IV and the encrypted data with the symmetric key. How do I read the Public Key of the recipient and his encrypted symmetric key?
I tryed the following, but not sure is the right way. I load the serial number of the recipient from his certificate, and started comparing it with does from the PKCS7 file, using the stack sk_PKCS7_RECIP_INFO. If i find the serial, then i copy the symmetric encrypted file from the stack. Big question now because I didn't understood the structure of the PKCS7. The Public Key of the recipient is loaded from his certificate or from the PKCS7 structure? Because I don't see it in the PKCS7 file and when i tryed to open it, i receive an error that it doesn't have a good format. I want to specify that I also did a simple program using PKCS7_encrypt () and compared the result to mine and they are identical. But also can't open neither of them. many thanks for the helped and for your time.