[openssl-users] CMS with Symmetric key

Dr. Stephen Henson steve at openssl.org
Tue Apr 5 11:39:05 UTC 2016

On Mon, Apr 04, 2016, Abe Racioppo wrote:

> Hey guys,
> I'm trying to use the CMS operations in libcrypto but with a symmetric key
> encryption key instead of x509.
> I'm thinking I want to use a combination of
> CMS_RecipientInfo_set0_pkey,
> SMIME_write_CMS,
> and
> CMS_EncryptedData_encrypt.
> Has anyone done this before and can give me some direction?  This is my
> first time working with openssl and am getting kinda lost.

You have several options here.

You can just use the encrypted data type with a key directly.

You can use the enveloped data type with a symmetric wrapping key.

You can use the enveloped data type with a password based recipient info.

Which you use depends on the application you have in mind.

In the first case you just call CMS_EncryptData_encrypt() followed by

Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org

More information about the openssl-users mailing list