示例#1
0
        private static CertificateValidationResult ValidResult(X509Certificate2 certificate)
        {
            var validResult = LanguageResource.GetResource(LanguageResourceKey.CertificateValidResult);

            return(new CertificateValidationResult(
                       CertificateValidationType.Valid,
                       certificate.ToShortString(validResult)));
        }
示例#2
0
        private static CertificateValidationResult NotActivatedResult(X509Certificate2 certificate)
        {
            var notActivatedResult = string.Format(LanguageResource.GetResource(LanguageResourceKey.CertificateNotActivatedResult), certificate.GetEffectiveDateString());

            return(new CertificateValidationResult(
                       CertificateValidationType.InvalidCertificate,
                       certificate.ToShortString(notActivatedResult)));
        }
示例#3
0
        private static CertificateValidationResult ExpiredResult(X509Certificate2 certificate)
        {
            var expiredResult = string.Format(LanguageResource.GetResource(LanguageResourceKey.CertificateExpiredResult), certificate.GetExpirationDateString());

            return(new CertificateValidationResult(
                       CertificateValidationType.InvalidCertificate,
                       certificate.ToShortString(expiredResult)));
        }
示例#4
0
        private static CertificateValidationResult NotIssuedToOrganizationResult(X509Certificate2 certificate, string certificateOrganizationNumber)
        {
            var notIssuedToOrganizationResult = string.Format(LanguageResource.GetResource(LanguageResourceKey.CertificateNotIssuedToOrganization), certificateOrganizationNumber);

            return(new CertificateValidationResult(
                       CertificateValidationType.InvalidCertificate,
                       certificate.ToShortString(notIssuedToOrganizationResult)));
        }
            public void Get_resource_with_temporary_language()
            {
                LanguageResource.CurrentLanguage = Language.Norwegian;
                var resource = LanguageResource.GetResource(LanguageResourceKey.ToleratedPrefixListError, Language.English);

                Assert.True(resource.Contains("The 'PrefixList' attribute is invalid"));
                Assert.Equal(Language.Norwegian, LanguageResource.CurrentLanguage);
            }
示例#6
0
        private static CertificateValidationResult NoCertificateResult()
        {
            var nullCertificateResult = LanguageResource.GetResource(LanguageResourceKey.CertificateIsNull);

            return(new CertificateValidationResult(CertificateValidationType.InvalidCertificate, nullCertificateResult));
        }
        public static string ToShortString(this X509Certificate2 certificate, string extraInfo = "")
        {
            var shortStringWithPlaceholders = LanguageResource.GetResource(LanguageResourceKey.CertificateShortDescription);

            return(string.Format(shortStringWithPlaceholders, certificate.Subject, certificate.Thumbprint, extraInfo));
        }
 private static string GetErrorMessage(string thumbprint)
 {
     return(string.Format(LanguageResource.GetResource(LanguageResourceKey.CertificateCouldNotFind), thumbprint));
 }