private static CertificateValidationResult ValidResult(X509Certificate2 certificate) { var validResult = LanguageResource.GetResource(LanguageResourceKey.CertificateValidResult); return(new CertificateValidationResult( CertificateValidationType.Valid, certificate.ToShortString(validResult))); }
private static CertificateValidationResult NotActivatedResult(X509Certificate2 certificate) { var notActivatedResult = string.Format(LanguageResource.GetResource(LanguageResourceKey.CertificateNotActivatedResult), certificate.GetEffectiveDateString()); return(new CertificateValidationResult( CertificateValidationType.InvalidCertificate, certificate.ToShortString(notActivatedResult))); }
private static CertificateValidationResult ExpiredResult(X509Certificate2 certificate) { var expiredResult = string.Format(LanguageResource.GetResource(LanguageResourceKey.CertificateExpiredResult), certificate.GetExpirationDateString()); return(new CertificateValidationResult( CertificateValidationType.InvalidCertificate, certificate.ToShortString(expiredResult))); }
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); }
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)); }