Archived Forum Post

Index of archived forum posts

Question:

Encrypt a File using PKCS7 with Multiple Certificates?

Jun 27 '13 at 10:26

Is it possible to encrypt a file using pkcs7 with multiple certificates?

Our scenario :

· we need to send an encrypted file to more users.

· The file needs to be encrypted with aes256 and its key with each user public key.

· Every user can get the file and decrypt it using its private keys.


Answer

Yes, if you wish to create binary PCKS7, then you would use Chilkat Crypt. The code is the same as for encrypting with one certificate, except that the AddEncryptCert method should be called once per certificate prior to encrypting. (see http://www.chilkatsoft.com/refdoc/csCrypt2Ref.html )

If producing S/MIME is desired, then it can be accomplished using Chilkat MIME. Again, the code would be the same as for encrypting MIME with a single certificate, except that the Mime.AddEncryptCert method is called once per certificate. (see http://www.chilkatsoft.com/refdoc/csMimeRef.html )

There are already online examples for PKCS7 encrypting a file on www.example-code.com.