简体   繁体   English

C#SSL流-系统重启后证书错误

[英]C# SSL stream - certificate error after system reboot

I'm building a C# SSL software, and it worked just fine when I first generated certificate using openssl, and eveything was good, until I reebooted my PC and ran the program again. 我正在构建一个C#SSL软件,当我第一次使用openssl生成证书时,它运行良好,直到我重新启动PC并再次运行该程序时,一切都很好。 In the line: 在该行中:

clientSslStream.AuthenticateAsServer(serverCert,clientCertificateRequired: false, checkCertificateRevocation: false); was the error System.ComponentModel.Win32Exception: 'The credentials supplied to the package were not recognize' I tried to reinstall the SAME certificate again and restart the program and it worked just fine. 错误是System.ComponentModel.Win32Exception: 'The credentials supplied to the package were not recognize'我试图再次重新安装SAME证书,然后重新启动程序,它正常工作。 after rebooting again, the program threw this error again. 再次重新启动后,程序再次引发此错误。 How can I solve the error forever? 如何永远解决错误? I'm using default windows certificate importer, and allowing every program to read the private key. 我正在使用默认的Windows证书导入程序,并允许每个程序读取私钥。 I've imported both *.p12 and *.crt files but it wasn't matter. 我已经导入了* .p12和* .crt文件,但这没关系。 How can I solve the problem? 我该如何解决这个问题?

Here are some screenshot from mmc, on for the certificate on local PC account and the other for User PC account. 这是mmc的一些屏幕截图,分别是本地PC帐户上的证书和其他User PC帐户上的证书。 The screenshots are after reboot, when it doesn't work : 屏幕截图是重启后的,当它不起作用时 来自mmc的本地PC帐户证书信息

来自PC的用户帐户证书信息

The answer: In windows, after installing certificate you have to add valid user (eg: Aviv, Admin..) to keep the certificate installed. 答案:在Windows中,安装证书后,您必须添加有效用户(例如:Aviv,Admin ..)以保持证书的安装。 Source: Answer in serverfault 来源: serverfault中的答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM