Zip Component, Email Component, Encryption Component ActiveX Control for Zip Compression .NET Components for ASP.NET
ActiveX and .NET Components for Zip Compression, Encryption, Email, XML, S/MIME, HTML Email, Character Encoding, Digital Certificates, FTP, and more ASP Email ActiveX Component

Index of Chilkat Blog Posts

November 30, 2005

ASP.NET Example Code to Import a Certificate with Private Key from a PFX

This C# example, which must be run from an ASP.NET process, imports the certificate(s) from a PFX file and installs them in the process’s Current User certificate store. (The ASP.NET process is most likely running under the ASPNET account.)

<font face=courier size=2>
		Chilkat.Pfx pfx = new Chilkat.Pfx();
		pfx.UnlockComponent("30-day trial");
		bool bMachineKeySet = false;
		bool bLocalMachineCertStore = false;
		bool bExportable = true;
		bool bWarningDialog = false;	// low security to prevent the warning dialog
		bool success = pfx.ImportPfxFile(Server.MapPath("myCertWithPrivateKey.pfx"),"pfxPassword",
		if (success)
		    TextBox1.Text = "Success!";
		    TextBox1.Text = "Failed!";

Privacy Statement. Copyright 2000-2011 Chilkat Software, Inc. All rights reserved.
Send feedback to

Components for Microsoft Windows XP, 2000, 2003 Server, Vista, Windows 7, and Windows 95/98/NT4.