On Fri, Jun 19, 2009, Chris Bare wrote:

> > 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.
> > --
> 
> I'm using openssl-1.0.0-beta2 and I've tried setting CMS_STREAM as well as
> CMS_STREAM|CMS_PARTIAL, but I have not gotten any output with EOC.
> Any idea what else I'm missing?
> 

Use i2d_CMS_bio_stream() instead.

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]

Reply via email to