加载X509Certificate会导致CryptographicException异常“找不到原始签名者". [英] Loading X509Certificate results in exception CryptographicException "Cannot find the original signer"

查看:63
本文介绍了加载X509Certificate会导致CryptographicException异常“找不到原始签名者".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实例化 X509Certificate 对象,但是我一直遇到相同的 CryptographicException ,并显示错误消息:

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

找不到原始签名者".

"Cannot find the original signer".

我尝试了几种加载证书的方法:

I have tried several ways of loading the certificate:

// some different things that I have tried
var cert = X509Certificate.CreateFromCertFile(certFileName);
var cert2 = new X509Certificate(byteArray);
var cert3 = new X509Certificate(byteArray, secretString);
var cert4 = X509Certificate.CreateFromSignedFile(certFileName);

我尝试了从文件和字节数组加载.每次我得到相同的错误.可能是什么原因造成的?

I have tried both loading from a file and from a byte array. Each time I get the same error. What could be causing this?

推荐答案

我发现了问题所在.我试图只加载不包含私钥的证书文件.要解决此问题,我必须在购买证书的计算机上安装私钥,然后在

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.

这篇关于加载X509Certificate会导致CryptographicException异常“找不到原始签名者".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