WPF Telerik网格的现代方法

WPF Telerik网格的现代方法,wpf,azure-devops,manifest,credentials,telerik-grid,Wpf,Azure Devops,Manifest,Credentials,Telerik Grid,是否有一种现代方法可以在不丢失相关功能的情况下使用Azure DevOps从存储库部署中排除清单证书私钥 我正在迁移一个代码库,该代码库包含一个从Team Foundation服务器到Azure DeVoP的WPF TeleRik网格。我注意到一些敏感信息,比如TemporaryKey.pfx文件中的X.509证书私钥,它似乎可以处理生产中的Telerik网格清单下载 我试图完全删除清单和OneClick签名,看到相关页面现在抛出如下错误: - task: DownloadSecureFile@

是否有一种现代方法可以在不丢失相关功能的情况下使用Azure DevOps从存储库部署中排除清单证书私钥

<>我正在迁移一个代码库,该代码库包含一个从Team Foundation服务器到Azure DeVoP的WPF TeleRik网格。我注意到一些敏感信息,比如TemporaryKey.pfx文件中的X.509证书私钥,它似乎可以处理生产中的Telerik网格清单下载

我试图完全删除清单和OneClick签名,看到相关页面现在抛出如下错误:

- task: DownloadSecureFile@1
        name: TemporaryKey
        displayName: 'Download TemporaryKey certificate'
        inputs:
          secureFile: 'TemporaryKey.pfx'

      #Install TemporaryKey certificate for manifest
      - task: PowerShell@2
        inputs:
          targetType: 'inline'
          script: |
            Write-Host "Start adding the PFX file to the certificate store."
            $secName = "TemporaryKey.pfx"
            $tempDirectory = $env:AGENT_TEMPDIRECTORY

            $pfxFilePath = Join-Path $tempDirectory $secName

            Add-Type -AssemblyName System.Security
            $cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
            $cert.Import($pfxFilePath, "$(Password)", [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]"PersistKeySet")
            $store = new-object system.security.cryptography.X509Certificates.X509Store -argumentlist "MY", CurrentUser
            $store.Open([System.Security.Cryptography.X509Certificates.OpenFlags]"ReadWrite")
            $store.Add($cert)
            $store.Close()
      
      
      #Sign manifest using TemporaryKey
      - task: PowerShell@2
        displayName: "Sign TemporaryKey PowerShell script"
        inputs:
          targetType: 'inline'
          script: |
            $magicToken = "#PerformScriptSigning"
            $encoding = "UTF8"
            $scriptFolder = "."
            #No files found here
            $scripts = Get-ChildItem -Path $scriptFolder -Filter "*.ps1" -Recurse -ErrorAction Stop
            foreach ($script in $scripts) {
                try {

                    $content = Get-Content -Path $script.FullName -Encoding $encoding
                    if ($content.Contains($magicToken)) {
                        $content = $content | Where-Object {$_ -notmatch $magicToken}
                        Set-Content -Value $content -Path $script.FullName -Encoding $encoding -Force
                        # load cert
                        $codeSigningCert = Get-ChildItem Cert:\CurrentUser\My -CodeSigningCert | Select-Object -First 1
                        Write-Output "Signing script `"$($script.Name)`" with certificate `"$($codeSigningCert.Thumbprint)`""
                        # sign script
                        $null = Set-AuthenticodeSignature -Certificate $codeSigningCert -FilePath $script.FullName -TimestampServer "http://timestamp.comodoca.com/rfc3161"
                        # copy to artifact staging location
                        $null = Copy-Item -Path $script.FullName -Destination $env:Build_ArtifactStagingDirectory
                    }
                }
                catch {
                    Write-Error $_
                }
            }
应用程序清单的计算哈希与指定的哈希不同,或者没有哈希 在.csproj中

我看到了从.csproj中删除的两行代码,但如果这是一个关键的安全组件,我不想引入安全风险

<GenerateManifests>true</GenerateManifests>
<SignManifests>false</SignManifests>
据我所知,这个过程应该创建.ps1文件来对项目进行签名,但是在签名脚本中找不到.ps1文件。安装脚本可以打开文件并将其成功安装到存储中。在存储之前,我写下了TemporaryKey.pfx证书,以确保打开时没有错误

我不清楚在这种情况下签名是如何工作的。

现代的或推荐的方法是将
.pfx
文件上载到Azure DevOps,然后下载它,并在构建或发布过程中使用它对应用程序进行签名


包含一个YAML管道的示例,该管道使用安全的
.pfx
来签署MSIX打包的WPF应用程序。

感谢您的文章,基于您提供的内容,我在这里看到了一个很好地实现它的解决方案。您好@Alex,您介意在这里分享您的答案并接受它吗?它可以帮助其他社区成员谁得到同样的问题,我们可以存档这个线程。谢谢祝你今天愉快。:)你好,Vito Liu MSFT,我一定会的。我已经保护了我的.pfx文件,并在构建管道中下载了它。我仍然需要将其存储在变量中并部署它。一旦这些都完成了,我会回复我所采取的步骤。我已经确认pfx是安装在代理之前的建设,并应工作。我收到错误“错误MSB3482:签名时出错:无法将证书链生成到受信任的根颁发机构”。如果我可以解决此问题并确认生成成功,则返回错误。我将结合我发现的有用信息来回答这个问题。嗨@Alex,你能编辑你的问题描述并在这里分享最新的问题吗?谢谢