Esempio n. 1
0
        private static SignedPackageVerifierSettings GetSettingsPolicy(string policyString)
        {
            if (StringComparer.Ordinal.Equals(policyString, "command"))
            {
                return(SignedPackageVerifierSettings.GetVerifyCommandDefaultPolicy());
            }

            if (StringComparer.Ordinal.Equals(policyString, "vs"))
            {
                return(SignedPackageVerifierSettings.GetVSClientDefaultPolicy());
            }

            return(SignedPackageVerifierSettings.GetDefault());
        }
Esempio n. 2
0
        public void GetVSClientDefaultPolicy_InitializesProperties()
        {
            // Arrange
            var repoList     = new List <CertificateHashAllowListEntry>();
            var clientList   = new List <CertificateHashAllowListEntry>();
            var defaultValue = true;

            // Act
            var settings = SignedPackageVerifierSettings.GetVSClientDefaultPolicy(repoList, clientList);

            // Assert
            settings.AllowUnsigned.Should().Be(defaultValue);
            settings.AllowIllegal.Should().Be(defaultValue);
            settings.AllowUntrusted.Should().Be(defaultValue);
            settings.AllowUntrustedSelfIssuedCertificate.Should().Be(defaultValue);
            settings.AllowIgnoreTimestamp.Should().Be(defaultValue);
            settings.AllowMultipleTimestamps.Should().Be(defaultValue);
            settings.AllowNoTimestamp.Should().Be(defaultValue);
            settings.AllowUnknownRevocation.Should().Be(defaultValue);
            settings.AllowNoRepositoryCertificateList.Should().Be(defaultValue);
            settings.AllowNoClientCertificateList.Should().Be(defaultValue);
            settings.RepositoryCertificateList.Should().BeSameAs(repoList);
            settings.ClientCertificateList.Should().BeSameAs(clientList);
        }