-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathGenerateCertificate.ps1
129 lines (124 loc) · 7.56 KB
/
GenerateCertificate.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# Create an expiery for the certificate.
$todaydt = Get-Date
$expiery = $todaydt.AddMonths(48)
# Generate the certificate.
$NewSelfSignedCertificateParameters = @{
Subject = "CN=Air Signing Certificate"
Type = "CodeSigningCert"
NotAfter = $expiery
KeyAlgorithm = "RSA"
KeyLength = 2048
HashAlgorithm = "SHA1"
FriendlyName = "R3TestCertificate"
CertStoreLocation = "Cert:\CurrentUser\My"
}
$cert = New-SelfSignedCertificate @NewSelfSignedCertificateParameters
# Export the certificate as a pfx code signing key.
$password = Read-Host 'Choose a password for your key.' -AsSecureString
$fileOut = Join-Path $PSScriptRoot air-cert.p12
Export-PfxCertificate -Cert $cert -ChainOption BuildChain -Password $password -FilePath $fileOut
# Clean up the certificate from the Windows Certificate Store.
Get-ChildItem Cert:\CurrentUser\My |
Where-Object { $_.Thumbprint -match $cert.Thumbprint } |
Remove-Item
# SIG # Begin signature block
# MIISggYJKoZIhvcNAQcCoIISczCCEm8CAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCBXKYlr+f9ePAK/
# FF3suAzZPasTRc+aXChgcRKIp+FvM6CCDaQwggNpMIICUaADAgECAh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