-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[0.74] Backport certificate fixes to unblock CI (#14059)
## Description This PR cherry-picks the following certificate-related commits to unblock CI in 0.74: 3a5ca66 3534af4 5fad854 --------- Co-authored-by: Danny van Velzen 🁴 <dannyvv@microsoft.com>
- Loading branch information
1 parent
44bc602
commit ded80f0
Showing
7 changed files
with
29 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
parameters: | ||
- name: certificateName | ||
- name: certificatePassword | ||
type: string | ||
default: 'pwd' | ||
|
||
steps: | ||
- powershell: | | ||
Write-Host "Using certificate named ${{ parameters.certificateName }}" | ||
Write-Host "##vso[task.setvariable variable=EncodedKey]$(${{ parameters.certificateName }})" | ||
displayName: Determining certificate | ||
$certStoreRoot="cert:\CurrentUser\My" | ||
$rootFolder="$(Build.SourcesDirectory)" | ||
- powershell: | | ||
$PfxBytes = [System.Convert]::FromBase64String("$(EncodedKey)") | ||
$PfxPath = [System.IO.Path]::GetFullPath( (Join-Path -Path $(Build.SourcesDirectory) -ChildPath EncodedKey.pfx) ) | ||
[System.IO.File]::WriteAllBytes("$PfxPath", $PfxBytes) | ||
displayName: Write certificate | ||
# the following two lines must match | ||
[System.Security.SecureString] $password = ConvertTo-SecureString -String "${{ parameters.certificatePassword }}" -Force -AsPlainText | ||
$cert = New-SelfSignedCertificate -KeyExportPolicy Exportable -CertStoreLocation $certStoreRoot -DnsName "Development Root CA" -NotAfter (Get-Date).AddYears(5) -Type CodeSigningCert -KeyUsage DigitalSignature | ||
[String] $pfxPath = [System.IO.Path]::GetFullPath( (Join-Path -Path $rootFolder -ChildPath EncodedKey.pfx) ) | ||
[String] $certPath = "$certStoreRoot\$($cert.Thumbprint)" | ||
Export-PfxCertificate -Cert $certPath -FilePath $pfxPath -Password $password | ||
displayName: Create self-signed certificate |