为什么 sslStream.AuthenticateAsServer 不需要 UAC 和替代方案

发布于 2024-12-18 22:10:05 字数 456 浏览 0 评论 0原文

在调整 Web 代理代码时,我注意到如果我在具有 UAC(用户访问控制)的应用程序中运行代码,则会出现异常

这是抛出异常的位置:

sslStream.AuthenticateAsServer(_certificate, false, SslProtocols.Tls | SslProtocols.Ssl3 | SslProtocols.Ssl2, false);

这是我得到的错误(使用 UAC)

The server mode SSL must use a certificate with the associated private key.

< strong>第一个问题:为什么?

第二个问题:还有其他选择吗?我真的很想在 UAC 中运行它(请注意,http 工作正常)

While tweaking a web proxy code, I noticed that if I run the code in an app with UAC (User Access Control) I get an exception

Here is the location where the exception is thrown:

sslStream.AuthenticateAsServer(_certificate, false, SslProtocols.Tls | SslProtocols.Ssl3 | SslProtocols.Ssl2, false);

Here is the error I get (with UAC)

The server mode SSL must use a certificate with the associated private key.

First question: Why?

2nd question: Is there an alternative? I really would like to run this in UAC (note that http works fine)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

私藏温柔 2024-12-25 22:10:05

听起来您的证书的私钥可能位于文件访问受限的地方。这样一来,并非任何用户都可以读取您的私钥。以有限的权限运行服务的目的是什么?如果密钥仅用于此服务,您可以考虑删除其所在文件夹的安全限制,但如果此密钥用于您的整个域,我会犹豫是否要这样做......

It sounds like the private key to your certificate is probably located somewhere with restricted file access. This is so that not just any user can read your private key. What is the purpose of running your service with limited privileges? If the key is only for this service, you may consider removing the security limitations on the folder it is in, but if this key is for your whole domain, I would be hesitant to do that...

救赎№ 2024-12-25 22:10:05

您是否已将证书安装在适当的证书存储中?

据我所知,在使用证书时,您加载的文件仅用作识别 Windows 证书存储之一中的服务器证书的参考。如果代理在一个帐户下运行,但不在另一个帐户下运行,则可能您没有在该帐户的个人证书存储中安装证书。

Have you installed the certificate in the appropriate certificate store?

From what I remember when working with certificates, the file that you load is only used as a reference to identify the server certificate in one of the Windows certificate stores. If the proxy is running under one account but not the other, maybe you didn't install the certificate in that other account's personal certificate store.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文