“Invalid provider type specified” CryptographicException when trying to load private key of certificate

前端 未结 18 2899
盖世英雄少女心
盖世英雄少女心 2020-11-29 22:04

I\'m trying to read the private key of a certificate which has been shared with me by a third-party service provider, so I can use it to encrypt some XML before sending it t

18条回答
  •  独厮守ぢ
    2020-11-29 22:45

    This error went away after i removed the certificate from the store and imported it again from the .pfx file, using the Certificate Import Wizard (double-click the .pfx file) and an extra import option.

    After checking the import option (same step where password is entered):

    "Mark this key as exportable. This will allow you to back up or transport your keys at a later time."

    The privatekey could now be accessed from code without any errors.

    I also explicitly select the "Personal" store on the 2nd to last step, but I don't think this matters.

提交回复
热议问题