Hi,
I'm a rookie with OpenSSL.  I'm trying to create S/MIME signed docs and verify them 
against exchange.  Using the example from the O'Reilly book "Network Security with 
OpenSSL"  I have the following code:

   if (sign) {

      if ( !(pkcs7 = PKCS7_sign(cert, pkey, chain, buf, 0)) ) {
         fprintf(stderr, "Unable to create the PKCS#7 object\n");

      if ( !(pkcs7 = PKCS7_sign(cert, pkey, chain, buf, 0)) ) {
         fprintf(stderr, "Unable to create the PKCS#7 object\n");
         return(1);
      }

      //flags = (PKCS7_DETACHED | PKCS7_TEXT);
      flags = (PKCS7_DETACHED);
      //flags = (PKCS7_TEXT);
      //flags = 0;

      BIO_reset(buf);
      if ( BIO_puts(buf, text) < 1 )
      {
         fprintf(stderr, "Failed to load buf with text\n.");
         return(1);
      }

      if (SMIME_write_PKCS7(out, pkcs7, buf, flags) != 1) {
         fprintf(stderr, "Unable to write S/MIME data.\n");
         return(1);
      }

When I send the doc to Outlook I seem to almost get what I want, based on the flags.

PKCS7_DETACHED | PKCS7_TEXT ==  Contents altered after message was signed.  But I am 
able to view the text.

PKCS7_DETACHED  == Contents altered after message was signed.  No text.

PKCS7_TEXT or 0 == The signature verifies but I don't get any text.


What am I missing here?
________________________ 
Mark Helzer 
ADP Dealer Services, Inc. 
2525 SW 1st Ave. 
Portland, OR. 97201 
(503) 402-3481 

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to