security: 延长自签名证书有效期至10年,添加完整证书信息
- 证书有效期从5年延长至10年 - 添加完整证书信息:组织、部门、邮箱 - 增加证书可信度
This commit is contained in:
@@ -3,14 +3,15 @@
|
||||
|
||||
param(
|
||||
[string]$CertPassword = "WindowMsgBot2026",
|
||||
[string]$CertSubject = "CN=WindowMsgBot, O=WindowMsgBot Development",
|
||||
[int]$ValidYears = 5
|
||||
[string]$CertSubject = "CN=WindowMsgBot, O=WindowMsgBot Development, OU=Software Development, E=dev@windowmsgbot.local",
|
||||
[int]$ValidYears = 10
|
||||
)
|
||||
|
||||
Write-Host "=== 生成自签名代码签名证书 ===" -ForegroundColor Cyan
|
||||
|
||||
# 1. 生成证书
|
||||
Write-Host "1. 生成自签名证书..." -ForegroundColor Yellow
|
||||
# 使用更完整的证书参数,增加可信度
|
||||
$cert = New-SelfSignedCertificate `
|
||||
-Subject $CertSubject `
|
||||
-Type CodeSigningCert `
|
||||
@@ -19,7 +20,10 @@ $cert = New-SelfSignedCertificate `
|
||||
-KeyAlgorithm RSA `
|
||||
-KeyLength 2048 `
|
||||
-HashAlgorithm SHA256 `
|
||||
-FriendlyName "WindowMsgBot Code Signing Certificate"
|
||||
-FriendlyName "WindowMsgBot Code Signing Certificate" `
|
||||
-TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.3") `
|
||||
-KeyUsage DigitalSignature, KeyEncipherment `
|
||||
-KeyProtection None
|
||||
|
||||
if (-not $cert) {
|
||||
Write-Error "证书生成失败!"
|
||||
|
||||
Reference in New Issue
Block a user