Re: Problems Adding/Importing a certificate file .pfx to my store using CertAddEncodedCertificateToStore

From: David Cross [MS] (dcross_at_online.microsoft.com)
Date: 08/25/04


Date: Wed, 25 Aug 2004 05:53:03 -0700

Unfortunately, Windows 95 is no longer a supported platform.

-- 
David B. Cross [MS]
--
This posting is provided "AS IS" with no warranties, and confers no rights.
http://support.microsoft.com
"Kiran Thandra" <kithu00@yahoo.com> wrote in message
news:d797b276.0408241345.35f10a8e@posting.google.com...
> Anand,
>
> I tried this API and everything is working fine in 2000. But we have
> an urgent requirement of handling this issue on 95.  Do you have any
> idea how do we address this issue on Windows95.
>
> Any Suggestions are greatly appreciated.
>
>
> Regards,
> Kiran Thandra
>
>
>
>
>
>
> "Anand Abhyankar [MS]" <ananda@online.microsoft.com> wrote in message
news:<#dGERqfiEHA.1356@TK2MSFTNGP09.phx.gbl>...
> > The documentation for this API says that it is supported on Windows 2000
and
> > later versions of the OS.
> >
> > -- 
> > Thanks,
> > Anand Abhyankar [MS]
> >
> > ----
> > This posting is provided "AS IS" with no warranties, and confers no
rights.
> >
> >
> > "Kiran Thandra" <kithu00@yahoo.com> wrote in message
> > news:d797b276.0408231404.7c8b4f19@posting.google.com...
> > > Hi Anand,
> > >
> > > Thanks for your reply. Just wondering are these Libraries compatable
> > > on Windows 95 . Because we are trying to develop two interfaces one
> > > for Windows 2000 and 95.
> > >
> > > Appreciate your time.
> > >
> > >
> > > Regards,
> > > Kiran Thandra
> > >
> > >
> > > kithu00@yahoo.com (Kiran Thandra) wrote in message
> > > news:<d797b276.0408230754.188c18e5@posting.google.com>...
> > >> Hi,
> > >>
> > >> We are trying to automate the client certificate import process. We
> > >> are programatically trying achieve the
> > >> I.E/InternetOptions/Content/Certificates/Import  wizard
functionality.
> > >>
> > >> Here is our approach.
> > >> We connect to a website using WININET and download a .pfx file and
> > >> save it to harddrive.
> > >> Trigger another program to read this file and import to My Store.
> > >> XYZ.pfx is a sample file .  Any ideas are greatly appreciated ...
> > >> I need more help of how do we convert our .pfx file to (const BYTE*
> > >> pbCertEncoded) whihc is a third parameter in
> > >> CertAddEncodedCertificateToStore method.
> > >>
> > >> I'm getting the following crypt .dll error(-8589934602) while
> > >> importing from executing this code.
> > >>
> > >>
> > >>
> > >> Sample code
> > >>
> > >> bool CSslConnection::ImportClientCert()
> > >> {
> > >>     char c;
> > >>  //const char *buffer="this is a string";
> > >>  //CHAR buffer[1024];
> > >>  string lps="this is a test";
> > >>  const BYTE *pbyte=0;
> > >>  DWORD length=0;
> > >>
> > >>
> > >>
> > >>   /* declare a char variable */
> > >>
> > >>   FILE *file; /* declare a FILE pointer  */
> > >>   file = fopen("xyz.pfx", "r");
> > >>   /* open a text file for reading */
> > >>
> > >>   if(file==NULL) {
> > >>     printf("Error: can't open file.\n");
> > >>     /* fclose(file); DON'T PASS A NULL POINTER TO fclose !! */
> > >>     return 1;
> > >>   }
> > >>   else {
> > >>     printf("File opened successfully. Contents:\n\n");
> > >>
> > >>     while(1) {     /* keep looping... */
> > >>       c = fgetc(file);
> > >>
> > >>       if(c!=EOF) {
> > >>
> > >>         printf("%c", c);
> > >> lps += c;
> > >>
> > >>         /* print the file one character at a time */
> > >>       }
> > >>       else {
> > >>         break;     /* ...break when EOF is reached */
> > >>       }
> > >>     }
> > >>     printf("\n\nNow closing file...\n");
> > >>     fclose(file);
> > >>   }
> > >>  // buffer=&c;
> > >>
> > >>   //istrstream s( buffer );
> > >> //lps=  AddressToString(lps,pbyte);
> > >>
> > >>  const unsigned char *ct=(const unsigned char*)lps.c_str();
> > >>
> > >>
> > >>   return CertAddEncodedCertificateToStore(m_hStore,X509_ASN_ENCODING
|
> > >> PKCS_7_ASN_ENCODING,ct,2000,CERT_STORE_ADD_USE_EXISTING,NULL);
> > >>
> > >>
> > >>
> > >>    //return true;
> > >> }


Relevant Pages


Quantcast