我不是高级 Windows 用户,我只是想了解 Windows 10 将用户证书存储在哪里。
我在 powershell 中发出了此命令:
PS C:\Users\myself> ls Cert:\CurrentUser\My\
PSParentPath: Microsoft.PowerShell.Security\Certificate::CurrentUser\My
Thumbprint Subject
---------- -------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx CN......
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx CN......
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx CN......
作为确认,通过打开certmgr
我可以看到其中的证书
但是,当我浏览注册表时,我看不到其中的任何证书:
PS C:\Users\Myself> ls 'HKCU:\SOFTWARE\Microsoft\SystemCertificates\My\*'
PS C:\Users\Myself>
我也打开了该regedit
工具,但文件夹看起来是空的。
使用 regedit 在整个注册表中搜索指纹最终没有得到任何结果。
这是为什么?我做错了什么吗?这可能是权限问题,还是用户证书可能位于其他地方?
答案1
公钥和私钥并不存储在同一个地方。公钥存储在注册表中,而其关联的私钥存储在文件系统中。
我的公钥位于注册表中:
HKEY_CURRENT_USER\SOFTWARE\Microsoft\SystemCertificates
。
我在磁盘上找到了我的私钥:
C:\Users\USER-NAME\AppData\Roaming\Microsoft\SystemCertificates\My\Certificates
PowerShell 命令ls Cert:\CurrentUser\My\
返回带有公钥的已安装证书。
更多信息请参阅文章 系统商店位置。