-
Notifications
You must be signed in to change notification settings - Fork 0
Hotfix Digital Signature Validation
RPoenar edited this page May 22, 2026
·
1 revision
This document describes the process of creating the public certificate (.cer), signing SQL hotfixes, and validating them inside DatabaseUpdater.
If a .pfx certificate already exists and is used for ClickOnce / Code Signing:
- Import the
.pfxinto Windows:
certmgr.msc
→ Personal
→ Certificates
- Right click the certificate:
All Tasks → Export
- Select:
NO, do not export private key
- Choose format:
DER encoded binary X.509 (.CER)
- Save the file as:
hotfix-public.cer
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2(
"certificate.pfx",
"PASSWORD"
)
Export-Certificate `
-Cert $cert `
-FilePath "hotfix-public.cer"Inside the LicenseGenerator utility, open the SignHotfixes tab.
Steps:
- Select the hotfix folder
- Select the signing certificate (
.pfx) - Enter the certificate password
- Select
hotfix-public.cer - Click Scan files
- Click Sign missing signatures
For every SQL file:
001_Fix.sql
↓
001_Fix.sql.sig
The .sig file must always be published together with the .sql file on the portal.
Example:
1.2604.0
│
├── 001_Fix.sql
├── 001_Fix.sql.sig
│
├── 002_Fix.sql
└── 002_Fix.sql.sig
The validation certificate must be added to the DatabaseUpdater project.
Project structure:
DatabaseUpdater
│
├── Certificates
│ └── hotfix-public.cer
│
├── UpdateHelper.cs
└── ...
File properties:
Build Action = Content
Copy to Output Directory = Copy if newer
Certificate loading:
Path.Combine(
AppDomain.CurrentDomain.BaseDirectory,
"Certificates",
"hotfix-public.cer")During ApplyHotFixes() execution:
- SQL file is downloaded
- Signature file (
.sig) existence is checked - Signature validation is performed
- If signature is missing or invalid:
-
UpdateCommandis created - Hotfix is NOT executed
-
UpdateCommandStoresis marked as Failed - Error message is stored in
ErrorMessage
- If signature is valid:
- SQL script is executed
Flow:
Download SQL
↓
Check .sig existence
↓
Validate signature
↓
Valid? ───── No ─────→ Failed / Not Executed
│
Yes
↓
Execute SQL
UpdateCommandStores.IsOk = true
ErrorMessage = rows affected
UpdateCommandStores.IsOk = false
ErrorMessage = error description
Examples:
Missing signature file...
Invalid hotfix signature...
SQL execution errors...
Detailed examples:
Missing signature file for hotfix '001_fix.sql'
Expected signature url:
http://portal/.../Fix001.sql.sig
HTTP Status: 404 Not Found
Invalid hotfix signature.
The SQL file may have been modified after signing.
Invalid object name...
- The private key (
.pfx) must never be distributed. - Any modification after signing invalidates the signature.
- Missing or invalid signatures prevent hotfix execution.