Skip to content

Commit 29a5936

Browse files
committed
Rename config file and and filter option (text besed) in certs to use.
1 parent 24d6354 commit 29a5936

7 files changed

Lines changed: 263 additions & 208 deletions

File tree

CHANGELOG.MD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
- Improved certificate information display with better visual feedback
1818
- Added intuitive forms for managing timestamp server configurations
1919
- Context-aware UI labels that change based on signing type (Trusted Signing vs. traditional methods)
20+
- Added search functionality for certificates (Windows Certificate Store) for name, thumbprint and issuer in the list
2021

2122
### 🔒 Security Improvements
2223
- **Major Security Enhancement**: Completely redesigned password encryption system
@@ -54,6 +55,7 @@
5455
- Improved machine-specific key generation using multiple entropy sources
5556
- Added comprehensive error handling and logging for security operations
5657
- Backward compatibility maintained through automatic password migration system
58+
- Changed configuration file name to `Config.ini` for clarity (previously `Data.ini`)
5759

5860
---
5961

src/SignToolGUI.sln

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1616
EndProject
1717
Project("{840C416C-B8F3-42BC-B0DD-F6BB14C9F8CB}") = "SignToolGUI Installer", "AI Setup Project\SignToolGUI Installer.aiproj", "{EED69928-407C-4C65-89A8-56244E46764D}"
1818
EndProject
19-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items (2)", "Solution Items (2)", "{17D2B0EB-13B6-4E9E-BEF2-4D99470588B4}"
20-
ProjectSection(SolutionItems) = preProject
21-
..\CHANGELOG.MD = ..\CHANGELOG.MD
22-
..\LICENSE.md = ..\LICENSE.md
23-
..\Notes.md = ..\Notes.md
24-
..\README.md = ..\README.md
25-
..\SECURITY.md = ..\SECURITY.md
26-
EndProjectSection
27-
EndProject
2819
Global
2920
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3021
All|Any CPU = All|Any CPU

