title: Automate SSL certificate install to IIS 6 sites using C#
body: <p>I'm trying to automate the process of generating a site in IIS 6 via C# code.  I'm using DirectoryServices and I'm nearly there..  I have it creating the site, setting up all the bindings etc. just fine.  I have not figured out how to install our wildcard ssl cert.  Here's the details:</p>
  
  <p>We have a SSL certificate that matches '*.example.com'.
  Every site we host has a server binding that matches.  e.g. 'test.example.com'.
  I think I know how to add the SecureBinding property:</p>
  
  <pre><code>DirectoryEntrySite.Properties["SecureBindings"][0] = "xx.xx.xx.xx:443:test.example.com";
  </code></pre>
  
  <p>But I have had no success finding information on how to automatically install the certificate to the site.  In the IIS 6 Manager, you would do this by right clicking a site -> properties -> Directory Security -> Server Certificate -> Next -> Assign an existing certificate -> (select certificate) -> Next...</p>
  
  <p>Can anyone help?</p>