c# - certcontext is an invalid handle -


i'm trying install certificate trusted root local machine.

this have far

  private void installcertificate()     {         x509certificate2 certificate = new x509certificate2();         string certfile = environment.currentdirectory + "\\resources\\cert.crt";         x509store store = new x509store(storename.root, storelocation.localmachine);         store.open(openflags.readwrite);         store.add(certificate);         store.close(); 

i'm getting following error "certcontext invalid handle" , wondering if can shed light.

thanks

    x509certificate2 certificate = new x509certificate2();     string certfile = environment.currentdirectory + "\\resources\\cert.crt"; 

one presumes meant load certfile @ point:

    string certfile = environment.currentdirectory + "\\resources\\cert.crt";     x509certificate2 certificate = new x509certificate2(certfile); 

as stands, have managed object represents lack of having certificate.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -