The following flags can be passed in the *flags* parameter.

If *CMS_DETACHED* is set then cleartext signing will be used, this option
only makes sense for SignedData where *CMS_DETACHED* is also set when
CMS_sign() is called.

If the *CMS_TEXT* flag is set MIME headers for type *text/plain* are added
to the content, this only makes sense if *CMS_DETACHED* is also set.

If the *CMS_STREAM* flag is set streaming is performed. This flag should
only be set if *CMS_STREAM* was also set in the previous call to a
CMS_ContentInfo creation function.

If cleartext signing is being used and *CMS_STREAM* not set then the data
must be read twice: once to compute the signature in CMS_sign() and once to
output the S/MIME message.

If streaming is performed the content is output in BER format using
indefinite length constructed encoding except in the case of signed data
with detached content where the content is absent and DER format is used.


2009/6/18 Dr. Stephen Henson <[email protected]>

> On Wed, Jun 17, 2009, Chris Bare wrote:
>
> > I'm trying to use openssl to generate a signed CMS that matches the
> output of
> > a windows program written with the BouncyCastle library. One of the
> > differences I've noticed is that my openssl output has the length set for
> each
> > structure whereas the c# program has the length as inf and closes with an
> EOC.
> >
> > I tried setting the CMS_STREAM flag, but that didn't change my output.
> > I realize it should not matter, but my code is crashing the server (which
> is
> > 3rd party code so I can't change it) and the c# is not, so I'm wondering
> if it
> > could be related to EOC.
> >
> > Here's a snipped of what my code is doing:
> >
> >         int flags = CMS_STREAM; // or 0
> >
> >         BIO *mem = BIO_new(BIO_s_mem());
> >         // write stuff to mem
> >         cms = CMS_sign(scert, skey, NULL, mem, flags);
> >         if (!i2d_CMS_bio(out, cms))
> >
> > Is there some other flag, or some mode I can set to make it use EOC?
> >
>
> The CMS_STREAM flag is ignored for OpenSSL < 1.0.0. For supported versions
> of
> OpenSSL it will produce an output with EOCs.
>
> Steve.
> --
> Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
> OpenSSL project core developer and freelance consultant.
> Homepage: http://www.drh-consultancy.demon.co.uk
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> User Support Mailing List                    [email protected]
> Automated List Manager                           [email protected]
>



-- 
Refer to: http://www.microsuncn.com

Best Regards

Alan Zheng

Reply via email to