1
1
Signing
2
2
=======
3
3
4
- KoreBuild supports generating a signing request manfiest. This includes a list of all files that should be signed
5
- and information about the strongname or certificate that should be used.
6
-
7
- ## Format
8
-
9
- The signing request manifest supports three element types. A minimal example looks like this. See [ Elements] ( #Elements ) below for details
10
-
11
- ``` xml
12
- <SigningRequest >
13
- <File Path =" MyAssembly.dll" Certificate =" MyCert" StrongName =" MyStrongName" />
14
- <File Path =" build/Another.dll" Certificate =" MyCert" />
15
- <Container Path =" MyLib.1.0.0.nupkg" Type =" nupkg" Certificate =" NuGetCert" >
16
- <File Path =" lib/netstandard2.0/MyLib.dll" Certificate =" MyCert" />
17
- </Container >
18
- <Container Path =" MyVSTool.vsix" Type =" vsix" Certificate =" VsixCert" >
19
- <File Path =" MyVSTool.dll" Certificate =" MyCert" />
20
- <!-- excluded from signing, but useful if you want to assert all files in a container are accounted for. -->
21
- <ExcludedFile Path =" NotMyLib.dll" />
22
- </Container >
23
- </SigningRequest >
24
- ```
4
+ KoreBuild supports code signing files and using MSBuild to configure the list of files which are code-signed.
25
5
26
6
## Config via csproj
27
7
@@ -38,51 +18,38 @@ To sign assemblies, set the AssemblySigningCertName and AssemblySigningStrongNam
38
18
</PropertyGroup >
39
19
```
40
20
41
- This will generate a signing request like this:
42
-
43
- ``` xml
44
- <SigningRequest >
45
- <File Path =" MyLib.dll" Certificate =" MyCert" StrongName =" PrivateStrongName" />
46
- </SigningRequest >
47
- ```
48
-
49
21
### NuGet packages
50
22
51
23
To sign NuGet packages, set the PackageSigningCertName property in the \* .csproj that produces the nupkg.
52
24
53
25
``` xml
54
26
<PropertyGroup >
55
- <PackageSigningCertName >NuGetCert </PackageSigningCertName >
27
+ <PackageSigningCertName >MyNuGetCert </PackageSigningCertName >
56
28
</PropertyGroup >
57
29
```
58
30
59
- This will generate a signing request like this:
60
-
61
- ``` xml
62
- <SigningRequest >
63
- <Container Path =" MyLib.1.0.0.nupkg" Type =" nupkg" Certificate =" NuGetCert" />
64
- </SigningRequest >
65
- ```
66
-
67
31
### NuGet packages with assemblies
68
32
69
33
For assemblies that ship in a NuGet package, you can specify multiple properties.
70
34
71
35
``` xml
72
36
<PropertyGroup >
73
37
<AssemblySigningCertName >MyCert</AssemblySigningCertName >
74
- <PackageSigningCertName >NuGetCert </PackageSigningCertName >
38
+ <PackageSigningCertName >MyNuGetCert </PackageSigningCertName >
75
39
</PropertyGroup >
76
40
```
77
41
78
- This will generate a signing request like this:
42
+ ### Recommended cert names for Microsoft projects
43
+
44
+ The following certificate names should be used for Microsoft projects. These MSBuild properties are also available by using Internal.AspNetCore.SDK.
79
45
80
46
``` xml
81
- <SigningRequest >
82
- <Container Path =" MyLib.1.0.0.nupkg" Type =" nupkg" Certificate =" NuGetCert" >
83
- <File Path =" lib/netstandard2.0/MyLib.dll" Certificate =" MyCert" />
84
- </Container >
85
- </SigningRequest >
47
+ <AssemblySigningCertName >Microsoft400</AssemblySigningCertName >
48
+ <AssemblySigning3rdPartyCertName >3PartySHA2</AssemblySigning3rdPartyCertName >
49
+ <PowerShellSigningCertName >Microsoft400</PowerShellSigningCertName >
50
+ <PackageSigningCertName >NuGet</PackageSigningCertName >
51
+ <VsixSigningCertName >VsixSHA2</VsixSigningCertName >
52
+ <JarSigningCertName >MicrosoftJAR</JarSigningCertName >
86
53
```
87
54
88
55
### Projects using nuspec
@@ -108,20 +75,24 @@ Sometimes other signable assemblies end up in a nupkg. Signing for these file ty
108
75
109
76
``` xml
110
77
<ItemGroup >
111
- <!-- Files that come from other ASP.NET Core projects -->
112
- <SignedPackageFile Include =" $(PublishDir)Microsoft.Extensions.Configuration.Abstractions.dll" Certificate =" $(AssemblySigningCertName)" PackagePath =" tools/Microsoft.Extensions.Configuration.Abstractions.dll" Visible =" false" />
78
+ <!-- Specifying signing for a file in a package. -->
79
+ <SignedPackageFile Include =" tools/Microsoft.Extensions.Configuration.Abstractions.dll" Certificate =" $(AssemblySigningCertName)" Visible =" false" />
80
+
81
+ <!-- Specifying signing for a file in a package using an explicit path within the NuGet package. -->
82
+ <SignedPackageFile Include =" $(OutputPath)$(TargetFileName)" Certificate =" $(AssemblySigningCertName)"
83
+ PackagePath =" tasks/net461/$(TargetFileName)" Visible =" false" />
113
84
114
85
<!-- Third-party cert -->
115
- <SignedPackageFile Include =" $(PublishDir) Newtonsoft.Json.dll" Certificate =" 3PartyDual " PackagePath = " tools/Newtonsoft.Json.dll " Visible =" false" />
86
+ <SignedPackageFile Include =" tools/ Newtonsoft.Json.dll" Certificate =" 3PartySHA2 " Visible =" false" />
116
87
117
88
<!-- This should already be signed by the dotnet-core team -->
118
- <ExcludePackageFileFromSigning Include =" $(PublishDir)System.Runtime.CompilerServices.Unsafe.dll " PackagePath = " tools/System.Runtime.CompilerServices.Unsafe.dll" Visible = " false " />
89
+ <ExcludePackageFileFromSigning Include =" tools/System.Runtime.CompilerServices.Unsafe.dll" />
119
90
</ItemGroup >
120
91
```
121
92
122
93
### Disabling signing
123
94
124
- You can disable sign request generation on an MSBuild project by setting DisableCodeSigning.
95
+ You can disable sign request generation on an MSBuild project by setting DisableCodeSigning, or for an entire repo (via repo.props) .
125
96
126
97
``` xml
127
98
<PropertyGroup >
@@ -137,50 +108,9 @@ these elements to the `build/repo.props` file. (See also [KoreBuild.md](./KoreBu
137
108
``` xml
138
109
<!-- build/repo.props -->
139
110
<ItemGroup >
140
- <FilesToSign Include =" $(ArtifactsDir)libuv.dll" Certificate =" 3PartyDual " />
111
+ <FilesToSign Include =" $(ArtifactsDir)libuv.dll" Certificate =" 3PartySHA2 " />
141
112
142
113
<!-- Files can also be listed as "do not sign", for completeness -->
143
- <FilesToExcludeFromSigning Include =" $(ArtifactsDir)my.test.dll" Certificate =" 3PartyDual " />
114
+ <FilesToExcludeFromSigning Include =" $(ArtifactsDir)my.test.dll" Certificate =" 3PartySHA2 " />
144
115
</ItemGroup >
145
116
```
146
-
147
- ## Elements
148
-
149
- #### ` SigningRequest `
150
-
151
- Root element. No options.
152
-
153
- #### ` File `
154
-
155
- A file to be signed.
156
-
157
- ** Path** - file path, relative to the file path. If nested in a ` <Container> ` , is relative to the organization within the container
158
-
159
- ** Certificate** - the name of the certificate to use
160
-
161
- ** StrongName** - for assemblies only. This is used to strong name assemblies that were delay signed in public.
162
-
163
- #### ` Container `
164
-
165
- A container is an archive file, installer, or some kind of bundle that can be signed, or that has files that can be signed
166
- inside it. Nested elements can be added for ` <File> ` and ` <ExcludedFile> ` .
167
-
168
- ** Path** - file path to the container
169
-
170
- ** Certificate** - the name of the certificate to use
171
-
172
- ** Type** - The type of the container. Instructs the consumer how to extract the container. Example values:
173
-
174
- - zip
175
- - tar.gz
176
- - vsix
177
- - nupkg
178
- - msi
179
-
180
- #### ` ExcludedFile `
181
-
182
- This is useful when you want to exclude files within a container from being signed, but want to assert that
183
- all files in a container are accounted for.
184
-
185
- ** Path** - file path to a file to be ignored by the signing tool
186
-
0 commit comments