Skip to content

Commit 0de4595

Browse files
committed
Update cert handling and add LOCAL_DEPLOY support
- Update ModdingToolBase submodule to latest commit - Add LOCAL_DEPLOY constant for local deployment builds - Embed modverify-trust.cer as a resource if present - Register trusted certs at runtime, supporting dev certs in DEBUG/LOCAL_DEPLOY - Refactor Program.cs to use embedded cert resource name constant
1 parent f09bc6c commit 0de4595

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

modules/ModdingToolBase

Submodule ModdingToolBase updated 44 files

src/ModVerify.CliApp/ModVerify.CliApp.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,17 @@
2525
<NBGV_ThisAssemblyIncludesPackageVersion>true</NBGV_ThisAssemblyIncludesPackageVersion>
2626
</PropertyGroup>
2727

28+
<!-- Set /p:LocalDeploy=true (e.g. from deploy-local.ps1) to compile in the local-deploy dev
29+
trust cert pickup path. Off by default; release builds never see it. -->
30+
<PropertyGroup Condition="'$(LocalDeploy)' == 'true'">
31+
<DefineConstants>$(DefineConstants);LOCAL_DEPLOY</DefineConstants>
32+
</PropertyGroup>
33+
2834
<ItemGroup>
2935
<EmbeddedResource Include="Resources\Baselines\baseline-foc.json" />
36+
<EmbeddedResource Include="Resources\Certs\modverify-trust.cer"
37+
LogicalName="AET.ModVerify.App.Resources.Certs.modverify-trust.cer"
38+
Condition="Exists('Resources\Certs\modverify-trust.cer')" />
3039
</ItemGroup>
3140

3241
<ItemGroup>

src/ModVerify.CliApp/Program.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,21 @@ protected override IRegistry CreateRegistry()
185185
: new WindowsRegistry();
186186
}
187187

188+
private const string EmbeddedTrustCertResource = "AET.ModVerify.App.Resources.Certs.modverify-trust.cer";
189+
188190
protected override async Task<int> RunAppAsync(string[] args, IServiceProvider appServiceProvider)
189191
{
192+
if (IsUpdateableApplication)
193+
{
194+
string? devCertPath = null;
195+
#if DEBUG || LOCAL_DEPLOY
196+
devCertPath = System.IO.Path.GetFullPath(
197+
System.IO.Path.Combine(AppContext.BaseDirectory, "..", "dev-trust.cer"));
198+
#endif
199+
appServiceProvider.GetRequiredService<CertificateManager>()
200+
.RegisterTrustedCertificates(typeof(Program).Assembly, EmbeddedTrustCertResource, devCertPath);
201+
}
202+
190203
var result = await HandleUpdate(appServiceProvider);
191204
if (result != 0 || _modVerifyAppSettings is null)
192205
return result;

0 commit comments

Comments
 (0)