At 16:16 29.02.00 +0800, you wrote:
>Yes! the certificate signed by CA is in format of DER and stored in
cert.result.
>
>now that section is as following to return the certificate to browser:
> 
>CERT=fopen("/usr/local/ssl/certs/cert.result");
>printf(Content-Type: application/x-x509-user-cert\n\n");
>while ((ch=getc(CERT))!= EOF)
>     result[i++] = ch;
>fclose(CERT);
>printf ("%s",result);

don't use printf, use write...

>the size of cert.result is 832, and i is 833. So I think I have had the
content of cert.result 
>is fully stored in result. however, printf ("%s",result) only output the
first line of cert.result. How I can overcome this problem?
>
>Is there any C  program to do the work of downloading a certificate to
browser?

something like:

   FILE       *spCertF = fopen(cpFile,"r");
   struct stat sStat;
   char       *cpData;

   fstat(spFile,&sStat);
   cpData = malloc(sStat.st_size);
   fread(cpData,1,sStat.st_size,spCertF);
   fprintf(stdout,"Content-Type: application/x-x509-user-cert\n"
                  "Content-Length: %d\n\n",sStat.st_size);
   fwrite(cpData,1,sStat.st_size,stdout);
   free(cpData);


Naturally you have to check the return valuess...

By

Goetz

-- 
Goetz Babin-Ebell, TC TrustCenter GmbH, http://www.trustcenter.de 
Sonninstr. 24-28, 20097 Hamburg, Germany
Tel.: +49-(0)40 80 80 26 -0,  Fax: +49-(0)40 80 80 26 -126
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to