找不到符合条件的唯一证书

Kja*_*neb 22 x509certificate wif

尝试解析我的令牌时遇到以下错误:

Property name: 'certificateReference'
Error: 'ID1025: Cannot find a unique certificate that matches the criteria.
StoreName: 'My'
StoreLocation: 'LocalMachine'
X509FindType: 'FindByThumbprint'
FindValue: '?41a8a59e537d4a00a8c4fa8dc2522388dbd13d27'
Run Code Online (Sandbox Code Playgroud)

我的web.config中的部分是:

<serviceCertificate>`
    <certificateReference x509FindType="FindByThumbprint" findValue="?41A8A59E537D4A00A8C4FA8DC2522388DBD13D27" storeLocation="LocalMachine" storeName="My" />
</serviceCertificate>
Run Code Online (Sandbox Code Playgroud)

我已经确认了IIS,MMC和Internet Explorer中存在的证书,并尝试将查找类型更改为主题但无济于事.我还尝试将指纹设为大写,小写,有空格且没有空格.我还确认证书存在LocalMachine\My,结果如下:

Matching certificate:
CN=kelly-pc
Run Code Online (Sandbox Code Playgroud)

可以访问私钥的其他帐户和组包括:

NT AUTHORITY\SYSTEM
BUILTIN\Administrators
KELLY-PC\Kelly
BUILTIN\IIS_IUSRS
Run Code Online (Sandbox Code Playgroud)

Gui*_*ish 23

我有完全相同的问题.通过在Notepad ++(而不是记事本)中复制我的web.config部分,我看到了一个不可见的字符:

<serviceCertificate>
        <certificateReference  x509FindType="FindByThumbprint" findValue="?e36df2f3e351a25adf8ffb6ad3619f10238f0317" />
</serviceCertificate>
Run Code Online (Sandbox Code Playgroud)

删除此字符,它应该工作.

如果没有Notepad ++,您只需在指纹值前面按退格键(尝试删除"char.

  • 使用Notepad ++我没有看到额外的字符,直到我将编码从UTF-8更改为ANSI (6认同)

Bja*_*i B 8

首先,Oleg的"issuedTokenAuthentication"建议对我不起作用,因为我的应用程序是asp.net MVC.我假设在asp.net MVC应用程序中不支持此元素,但它可能在WCF服务配置中受支持.

在localhost和其他错误(例如ID1024)上与这个错误进行了长达数小时的斗争之后,我不得不通过以下建议撤消一些我做过的事情,例如让Everyone读取%ALLUSERSPROFILE%\ Microsoft\Crypto\RSA\MachineKeys中的所有文件这个博客(我在整个MachineKeys文件夹上授予了读取,这不是一个好主意!).通过这样做,所有授予私钥停止通过MMC控制台工作!

我的解决方案是根据此处的说明创建一个新的自签名证书

然后,我将新创建的证书重新导入到正确的商店,并为运行Web应用程序的用户提供了对私钥的读取权限.我的问题是我之前使用的证书是自签名的,它一定是出了问题.

客户端绝对需要此部分:

<serviceCertificate>
   <certificateReference x509FindType="FindByThumbprint" findValue="?41A8A59E537D4A00A8C4FA8DC2522388DBD13D27" storeLocation="LocalMachine" storeName="My" />
</serviceCertificate>
Run Code Online (Sandbox Code Playgroud)

在处理证书时,这也是一个非常好的建议,请记住:

如果您首先将证书导入个人商店进行开发,然后将其导入到机器商店进行部署,私钥将保留在个人商店位置,因此即使您已获得许可,也不会使用任何服务帐户.

终于FindPrivateKey.exe工具正好派上了用场,找到实际的私用密钥文件,并帮助解决问题,它可以从以下网址下载这里,具有很好的指示在这里.

我注意到当通过MMC控制台删除证书时,我必须手动删除私钥文件

C:\ ProgramData \微软\加密\ RSA\MachineKeys的

如果从localMachine商店和从中删除

C:\用户[用户名] \应用程序数据\漫游\微软\加密\ RSA\S-1-5-21-2106337540-114255811-1274951907-65121

如果从CurrentUser商店删除


Ole*_*leg 0

也许您使用自行颁发的证书,您还应该添加行

<issuedTokenAuthentication allowUntrustedRsaIssuers="true" />
Run Code Online (Sandbox Code Playgroud)

其中<serviceCertificate>应与 一起使用<certificateReference>

  • 这个解决方案是?当你可以的时候帮助社区怎么样.../grumble (5认同)