title: Programmatically import cert into IIS?
body: <p>I have a .pem certificate for SSL, I want to distribute it with my web application in an MSI (has to run on clients' computers). I then need to import it (into some credentials store?) and tell my site bindings to use it.  But how can I do this in code? I've discovered Microsoft.Web.Administration, but not sure where to go from there …</p>
  
  <p>This is in IIS7 btw.</p>
  
  <p>EDIT: The goal here is to have a web application that customers can run on their intranets. It mainly acts as an API for an iPhone app.  (Maybe this isn't the best design but we're locked in now.) So the customer installs the MSI, and voila, they have a web service. Now there needs to be password authentication between the iPhone and the web service; the simplest way seemed to be to do it in https. So I made a self-signed cert.</p>
  
  <p>I'm aware that redistributing a single cert is generally a bad idea, but we're just trying to defeat casual hackers here … this is going to be intranet only and for businesses only, it seems unlikely that anyone is going to be doing anything too crazy, and the API severely restricts the amount of Bad Things you are able to do to the database anyways.</p>
  
  <p>So there we go, the goal is to have password authentication on an intranet web app, with one-click(ish) installation. :-D</p>