I need to encrypt or sign only the content string

My partner is using Entrust Solution.
It requires the transfering way based on File Upload(multipart/form-data, RFC 1867)
I could make “multipart/form-data” mime using the WmPublic’s mime built-in service.
But, I can’t encrypted&signed mime because WmPublic’s smime built-in service have to
use envelope stream.
I need to encrypt or sign only the plain string using X509 Certificates.

I need the service to encrypt or sign only the content string. (resulting in encrypted or signed content stream.)
Please, help me.

Mime is composed of below sample.

-------sample start------
Content-Type: multipart/form-data; boundary=_Part_5_637540605.1077745760062

–_Part_5_637540605.1077745760062
Content-Disposition: form-data; name=“fileName”; filename=“test_sample.txt”;
Content-Type: text/plain

There is the plain string or encrypted&signed string in this location.
–_Part_5_637540605.1077745760062–
-------sample end------