コード例 #1
0
 /// <summary>The default constructor for CertPathRevocationAnalysis.</summary>
 /// <remarks>The default constructor for CertPathRevocationAnalysis.</remarks>
 /// <param name="ctx"></param>
 /// <param name="info"></param>
 public CertPathRevocationAnalysis(ValidationContext ctx, TrustedListInformation info
                                   )
 {
     summary = new Result();
     this.trustedListInformation = info;
     if (ctx != null && ctx.GetNeededCertificates() != null)
     {
         foreach (CertificateAndContext cert in ctx.GetNeededCertificates())
         {
             CertificateVerification verif = new CertificateVerification(cert, ctx);
             certificatePathVerification.Add(verif);
         }
     }
     summary.SetStatus(Result.ResultStatus.VALID, null);
     if (certificatePathVerification != null)
     {
         foreach (CertificateVerification verif in certificatePathVerification)
         {
             if (verif.GetValidityPeriodVerification().IsInvalid())
             {
                 summary.SetStatus(Result.ResultStatus.INVALID, "certificate.not.valid");
                 break;
             }
             if (verif.GetCertificateStatus() != null)
             {
                 if (verif.GetCertificateStatus().GetStatus() == CertificateValidity.REVOKED)
                 {
                     summary.SetStatus(Result.ResultStatus.INVALID, "certificate.revoked");
                     break;
                 }
                 else
                 {
                     if (verif.GetCertificateStatus().GetStatus() == CertificateValidity.UNKNOWN || verif
                         .GetCertificateStatus().GetStatus() == null)
                     {
                         summary.SetStatus(Result.ResultStatus.UNDETERMINED, "revocation.unknown");
                     }
                 }
             }
             else
             {
                 summary.SetStatus(Result.ResultStatus.UNDETERMINED, "no.revocation.data");
             }
         }
     }
     if (trustedListInformation != null)
     {
         if (!trustedListInformation.IsServiceWasFound())
         {
             summary.SetStatus(Result.ResultStatus.INVALID, "no.trustedlist.service.was.found"
                               );
         }
     }
     else
     {
         summary.SetStatus(Result.ResultStatus.INVALID, "no.trustedlist.service.was.found"
                           );
     }
 }
コード例 #2
0
		/// <summary>The default constructor for CertPathRevocationAnalysis.</summary>
		/// <remarks>The default constructor for CertPathRevocationAnalysis.</remarks>
		/// <param name="ctx"></param>
		/// <param name="info"></param>
		public CertPathRevocationAnalysis(ValidationContext ctx, TrustedListInformation info
			)
		{
			summary = new Result();
			this.trustedListInformation = info;
			if (ctx != null && ctx.GetNeededCertificates() != null)
			{
				foreach (CertificateAndContext cert in ctx.GetNeededCertificates())
				{
					CertificateVerification verif = new CertificateVerification(cert, ctx);
					certificatePathVerification.AddItem(verif);
				}
			}
			summary.SetStatus(Result.ResultStatus.VALID, null);
			if (certificatePathVerification != null)
			{
				foreach (CertificateVerification verif in certificatePathVerification)
				{
					if (verif.GetValidityPeriodVerification().IsInvalid())
					{
						summary.SetStatus(Result.ResultStatus.INVALID, "certificate.not.valid");
						break;
					}
					if (verif.GetCertificateStatus() != null)
					{
						if (verif.GetCertificateStatus().GetStatus() == CertificateValidity.REVOKED)
						{
							summary.SetStatus(Result.ResultStatus.INVALID, "certificate.revoked");
							break;
						}
						else
						{
							if (verif.GetCertificateStatus().GetStatus() == CertificateValidity.UNKNOWN || verif
								.GetCertificateStatus().GetStatus() == null)
							{
								summary.SetStatus(Result.ResultStatus.UNDETERMINED, "revocation.unknown");
							}
						}
					}
					else
					{
						summary.SetStatus(Result.ResultStatus.UNDETERMINED, "no.revocation.data");
					}
				}
			}
			if (trustedListInformation != null)
			{
				if (!trustedListInformation.IsServiceWasFound())
				{
					summary.SetStatus(Result.ResultStatus.INVALID, "no.trustedlist.service.was.found"
						);
				}
			}
			else
			{
				summary.SetStatus(Result.ResultStatus.INVALID, "no.trustedlist.service.was.found"
					);
			}
		}