资讯详情

创建自签名证书, 对exe文件进行数字签名

操作只需几个简单的步骤:

New-SelfSignedCertificate -Type Custom -Subject "CN=姓名, O=公司名称, C=CN, L=上海, S=上海" -KeyUsage DigitalSignature -FriendlyName "MailTool" -CertStoreLocation "Cert:\CurrentUser\My" -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.3", "2.5.29.19={text}") -NotAfter (Get-Date).AddYears(10)

$password = ConvertTo-SecureString -String 123456 -Force -AsPlainText

Export-PfxCertificate -cert "Cert:\CurrentUser\My\1F1B377E08BE74E2D739F0FC638370A93DF0D946" -FilePath C:\Users\admin\Desktop\dump\签名\test.pfx -Password $password

下面已经生成了我们观察的签名目录test.pfx文件

管理员运行,并切换到签名目录,执行以下命令:

"C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64\signtool.exe" sign /f test.pfx /p 123456 /t http://timestamp.digicert.com /v "test.exe"

这个signtool.exe是安装Windows开发包的时候自带,我的路径,具体找,执行命令后的结果如下:

我们查看下Test.exe的证书

好了,已经可以了。

参考文章:

微软官方文件:

New-SelfSignedCertificate (pki) | Microsoft Docs

SignTool.exe (Sign Tool) - .NET Framework | Microsoft Docs

博客:

https://www.jianshu.com/p/526fbb0e3134

标签: a93z73m9bm9n传感器

锐单商城拥有海量元器件数据手册IC替代型号,打造 电子元器件IC百科大全!

锐单商城 - 一站式电子元器件采购平台