即使私钥存在,NcryptopenKey返回Key也不存在 [英] NcryptopenKey returns Key do not exist even when private key is present

查看:106
本文介绍了即使私钥存在,NcryptopenKey返回Key也不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图使用证书的私钥读取来自服务的NCryptOpenKey,它使用LocalService上下文来签名数据。 API返回
键不存在错误。已安装的证书具有扩展keyUsage数字签名,并且还确认了私钥的许可。 Openssl生成的证书有/无扩展keyUsage工作正常。

创建的Microsoft CA生成的证书不起作用,导致上述错误。不确定哪个扩展名正在创建此错误

推荐答案

您好
thiyagu87r,

感谢您在此发布。

>> NcryptopenKey返回密钥即使存在私钥也不存在

>>NcryptopenKey returns Key do not exist even when private key is present

您是否尝试调用NCryptEnumKeys函数来检查指定的CNG密钥存储提供程序中是否有此密钥?或尝试使用管理员权限调用此方法。

Have you tried to call NCryptEnumKeys function to check if there has this key in the specified CNG key storage provider? Or tried to call this method with administrator privileges.

另请注意,您不应从服务中的StartService函数调用此函数。

Also notice you shouldn't call this function from the StartService Function in the service.

>>创建的Microsoft CA生成的证书无效,导致上述错误。不确定哪个扩展程序正在创建此错误

以下是一些可以解决CA错误的文档。

Here are some documents for you to troubleshoot CA errors.

https://support.microsoft.com/en-us / help / 182888 / how-to-handle-invalid-certificate-authority-error-with-wininet

https://docs.microsoft.com/en-us /previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/cc731429(v=ws.11

希望这可能是帮助你。

最好的问候,

Baron Bi

Baron Bi


这篇关于即使私钥存在,NcryptopenKey返回Key也不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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