-
-
Notifications
You must be signed in to change notification settings - Fork 779
Description
Hi
I would need to encrypt data, not envelopped in CMS (need to split in blocks, etc. for specific purposes) while keeping the CMS for recipient to decrypt it later.
With openssl command line it is possible to:
openssl cms -encrypt -in <file_not_encrypted> -outform DER -out <metadata.der> -recip <certificate.pem> > <encrypted_file.bin>
However, the cms encrypt(certs: &StackRef<X509>, data: &[u8], cipher: Cipher, flags: CMSOptions) -> Result<CmsContentInfo, ErrorStack>
do not allow to return encrypted data of mutate buffer containing encrypted data.
Looking at openssl library documentation for CMS_encrypt:
The data being encrypted is included in the CMS_ContentInfo structure, unless CMS_DETACHED is set in which case it is omitted. This is rarely used in practice and is not supported by SMIME_write_CMS().
Where does come from the limitation? Is it rust openssl crate or openssl library? If openssl, I do not get why you can do in command line but not supported from library, because it is rarely used..
Should I consider workaround, like envelopping in CMS to then later extract it and replace to empty type, or propose a pull request?