How to push certificate to "Trusted root certificate authorities" using Installer

No.of Views3833
Bookmarked0 times
Downloads 
Votes0
By  Prabu   On  09 Jul 2010 10:07:34
Tag : WPF , Configuration Files
In order to run your Full Trust enabled WPF XBAP application, you have to use “Self signed certificate authority file” for running and deploying XBAP application
emailbookmarkadd commentsprint

Images in this article missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at info@codegain.com

 

Introduction

In order to run your Full Trust enabled WPF XBAP application, you have to use “Self signed certificate authority file” for running and deploying XBAP application. The certificate should pushed it into “Trusted Publisher” and “Authority Root” certificate storages. You can use X509Certificate2 and X509Store classes in your installer assembly for pushing the certificate to certificate storage.

Please use the following code snippet.

string certPath = string.Format(@"{0}\Aaa.cer", Environment.GetFolderPath(Environment.SpecialFolder.System));
X509Certificate2 certificate = new X509Certificate2(certPath);
X509Store trustedPublisherStore = new X509Store(StoreName.TrustedPublisher, StoreLocation.LocalMachine);
X509Store trustedAuthorityRootStore = new X509Store(StoreName.AuthRoot, StoreLocation.LocalMachine);

try{
     trustedPublisherStore.Open(OpenFlags.ReadWrite);
     trustedPublisherStore.Add(certificate);
     trustedAuthorityRootStore.Open(OpenFlags.ReadWrite);
     trustedAuthorityRootStore.Add(certificate);
}
catch (Exception ex)
{
     MessageBox.Show(ex.Message + "\n\n" + ex.StackTrace);
}
finally{
     trustedPublisherStore.Close();
     trustedAuthorityRootStore.Close();
}

For more information about Signing & Deploying CAB Based ClickOnce Code.Please refer the following link to know more about “WPF - XBAP as Full Trust Application”

http://blogs.microsoft.co.il/blogs/maxim/archive/2008/03/05/wpf-xbap-as-full-trust-application.asp.

i hope this is help to you and thank you for reading.

 
Sign Up to vote for this article
 
About Author
 
Prabu
Occupation-Software Engineer
Company-
Member Type-Fresh
Location-India
Joined date-23 Jun 2010
Home Page-
Blog Page-http://prabu-guru.blogspot.com/
 
 
Other popularSectionarticles
Comments
There is no comments for this articles.
Leave a Reply
Title:
Display Name:
Email:
(not display in page for the security purphase)
Website:
Message:
Please refresh your screen using Ctrl+F5
If you can't read this number refresh your screen
Please input the anti-spam code that you can read in the image.
^ Scroll to Top
</