Using X509Certificate2 to get PrivateKey causes CryptographicException “Invalid provider type specified”

前端 未结 2 1227
感动是毒
感动是毒 2021-01-18 12:23

everyone,

I am developing a web application that uses X509Certificate2 to get a private key from a certification file. Code snippet looks like following:

<         


        
相关标签:
2条回答
  • 2021-01-18 13:05

    I have been having the same problem and this is what I did to solve it. Hopefully this will help you too.

    We had to set Load User Profile to True in the app pools advanced settings

    You can also set it in the web.config I believe.

    https://blogs.msdn.microsoft.com/vijaysk/2009/03/08/iis-7-tip-3-you-can-now-load-the-user-profile-of-the-application-pool-identity/

    0 讨论(0)
  • 2021-01-18 13:08

    may be it useful to you; On local try:

    X509Certificate2 pc = new X509Certificate2(strFileName, strPassword);
    
    0 讨论(0)
提交回复
热议问题