在 COM 互操作环境中调用时尝试创建 X509Certificate2 证书失败
我有一个类库,它定义了几个在经典 ASP Web 应用程序中使用的帮助器类/方法。到目前为止,一切正常。现在我添加了一个新的辅助方法,该方法使用第三方工具对 PDF 文件进行签名。使用控制台应用程序调用此包装方法,一切正常。一旦我使用 asp 页面调用完全相同的方法,调用就会
X509Certificate2 cert = new X509Certificate2(sigFilePath, sigPassword);
失败,并出现错误“系统找不到指定的文件”(翻译自德语)。
由于从控制台应用程序调用相同的代码可以正常工作,我猜问题一定位于不同的地方。这可能是一个安全问题吗?
I've got a classlibrary which defines a couple of helper classes/methods which are used from a classic asp web application. So far, everything works fine. Now I've added a new helper method which signs a PDF file using a third party tool. Using a console application to call this wrapper method, everything works fine. Once I use an asp page to call the exact same method, the call to
X509Certificate2 cert = new X509Certificate2(sigFilePath, sigPassword);
fails with the error "The system cannot find the specified file" (translated from german).
Since the same code works fine called from the console application, i guess the problem must be located somewhere different. Could it be a security issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当我想知道我是否面临像您一样的安全问题时,我只是做了一个快速测试:我将网络服务器正在使用的用户帐户放在管理员组中,进行快速 iisreset,然后重试。如果它现在可以工作,那么这是一个安全问题。如果仍然失败,请看看其他地方。
永远不要忘记从管理员组中删除用户 accoung,并且仅在您自己的开发计算机上执行此操作,而不是在生产服务器上执行此操作!
如果这是一个安全问题,我建议启动 Process Monitor(在 google 中查找 procmon)。这是微软下载的。在结果列中查找访问被拒绝的情况。然后你就会知道是什么阻碍了你......
When I wonder if I'm facing a security issue like you do, I just do a quick test : I put the user account the webserver is using in the administrators group, do a quick iisreset, and try again. If it's working know you now it's a security issue. If it's still failing, look somewhere else.
Never forget to then remove the user accoung from the administrators group, and only do that on you own dev machine, not on production servers !!
If it's a security issue, I would then recommend launching Process Monitor (look for procmon in google). It's a Microsoft download. Look for access denied in the result column. You'll then know what's blocking you ...