网站首页 全球最实用的IT互联网站!

人工智能P2P分享Wind搜索发布信息网站地图标签大全

当前位置:诺佳网 > 软件工程 > 其他技术区 > 代码与软件发布 >

创建自签名证书并导出为pfx文件

时间:2026-01-08 17:07

人气:

作者:admin

标签:

导读:自签名证书仅用于测试安装,MSIX上传到微软商店时可以不签名。 使用 New-SelfSignedCertificate 创建自签名证书 New-SelfSignedCertificate -Type Custom -KeyUsage DigitalSignature -CertStoreLocat...

自签名证书仅用于测试安装,MSIX上传到微软商店时可以不签名。

New-SelfSignedCertificate -Type Custom -KeyUsage DigitalSignature -CertStoreLocation "Cert:\CurrentUser\My" -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.3", "2.5.29.19={text}") -Subject "CN=Contoso Software, O=Contoso Corporation, C=US" -FriendlyName "Your friendly name goes here"

如果要上传到微软商店,Subject参数要对应产品标识页面的Package/Identity/Publisher

可以使用以下命令在 PowerShell 窗口中查看证书:

Set-Location Cert:\CurrentUser\My
Get-ChildItem | Format-Table Subject, FriendlyName, Thumbprint

若要将新创建的证书导入本地计算机受信任人员证书存储,需要首先使用 Export-PfxCertificate cmdlet 将其导出到个人信息交换 (PFX) 文件。

使用 Export-PfxCertificate 时,必须创建和使用密码,或使用“-ProtectTo”参数指定哪些用户或组可以在不使用密码的情况下访问文件。 请注意,如果不使用“-Password”或“-ProtectTo”参数,则会显示错误。 建议使用“-Password”进行常规使用,而当用户帐户由域控制器提供支持时,“-ProtectTo”非常有用。

$password = ConvertTo-SecureString -String <Your Password> -Force -AsPlainText 
Export-PfxCertificate -cert "Cert:\CurrentUser\My\<Certificate Thumbprint>" -FilePath <FilePath>.pfx -Password $password
Export-PfxCertificate -cert Cert:\CurrentUser\My\<Certificate Thumbprint> -FilePath <FilePath>.pfx -ProtectTo <Username or group name>

使用signtool

SignTool sign /fd <Hash Algorithm> /a /f <Path to Certificate>.pfx /p <Your Password> <File path>.msix

使用MSIX Packaging Tool

在创建包时选择签名证书

温馨提示:以上内容整理于网络,仅供参考,如果对您有帮助,留下您的阅读感言吧!
相关阅读
本类排行
相关标签
本类推荐

CPU | 内存 | 硬盘 | 显卡 | 显示器 | 主板 | 电源 | 键鼠 | 网站地图

Copyright © 2025-2035 诺佳网 版权所有 备案号:赣ICP备2025066733号
本站资料均来源互联网收集整理,作品版权归作者所有,如果侵犯了您的版权,请跟我们联系。

关注微信