Skip to content

Commit 89c87bf

Browse files
authored
Az.codesigning - fix regressions (Azure#26801)
* fix: regression failure using azure codesigning crypto provider By migrating to the rebranded Azure.Developer.TrustedSigning.CryptoProvider * docs: added changelog.md entries * fix: Polly dependency is still used on this version * fix: package of Polly should be on version 7.2.4
1 parent e7bc36e commit 89c87bf

File tree

6 files changed

+15
-14
lines changed

6 files changed

+15
-14
lines changed

src/CodeSigning/CodeSigning/Az.CodeSigning.psd1

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,8 @@ DotNetFrameworkVersion = '4.7.2'
5454
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '3.0.3'; })
5555

5656
# Assemblies that must be loaded prior to importing this module
57-
RequiredAssemblies = 'Azure.CodeSigning.Client.CryptoProvider.dll',
58-
'Azure.CodeSigning.Client.CryptoProvider.Models.dll',
59-
'Azure.CodeSigning.Client.CryptoProvider.Utilities.dll',
60-
'Azure.CodeSigning.dll', 'Polly.dll'
57+
RequiredAssemblies = 'Azure.Developer.TrustedSigning.CryptoProvider.dll',
58+
'Azure.CodeSigning.dll'
6159

6260
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
6361
# ScriptsToProcess = @()
@@ -75,7 +73,7 @@ NestedModules = @('Microsoft.Azure.PowerShell.Cmdlets.CodeSigning.dll')
7573
FunctionsToExport = @()
7674

7775
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
78-
CmdletsToExport = 'Get-AzCodeSigningCustomerEku', 'Get-AzCodeSigningRootCert',
76+
CmdletsToExport = 'Get-AzCodeSigningCustomerEku', 'Get-AzCodeSigningRootCert',
7977
'Get-AzCodeSigningCertChain', 'Invoke-AzCodeSigningCIPolicySigning'
8078

8179
# Variables to export from this module

src/CodeSigning/CodeSigning/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
-->
2020
## Upcoming Release
2121
* Upgraded Azure.Core to 1.44.1.
22+
* Upgraded to rebranded package Azure.Developer.TrustedSigning.CryptoProvider.
23+
* Upgraded to updated Azure.Codesigning.Sdk.
2224

2325
## Version 0.2.0
2426
* Added `Get-AzCodeSigningCertChain` cmdlet to retrieve the certificate chain for a certificate profile.

src/CodeSigning/CodeSigning/CodeSigning.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323

2424
<ItemGroup>
2525
<PackageReference Include="Polly" Version="7.2.4" />
26-
<PackageReference Include="Azure.CodeSigning.Client.CryptoProvider" Version="0.1.16" />
27-
<PackageReference Include="Azure.CodeSigning.Sdk" Version="0.1.106" />
26+
<PackageReference Include="Azure.Developer.TrustedSigning.CryptoProvider" Version="0.1.38" />
27+
<PackageReference Include="Azure.CodeSigning.Sdk" Version="0.1.127" />
2828
<PackageReference Include="System.Formats.Asn1" Version="6.0.1" />
2929
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="6.0.3" />
3030
</ItemGroup>

src/CodeSigning/CodeSigning/Commands/InvokeCIPolicySigning.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ private void WriteMessage(string message)
140140

141141
private void ValidateFileType(string fullInPath)
142142
{
143-
if (System.IO.Path.GetExtension(fullInPath).ToLower() == ".bin")
143+
if (string.Equals(System.IO.Path.GetExtension(fullInPath), ".bin", StringComparison.OrdinalIgnoreCase))
144144
{
145145
WriteMessage(Environment.NewLine);
146146
WriteMessage("CI Policy file submitted");

src/CodeSigning/CodeSigning/Helpers/CmsSigner.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using Azure.CodeSigning.Client.CryptoProvider;
15+
using Azure.Developer.TrustedSigning.CryptoProvider;
1616
using Azure.Core;
1717
using System;
1818
using System.IO;
@@ -33,10 +33,10 @@ public void SignCIPolicy(TokenCredential tokenCred, string accountName, string c
3333
{
3434
try
3535
{
36-
var context = new AzCodeSignContext(tokenCred, accountName, certProfile, endpointUrl);
36+
var context = new AzSignContext(tokenCred, accountName, certProfile, new Uri(endpointUrl));
3737

38-
var cert = context.InitializeChainAsync().Result;
39-
RSA rsa = new RSAAzCodeSign(context);
38+
var cert = context.GetSigningCertificate();
39+
RSA rsa = new RSAAzSign(context);
4040

4141
var cipolicy = File.ReadAllBytes(unsignedCIFilePath);
4242
var cmscontent = new ContentInfo(new Oid("1.3.6.1.4.1.311.79.1"), cipolicy);
@@ -84,7 +84,7 @@ public void SignCIPolicy(TokenCredential tokenCred, string accountName, string c
8484
retry--;
8585
if (retry == 0 || ex.Message == "Input TimeStamperUrl is not valid Uri. Please check.")
8686
{
87-
throw ex;
87+
throw;
8888
}
8989
}
9090
}

src/CodeSigning/CodeSigning/Models/CodeSigningServiceClient.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ public string[] GetCodeSigningEku(string accountName, string profileName, string
7878
GetCertificateProfileClient(endpoint);
7979

8080
var eku = CertificateProfileClient.GetSignEku(accountName, profileName);
81-
return eku.Value?.ToArray();
81+
82+
return eku.Value?.Distinct().ToArray();
8283
}
8384
public string[] GetCodeSigningEku(string metadataPath)
8485
{

0 commit comments

Comments
 (0)