コード例 #1
0
 private void VerifySigning(string nupkgPath)
 {
     if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
     {
         if (_firstPartyNuGetPackageSigningVerifier.IsExecutableIsFirstPartySignedWithoutValidation(new FilePath(
                                                                                                        typeof(DotNet.Cli.Program).Assembly.Location)))
         {
             if (!_firstPartyNuGetPackageSigningVerifier.Verify(new FilePath(nupkgPath),
                                                                out string commandOutput))
             {
                 throw new NuGetPackageInstallerException(LocalizableStrings.FailedToValidatePackageSigning +
                                                          Environment.NewLine +
                                                          commandOutput);
             }
         }
         else
         {
             if (!_validationMessagesDisplayed)
             {
                 _reporter.WriteLine(
                     LocalizableStrings.SkipNuGetpackageSigningValidationSDKNotFirstParty);
                 _validationMessagesDisplayed = true;
             }
         }
     }
     else
     {
         if (!_validationMessagesDisplayed)
         {
             _reporter.WriteLine(
                 LocalizableStrings.SkipNuGetpackageSigningValidationmacOSLinux);
             _validationMessagesDisplayed = true;
         }
     }
 }
コード例 #2
0
ファイル: NuGetPackageDownloader.cs プロジェクト: nohwnd/sdk
        private void VerifySigning(string nupkgPath)
        {
            if (!_verifySignatures)
            {
                if (!_validationMessagesDisplayed)
                {
                    _reporter.WriteLine(
                        LocalizableStrings.NuGetPackageSignatureVerificationSkipped);
                    _validationMessagesDisplayed = true;
                }

                return;
            }

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                if (!_firstPartyNuGetPackageSigningVerifier.Verify(new FilePath(nupkgPath),
                                                                   out string commandOutput))
                {
                    throw new NuGetPackageInstallerException(LocalizableStrings.FailedToValidatePackageSigning +
                                                             Environment.NewLine +
                                                             commandOutput);
                }
            }
        }