src/SignToolGUI/Class/Files.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public static string ConfigIniPath
99
get
1010
{
1111
// Path to the configuration file
12-
var configIniPathvar = ProgramDataFilePath + @"\Data.ini";
12+
var configIniPathvar = ProgramDataFilePath + @"\Config.ini";
1313
return configIniPathvar;
1414
}
1515
}
Lines changed: 136 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -1,139 +1,139 @@
1-
using System;
2-
using System.IO;
3-
using System.Text.Json;
4-
5-
namespace SignToolGUI.Class
6-
{
7-
internal sealed class SignerTrustedSigning : SignerBase
8-
{
9-
public string DlibPath { get; set; }
10-
public string DmdfPath { get; set; }
11-
12-
private readonly string _timestampServer; // Always "http://timestamp.acs.microsoft.com"
13-
private readonly string _codeSigningAccountName;
14-
private readonly string _certificateProfileName;
15-
private readonly string _correlationIdData;
16-
private readonly string _endpointServer; // Regional Azure endpoint for signing
17-
18-
public SignerTrustedSigning(string executable, string timestampServer, string dlibPath, string codeSigningAccountName, string certificateProfileName, string correlationIdData, string endpointServer, TimestampManager timestampManager = null)
19-
: base(executable, timestampManager)
20-
{
21-
_timestampServer = timestampServer; // Should always be "http://timestamp.acs.microsoft.com"
22-
DlibPath = dlibPath;
23-
_codeSigningAccountName = codeSigningAccountName;
24-
_certificateProfileName = certificateProfileName;
25-
_correlationIdData = correlationIdData;
26-
_endpointServer = endpointServer; // Regional endpoint from TimestampManager
27-
DmdfPath = CreateTempJsonFile();
28-
}
29-
30-
// Destructor to clean up the temporary JSON file
31-
~SignerTrustedSigning()
32-
{
33-
try
34-
{
35-
if (!string.IsNullOrEmpty(DmdfPath) && File.Exists(DmdfPath))
36-
{
37-
File.Delete(DmdfPath);
38-
}
39-
}
40-
catch (Exception)
41-
{
42-
// Ignore exceptions during cleanup
43-
}
44-
}
45-
46-
private string CreateTempJsonFile()
47-
{
48-
// Create a JSON file with the required parameters
49-
var jsonContent = new
50-
{
51-
Endpoint = _endpointServer, // Use the regional endpoint here
52-
CodeSigningAccountName = _codeSigningAccountName,
53-
CertificateProfileName = _certificateProfileName,
54-
CorrelationIdData = _correlationIdData
55-
// You can add "CorrelationId" here if needed
56-
};
57-
58-
// Serialize the JSON content
59-
var options = new JsonSerializerOptions
60-
{
61-
WriteIndented = true // This will format the JSON with indentation and new lines
62-
};
63-
64-
// Create a temporary file with the JSON content
65-
string tempFilePath = Path.GetTempFileName();
66-
string jsonFilePath = Path.ChangeExtension(tempFilePath, ".json");
67-
68-
// Write the JSON content to the file
69-
File.WriteAllText(jsonFilePath, JsonSerializer.Serialize(jsonContent, options));
70-
71-
// Return the path to the JSON file
72-
return jsonFilePath;
73-
}
74-
75-
protected override string BuildSigningArguments(string targetAssembly, string timestampUrl = null)
76-
{
77-
// Check if the Dlib path is set
78-
if (string.IsNullOrEmpty(DlibPath))
79-
{
80-
throw new InvalidOperationException("Dlib path is not set!");
81-
}
82-
83-
// Check if the Dlib file exists
84-
if (!File.Exists(DlibPath))
85-
{
86-
throw new InvalidOperationException($"Dlib file not found at: {DlibPath}");
87-
}
88-
89-
// Check if the Dmdf path is set
90-
if (string.IsNullOrEmpty(DmdfPath))
91-
{
92-
throw new InvalidOperationException("Dmdf path is not set!");
93-
}
94-
95-
// Check if the Dmdf file exists
96-
if (!File.Exists(DmdfPath))
97-
{
98-
throw new InvalidOperationException($"Dmdf file not found at: {DmdfPath}");
99-
}
100-
101-
// For Trusted Signing, always use the fixed timestamp server
102-
// The timestampUrl parameter is ignored because Trusted Signing uses a fixed timestamp URL
103-
var arguments = $@"sign {GlobalOptionSwitches()} /fd sha256 /tr ""{_timestampServer}"" /td sha256 /dlib ""{DlibPath}"" /dmdf ""{DmdfPath}"" ""{targetAssembly}""";
104-
105-
return arguments;
106-
}
107-
108-
// Override the base method to handle endpoint switching for Trusted Signing
109-
public void UpdateEndpoint(string newEndpoint)
110-
{
111-
// Recreate the JSON file with the new endpoint
112-
var jsonContent = new
113-
{
114-
Endpoint = newEndpoint,
115-
CodeSigningAccountName = _codeSigningAccountName,
116-
CertificateProfileName = _certificateProfileName,
117-
CorrelationIdData = _correlationIdData
118-
};
119-
120-
var options = new JsonSerializerOptions
121-
{
122-
WriteIndented = true
123-
};
124-
125-
// Delete old file if it exists
126-
if (!string.IsNullOrEmpty(DmdfPath) && File.Exists(DmdfPath))
127-
{
128-
File.Delete(DmdfPath);
129-
}
130-
131-
// Create new JSON file with updated endpoint
132-
string tempFilePath = Path.GetTempFileName();
133-
string jsonFilePath = Path.ChangeExtension(tempFilePath, ".json");
1+
using System;
2+
using System.IO;
3+
using System.Text.Json;
4+
5+
namespace SignToolGUI.Class
6+
{
7+
internal sealed class SignerTrustedSigning : SignerBase
8+
{
9+
public string DlibPath { get; set; }
10+
public string DmdfPath { get; set; }
11+
12+
private readonly string _timestampServer; // Always "http://timestamp.acs.microsoft.com"
13+
private readonly string _codeSigningAccountName;
14+
private readonly string _certificateProfileName;
15+
private readonly string _correlationIdData;
16+
private readonly string _endpointServer; // Regional Azure endpoint for signing
17+
18+
public SignerTrustedSigning(string executable, string timestampServer, string dlibPath, string codeSigningAccountName, string certificateProfileName, string correlationIdData, string endpointServer, TimestampManager timestampManager = null)
19+
: base(executable, timestampManager)
20+
{
21+
_timestampServer = timestampServer; // Should always be "http://timestamp.acs.microsoft.com"
22+
DlibPath = dlibPath;
23+
_codeSigningAccountName = codeSigningAccountName;
24+
_certificateProfileName = certificateProfileName;
25+
_correlationIdData = correlationIdData;
26+
_endpointServer = endpointServer; // Regional endpoint from TimestampManager
27+
DmdfPath = CreateTempJsonFile();
28+
}
29+
30+
// Destructor to clean up the temporary JSON file
31+
~SignerTrustedSigning()
32+
{
33+
try
34+
{
35+
if (!string.IsNullOrEmpty(DmdfPath) && File.Exists(DmdfPath))
36+
{
37+
File.Delete(DmdfPath);
38+
}
39+
}
40+
catch (Exception)
41+
{
42+
// Ignore exceptions during cleanup
43+
}
44+
}
45+
46+
private string CreateTempJsonFile()
47+
{
48+
// Create a JSON file with the required parameters
49+
var jsonContent = new
50+
{
51+
Endpoint = _endpointServer, // Use the regional endpoint here
52+
CodeSigningAccountName = _codeSigningAccountName,
53+
CertificateProfileName = _certificateProfileName,
54+
CorrelationIdData = _correlationIdData
55+
// You can add "CorrelationId" here if needed
56+
};
57+
58+
// Serialize the JSON content
59+
var options = new JsonSerializerOptions
60+
{
61+
WriteIndented = true // This will format the JSON with indentation and new lines
62+
};
63+
64+
// Create a temporary file with the JSON content
65+
string tempFilePath = Path.GetTempFileName();
66+
string jsonFilePath = Path.ChangeExtension(tempFilePath, ".json");
67+
68+
// Write the JSON content to the file
69+
File.WriteAllText(jsonFilePath, JsonSerializer.Serialize(jsonContent, options));
70+
71+
// Return the path to the JSON file
72+
return jsonFilePath;
73+
}
74+
75+
protected override string BuildSigningArguments(string targetAssembly, string timestampUrl = null)
76+
{
77+
// Check if the Dlib path is set
78+
if (string.IsNullOrEmpty(DlibPath))
79+
{
80+
throw new InvalidOperationException("Dlib path is not set!");
81+
}
82+
83+
// Check if the Dlib file exists
84+
if (!File.Exists(DlibPath))
85+
{
86+
throw new InvalidOperationException($"Dlib file not found at: {DlibPath}");
87+
}
88+
89+
// Check if the Dmdf path is set
90+
if (string.IsNullOrEmpty(DmdfPath))
91+
{
92+
throw new InvalidOperationException("Dmdf path is not set!");
93+
}
94+
95+
// Check if the Dmdf file exists
96+
if (!File.Exists(DmdfPath))
97+
{
98+
throw new InvalidOperationException($"Dmdf file not found at: {DmdfPath}");
99+
}
100+
101+
// For Trusted Signing, always use the fixed timestamp server
102+
// The timestampUrl parameter is ignored because Trusted Signing uses a fixed timestamp URL
103+
var arguments = $@"sign {GlobalOptionSwitches()} /fd sha256 /tr ""{_timestampServer}"" /td sha256 /dlib ""{DlibPath}"" /dmdf ""{DmdfPath}"" ""{targetAssembly}""";
104+
105+
return arguments;
106+
}
107+
108+
// Override the base method to handle endpoint switching for Trusted Signing
109+
public void UpdateEndpoint(string newEndpoint)
110+
{
111+
// Recreate the JSON file with the new endpoint
112+
var jsonContent = new
113+
{
114+
Endpoint = newEndpoint,
115+
CodeSigningAccountName = _codeSigningAccountName,
116+
CertificateProfileName = _certificateProfileName,
117+
CorrelationIdData = _correlationIdData
118+
};
119+
120+
var options = new JsonSerializerOptions
121+
{
122+
WriteIndented = true
123+
};
124+
125+
// Delete old file if it exists
126+
if (!string.IsNullOrEmpty(DmdfPath) && File.Exists(DmdfPath))
127+
{
128+
File.Delete(DmdfPath);
129+
}
130+
131+
// Create new JSON file with updated endpoint
132+
string tempFilePath = Path.GetTempFileName();
133+
string jsonFilePath = Path.ChangeExtension(tempFilePath, ".json");
134134
File.WriteAllText(jsonFilePath, JsonSerializer.Serialize(jsonContent, options));
135135

136-
DmdfPath = jsonFilePath;
137-
}
138-
}
136+
DmdfPath = jsonFilePath;
137+
}
138+
}
139139
}

0 commit comments

Comments
 (0)