« Previous Next »

Thread: Certificate problem on Vista

Last post 06-01-2008 4:49 AM by vanko. 0 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (1 items)

Sort Posts:

  • 06-01-2008, 4:49 AM

    • vanko
    • Not Ranked
    • Joined on 10-14-2005, 9:00 AM
    • Posts 8

    Certificate problem on Vista

    Hi Guys,
    May be this is not really the right forum for this post but i really hope that u can help me with this. It's a certificate problem. I am developing an application which is of the full trusted app type. So the problem that im facing is related with the cert that should be installed on the client machine. I have created a certificate using makesert.exe, provided by the SDK, that has to be installed to the client machine (into the certificate store - StoreName.Root, StoreName.My, StoreName.TrustedPublisher). For the purposes of the installation I have created a console application (.exe) that will help the user to download the certificate file and to install it to the client machine. The whole program runs without any problems under Windows XP, but under some versions of Vista (Vista Business - not working, Vista Home - working) the certificate is not installed into the StoreName.Root.

     here si how i create the cert

     

    1. makecert -r -n "CN=SomeName" -b 20/12/2004 -e 01/01/2099   -sv SomeName.pvk SomeName.cer  
    2. cert2spc SomeName.cer SomeName.spc
    3. pvkimprt -pfx SomeName.spc SomeName.pvk
     

     

    and here is the installer

     

    namespace CertficateInstaller

    {

        class CertficateInstaller

        {

            static void Main(string[] args)

            {

                WebClient webClient = new WebClient();

                webClient.Credentials = new System.Net.NetworkCredential("vanko", "123");

    <!--[if !supportEmptyParas]--> <!--[endif]-->

                byte[] certBytes = webClient.DownloadData("http://servername/SomeName.cer");

     <!--[endif]-->

                if (certBytes.Length > 0)

                {

                    Console.WriteLine("Start....");

                    createCert(StoreName.TrustedPublisher, certBytes);

                    createCert(StoreName.Root, certBytes);

                    createCert(StoreName.My, certBytes);

                    Console.WriteLine("Cuccess....");

                }

                else

                {

                    Console.WriteLine("Probelm downloading certificate");

                    Console.ReadLine();

                }

            }

    <!--[if !supportEmptyParas]--> <!--[endif]-->

            private static void createCert(StoreName storageName, byte[] certBytes)

            {

                X509Store store = new X509Store(storageName, StoreLocation.CurrentUser);

                store.Open(OpenFlags.MaxAllowed);

                store.Add(new X509Certificate2(certBytes));

                store.Close();

            }

        }

    }

     

     

    can someone try this on vista busness? I'm getting crazy with this already

    10x

     

Page 1 of 1 (1 items)
Microsoft Communities