@@ -416,7 +416,7 @@ private void PopulateComboBox()
416416
417417 if ( radioButtonTrustedSigning . Checked )
418418 {
419- // Switch to Trusted Signing servers - but only if we don't already have a loaded configuration
419+ // For Trusted Signing: Use endpoint servers, but timestamp is always fixed
420420 var currentServers = _timestampManager . GetServers ( ) ;
421421 var hasLoadedConfig = currentServers . Any ( s => s . Url . Contains ( "codesigning.azure.net" ) ) ;
422422
@@ -434,12 +434,15 @@ private void PopulateComboBox()
434434
435435 groupBoxTimestamp . Text = @"Trusted Signing Endpoint" ;
436436 labelTimestampProvider . Text = @"Endpoint region:" ;
437+ labelTimeStampServer . Text = @"Timestamp URL:" ;
438+
439+ // For Trusted Signing, timestamp URL is always fixed
437440 txtTimestampProviderURL . Text = @"http://timestamp.acs.microsoft.com" ;
438- labelTimeStampServer . Text = @"Endpoint URL:" ;
441+ txtTimestampProviderURL . ReadOnly = true ;
439442 }
440443 else
441444 {
442- // Switch to default timestamp servers - but only if we don't already have a loaded configuration
445+ // For PFX and Certificate Store: Use timestamp servers from configuration
443446 var currentServers = _timestampManager . GetServers ( ) ;
444447 var hasLoadedConfig = currentServers . Any ( s => s . Url . Contains ( "timestamp.sectigo.com" ) ||
445448 s . Url . Contains ( "timestamp.digicert.com" ) ) ;
@@ -451,7 +454,8 @@ private void PopulateComboBox()
451454
452455 var servers = _timestampManager . GetServers ( ) ;
453456
454- foreach ( var server in servers )
457+ // Only add enabled servers to the dropdown for regular timestamp servers
458+ foreach ( var server in servers . Where ( s => s . IsEnabled ) . OrderBy ( s => s . Priority ) )
455459 {
456460 comboBoxTimestampProviders . Items . Add ( new TimestampProvider ( server . DisplayName , server . Url ) ) ;
457461 }
@@ -461,8 +465,11 @@ private void PopulateComboBox()
461465
462466 groupBoxTimestamp . Text = @"Timestamp" ;
463467 labelTimestampProvider . Text = @"Provider:" ;
464- txtTimestampProviderURL . Text = "" ;
465468 labelTimeStampServer . Text = @"Timestamp URL:" ;
469+
470+ // For regular timestamp servers, make URL editable when "Custom Provider" is selected
471+ txtTimestampProviderURL . ReadOnly = false ;
472+ txtTimestampProviderURL . Text = "" ;
466473 }
467474
468475 // Restore the previous selected index and item if they exist and are valid
@@ -602,10 +609,6 @@ private void RadioButtonSelectCertificateLocation_CheckedChanged(object sender,
602609 textBoxSignToolPath . Enabled = false ;
603610 buttonBrowseSignTool . Enabled = false ;
604611
605- // Set the timestamp group box text and label text
606- groupBoxTimestamp . Text = @"Trusted Signing Endpoint" ;
607- labelTimeStampServer . Text = @"Endpoint URL:" ;
608-
609612 // Set the tooltip for the timestamp checkbox
610613 toolTip . SetToolTip ( checkBoxTimestamp , "Trusted Signing requires a timestamp. This option is disabled for Trusted Signing." ) ;
611614 }
@@ -631,10 +634,6 @@ private void RadioButtonSelectCertificateLocation_CheckedChanged(object sender,
631634 textBoxSignToolPath . Enabled = true ;
632635 buttonBrowseSignTool . Enabled = true ;
633636
634- // Set the timestamp group box text and label text
635- groupBoxTimestamp . Text = @"Timestamp URL:" ;
636- labelTimeStampServer . Text = @"Timestamp" ;
637-
638637 // Reset the tooltip for the timestamp checkbox
639638 toolTip . SetToolTip ( checkBoxTimestamp , "Check this box to timestamp the signed file(s)." ) ;
640639 }
@@ -826,23 +825,36 @@ private void comboBoxTimestampProviders_SelectedIndexChanged(object sender, Even
826825 TimestampProvider selectedProvider = comboBox . SelectedItem as TimestampProvider ;
827826 if ( selectedProvider == null ) return ;
828827
829- // Update the timestamp provider URL text box with the selected provider's URL.
830- txtTimestampProviderURL . Text = selectedProvider . Url ;
831-
832- // Get the selected index from the timestamp providers combo box.
833- var index = comboBoxTimestampProviders . SelectedIndex ;
834-
835- // If the selected index is not 5, make the timestamp provider URL text box read-only.
836- if ( index != 5 )
828+ if ( radioButtonTrustedSigning . Checked )
837829 {
838- // Make the timestamp provider URL text box read-only.
830+ // For Trusted Signing: The selected item is an endpoint, but timestamp URL is always fixed
831+ // The selectedProvider.Url is the endpoint URL, not the timestamp URL
832+
833+ // Keep the timestamp URL fixed for Trusted Signing
834+ txtTimestampProviderURL . Text = @"http://timestamp.acs.microsoft.com" ;
839835 txtTimestampProviderURL . ReadOnly = true ;
836+
837+ // Store the selected endpoint for use during signing (this should be handled in the signing logic)
838+ // The actual endpoint selection happens in the signing process
840839 }
841840 else
842841 {
843- // If the selected index is 5, clear the timestamp provider URL text box and make it editable.
844- txtTimestampProviderURL . Clear ( ) ;
845- txtTimestampProviderURL . ReadOnly = false ;
842+ // For regular timestamp servers: Update the URL based on selection
843+
844+ // Check if "Custom Provider" is selected
845+ if ( selectedProvider . DisplayName == "Custom Provider" )
846+ {
847+ // If Custom Provider is selected, clear the URL and make it editable
848+ txtTimestampProviderURL . Clear ( ) ;
849+ txtTimestampProviderURL . ReadOnly = false ;
850+ txtTimestampProviderURL . Focus ( ) ; // Set focus to the text box for user input
851+ }
852+ else
853+ {
854+ // Update the timestamp provider URL text box with the selected provider's URL
855+ txtTimestampProviderURL . Text = selectedProvider . Url ;
856+ txtTimestampProviderURL . ReadOnly = true ;
857+ }
846858 }
847859 }
848860
@@ -1563,12 +1575,36 @@ private async Task SignWithTrustedSigningAsync()
15631575 // Get the values from the form's controls for the SignerTrustedSigning class
15641576 var signToolExe = textBoxSignToolPath . Text ;
15651577 var timeStampServer = "http://timestamp.acs.microsoft.com" ; // Fixed timestamp server for Trusted Signing
1566- var endpointServer = txtTimestampProviderURL . Text ; // This is actually the regional endpoint
1578+
1579+ // Get the selected endpoint from the ComboBox
1580+ string endpointServer = "" ;
1581+ if ( comboBoxTimestampProviders . SelectedItem is TimestampProvider selectedProvider )
1582+ {
1583+ endpointServer = selectedProvider . Url ;
1584+ }
1585+ else
1586+ {
1587+ // Fallback to first enabled server if nothing is selected
1588+ var enabledServers = _timestampManager . GetEnabledServers ( ) ;
1589+ if ( enabledServers . Count > 0 )
1590+ {
1591+ endpointServer = enabledServers . First ( ) . Url ;
1592+ }
1593+ else
1594+ {
1595+ MessageBox . Show ( "No enabled Trusted Signing endpoints available." , "Configuration Error" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
1596+ return ;
1597+ }
1598+ }
1599+
15671600 var dlibPath = @".\Tools\Azure.CodeSigning.Dlib.dll" ;
15681601 var codeSigningAccountName = textBoxCodeSigningAccountName . Text ;
15691602 var certificateProfileName = textBoxCertificateProfileName . Text ;
15701603 var correlationIdData = textBoxCorrelationId . Text ;
15711604
1605+ // Log which endpoint is being used
1606+ Message ( $ "Using Trusted Signing endpoint: { endpointServer } ", EventType . Information , 3025 ) ;
1607+
15721608 // Disable the form's controls while signing the files
15731609 ToggleDisabledForm ( true ) ;
15741610
0 commit comments