Loading X509Certificate results in exception CryptographicException “Cannot find the original signer”

后端 未结 2 878
野性不改
野性不改 2021-01-01 18:34

I am trying to instantiate an X509Certificate object, but I keep running into the same CryptographicException, with the error message:

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

    I figured out the problem. I was attempting to load just the certificate file, which did not include the private key. To fix the problem, I had to install the private key on the machine on which the certificate was purchased, and then export it as a .pfx file and move it to where I actually wanted to use it. I'm sure was a newbie mistake. Hopefully, my silly issue will help other newbies in the future.

    0 讨论(0)
  • 2021-01-01 19:02
            var collection = new X509Certificate2Collection();
            collection.Import(byteArray);
            return collection;
    

    via https://stackoverflow.com/a/44073265, by https://stackoverflow.com/users/6535399, who writes crypto for msft - e.g. https://github.com/dotnet/corefx/pull/25920

    0 讨论(0)
提交回复
热议问题