/// <summary>The default constructor for SignatureInformation.</summary> /// <remarks>The default constructor for SignatureInformation.</remarks> /// <param name="name"></param> /// <param name="signatureStructureVerification"></param> /// <param name="signatureVerification"></param> /// <param name="certPathRevocationAnalysis"></param> /// <param name="signatureLevelAnalysis"></param> /// <param name="qualificationsVerification"></param> /// <param name="qcStatementInformation"></param> /// <param name="finalConclusion"></param> public SignatureInformation(SignatureVerification signatureVerification, CertPathRevocationAnalysis certPathRevocationAnalysis, SignatureLevelAnalysis signatureLevelAnalysis, QualificationsVerification qualificationsVerification, QCStatementInformation qcStatementInformation) { this.SignatureVerification = signatureVerification; this.CertPathRevocationAnalysis = certPathRevocationAnalysis; this.SignatureLevelAnalysis = signatureLevelAnalysis; this.QualificationsVerification = qualificationsVerification; this.QcStatementInformation = qcStatementInformation; int tlContentCase = -1; if (certPathRevocationAnalysis.GetTrustedListInformation().IsServiceWasFound()) { tlContentCase = 0; } if (certPathRevocationAnalysis.GetTrustedListInformation().IsServiceWasFound() && qualificationsVerification != null && qualificationsVerification.GetQCWithSSCD( ).IsValid()) { tlContentCase = 1; } if (certPathRevocationAnalysis.GetTrustedListInformation().IsServiceWasFound() && qualificationsVerification != null && qualificationsVerification.GetQCNoSSCD(). IsValid()) { tlContentCase = 2; } if (certPathRevocationAnalysis.GetTrustedListInformation().IsServiceWasFound() && qualificationsVerification != null && qualificationsVerification.GetQCSSCDStatusAsInCert ().IsValid()) { tlContentCase = 3; } if (certPathRevocationAnalysis.GetTrustedListInformation().IsServiceWasFound() && qualificationsVerification != null && qualificationsVerification.GetQCForLegalPerson ().IsValid()) { tlContentCase = 4; } if (!certPathRevocationAnalysis.GetTrustedListInformation().IsServiceWasFound()) { // Case 5 and 6 are not discriminable */ tlContentCase = 5; FinalConclusionComment = "no.tl.confirmation"; } if (certPathRevocationAnalysis.GetTrustedListInformation().IsServiceWasFound() && !certPathRevocationAnalysis.GetTrustedListInformation().IsWellSigned()) { tlContentCase = 7; FinalConclusionComment = "unsigned.tl.confirmation"; } int certContentCase = -1; if (qcStatementInformation != null && !qcStatementInformation.GetQcCompliancePresent ().IsValid() && !qcStatementInformation.GetQCPPlusPresent().IsValid() && qcStatementInformation .GetQCPPresent().IsValid() && !qcStatementInformation.GetQcSCCDPresent().IsValid ()) { certContentCase = 0; } if (qcStatementInformation != null && qcStatementInformation.GetQcCompliancePresent ().IsValid() && !qcStatementInformation.GetQCPPlusPresent().IsValid() && qcStatementInformation .GetQCPPresent().IsValid() && !qcStatementInformation.GetQcSCCDPresent().IsValid ()) { certContentCase = 1; } if (qcStatementInformation != null && qcStatementInformation.GetQcCompliancePresent ().IsValid() && !qcStatementInformation.GetQCPPlusPresent().IsValid() && qcStatementInformation .GetQCPPresent().IsValid() && qcStatementInformation.GetQcSCCDPresent().IsValid( )) { certContentCase = 2; } if (qcStatementInformation != null && !qcStatementInformation.GetQcCompliancePresent ().IsValid() && qcStatementInformation.GetQCPPlusPresent().IsValid() && !qcStatementInformation .GetQCPPresent().IsValid() && !qcStatementInformation.GetQcSCCDPresent().IsValid ()) { certContentCase = 3; } if (qcStatementInformation != null && qcStatementInformation.GetQcCompliancePresent ().IsValid() && qcStatementInformation.GetQCPPlusPresent().IsValid() && !qcStatementInformation .GetQCPPresent().IsValid() && !qcStatementInformation.GetQcSCCDPresent().IsValid ()) { certContentCase = 4; } if (qcStatementInformation != null && qcStatementInformation.GetQcCompliancePresent ().IsValid() && qcStatementInformation.GetQCPPlusPresent().IsValid() && qcStatementInformation .GetQcSCCDPresent().IsValid()) { // QCPPlus stronger than QCP. If QCP is present, then it's ok. // && !qcStatementInformation.getQCPPresent().isValid() certContentCase = 5; } if (qcStatementInformation != null && qcStatementInformation.GetQcCompliancePresent ().IsValid() && !qcStatementInformation.GetQCPPlusPresent().IsValid() && !qcStatementInformation .GetQCPPresent().IsValid() && !qcStatementInformation.GetQcSCCDPresent().IsValid ()) { certContentCase = 6; } if (qcStatementInformation != null && !qcStatementInformation.GetQcCompliancePresent ().IsValid() && !qcStatementInformation.GetQCPPlusPresent().IsValid() && !qcStatementInformation .GetQCPPresent().IsValid() && qcStatementInformation.GetQcSCCDPresent().IsValid( )) { certContentCase = 7; } if (qcStatementInformation != null && qcStatementInformation.GetQcCompliancePresent ().IsValid() && !qcStatementInformation.GetQCPPlusPresent().IsValid() && !qcStatementInformation .GetQCPPresent().IsValid() && qcStatementInformation.GetQcSCCDPresent().IsValid( )) { certContentCase = 8; } if (qcStatementInformation == null || (!qcStatementInformation.GetQcCompliancePresent ().IsValid() && !qcStatementInformation.GetQCPPlusPresent().IsValid() && !qcStatementInformation .GetQCPPresent().IsValid() && !qcStatementInformation.GetQcSCCDPresent().IsValid ())) { certContentCase = 9; } //LOG.Info("TLCase : " + (tlContentCase + 1) + " - CertCase : " + (certContentCase // + 1)); try { SignatureInformation.FinalConclusions[][] matrix = new SignatureInformation.FinalConclusions [][] { new SignatureInformation.FinalConclusions[] { SignatureInformation.FinalConclusions .AdES_QC, SignatureInformation.FinalConclusions.AdES_QC, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .AdES_QC, SignatureInformation.FinalConclusions.AdES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.AdES }, new SignatureInformation.FinalConclusions [] { SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .AdES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .AdES }, new SignatureInformation.FinalConclusions[] { SignatureInformation.FinalConclusions .AdES_QC, SignatureInformation.FinalConclusions.AdES_QC, SignatureInformation.FinalConclusions .AdES_QC, SignatureInformation.FinalConclusions.AdES_QC, SignatureInformation.FinalConclusions .AdES_QC, SignatureInformation.FinalConclusions.AdES_QC, SignatureInformation.FinalConclusions .AdES_QC, SignatureInformation.FinalConclusions.AdES, SignatureInformation.FinalConclusions .AdES_QC, SignatureInformation.FinalConclusions.AdES }, new SignatureInformation.FinalConclusions [] { SignatureInformation.FinalConclusions.AdES_QC, SignatureInformation.FinalConclusions .AdES_QC, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.AdES_QC, SignatureInformation.FinalConclusions .AdES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .AdES }, new SignatureInformation.FinalConclusions[] { SignatureInformation.FinalConclusions .AdES_QC, SignatureInformation.FinalConclusions.AdES_QC, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .AdES_QC, SignatureInformation.FinalConclusions.AdES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.AdES }, new SignatureInformation.FinalConclusions [] { SignatureInformation.FinalConclusions.AdES_QC, SignatureInformation.FinalConclusions .AdES_QC, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.AdES_QC, SignatureInformation.FinalConclusions .AdES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .AdES }, new SignatureInformation.FinalConclusions[] { SignatureInformation.FinalConclusions .AdES_QC, SignatureInformation.FinalConclusions.AdES_QC, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .AdES_QC, SignatureInformation.FinalConclusions.AdES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.AdES }, new SignatureInformation.FinalConclusions [] { SignatureInformation.FinalConclusions.AdES_QC, SignatureInformation.FinalConclusions .AdES_QC, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.AdES_QC, SignatureInformation.FinalConclusions .AdES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .AdES } }; FinalConclusion = matrix[tlContentCase][certContentCase]; } catch (IndexOutOfRangeException) { FinalConclusion = SignatureInformation.FinalConclusions.UNDETERMINED; } }
/// <summary>The default constructor for SignatureInformation.</summary> /// <remarks>The default constructor for SignatureInformation.</remarks> /// <param name="name"></param> /// <param name="signatureStructureVerification"></param> /// <param name="signatureVerification"></param> /// <param name="certPathRevocationAnalysis"></param> /// <param name="signatureLevelAnalysis"></param> /// <param name="qualificationsVerification"></param> /// <param name="qcStatementInformation"></param> /// <param name="finalConclusion"></param> public SignatureInformation(SignatureVerification signatureVerification, CertPathRevocationAnalysis certPathRevocationAnalysis, SignatureLevelAnalysis signatureLevelAnalysis, QualificationsVerification qualificationsVerification, QCStatementInformation qcStatementInformation) { this.SignatureVerification = signatureVerification; this.CertPathRevocationAnalysis = certPathRevocationAnalysis; this.SignatureLevelAnalysis = signatureLevelAnalysis; this.QualificationsVerification = qualificationsVerification; this.QcStatementInformation = qcStatementInformation; int tlContentCase = -1; if (certPathRevocationAnalysis.GetTrustedListInformation().IsServiceWasFound()) { tlContentCase = 0; } if (certPathRevocationAnalysis.GetTrustedListInformation().IsServiceWasFound() && qualificationsVerification != null && qualificationsVerification.GetQCWithSSCD( ).IsValid()) { tlContentCase = 1; } if (certPathRevocationAnalysis.GetTrustedListInformation().IsServiceWasFound() && qualificationsVerification != null && qualificationsVerification.GetQCNoSSCD(). IsValid()) { tlContentCase = 2; } if (certPathRevocationAnalysis.GetTrustedListInformation().IsServiceWasFound() && qualificationsVerification != null && qualificationsVerification.GetQCSSCDStatusAsInCert ().IsValid()) { tlContentCase = 3; } if (certPathRevocationAnalysis.GetTrustedListInformation().IsServiceWasFound() && qualificationsVerification != null && qualificationsVerification.GetQCForLegalPerson ().IsValid()) { tlContentCase = 4; } if (!certPathRevocationAnalysis.GetTrustedListInformation().IsServiceWasFound()) { // Case 5 and 6 are not discriminable */ tlContentCase = 5; FinalConclusionComment = "no.tl.confirmation"; } if (certPathRevocationAnalysis.GetTrustedListInformation().IsServiceWasFound() && !certPathRevocationAnalysis.GetTrustedListInformation().IsWellSigned()) { tlContentCase = 7; FinalConclusionComment = "unsigned.tl.confirmation"; } int certContentCase = -1; if (qcStatementInformation != null && !qcStatementInformation.GetQcCompliancePresent ().IsValid() && !qcStatementInformation.GetQCPPlusPresent().IsValid() && qcStatementInformation .GetQCPPresent().IsValid() && !qcStatementInformation.GetQcSCCDPresent().IsValid ()) { certContentCase = 0; } if (qcStatementInformation != null && qcStatementInformation.GetQcCompliancePresent ().IsValid() && !qcStatementInformation.GetQCPPlusPresent().IsValid() && qcStatementInformation .GetQCPPresent().IsValid() && !qcStatementInformation.GetQcSCCDPresent().IsValid ()) { certContentCase = 1; } if (qcStatementInformation != null && qcStatementInformation.GetQcCompliancePresent ().IsValid() && !qcStatementInformation.GetQCPPlusPresent().IsValid() && qcStatementInformation .GetQCPPresent().IsValid() && qcStatementInformation.GetQcSCCDPresent().IsValid( )) { certContentCase = 2; } if (qcStatementInformation != null && !qcStatementInformation.GetQcCompliancePresent ().IsValid() && qcStatementInformation.GetQCPPlusPresent().IsValid() && !qcStatementInformation .GetQCPPresent().IsValid() && !qcStatementInformation.GetQcSCCDPresent().IsValid ()) { certContentCase = 3; } if (qcStatementInformation != null && qcStatementInformation.GetQcCompliancePresent ().IsValid() && qcStatementInformation.GetQCPPlusPresent().IsValid() && !qcStatementInformation .GetQCPPresent().IsValid() && !qcStatementInformation.GetQcSCCDPresent().IsValid ()) { certContentCase = 4; } if (qcStatementInformation != null && qcStatementInformation.GetQcCompliancePresent ().IsValid() && qcStatementInformation.GetQCPPlusPresent().IsValid() && qcStatementInformation .GetQcSCCDPresent().IsValid()) { // QCPPlus stronger than QCP. If QCP is present, then it's ok. // && !qcStatementInformation.getQCPPresent().isValid() certContentCase = 5; } if (qcStatementInformation != null && qcStatementInformation.GetQcCompliancePresent ().IsValid() && !qcStatementInformation.GetQCPPlusPresent().IsValid() && !qcStatementInformation .GetQCPPresent().IsValid() && !qcStatementInformation.GetQcSCCDPresent().IsValid ()) { certContentCase = 6; } if (qcStatementInformation != null && !qcStatementInformation.GetQcCompliancePresent ().IsValid() && !qcStatementInformation.GetQCPPlusPresent().IsValid() && !qcStatementInformation .GetQCPPresent().IsValid() && qcStatementInformation.GetQcSCCDPresent().IsValid( )) { certContentCase = 7; } if (qcStatementInformation != null && qcStatementInformation.GetQcCompliancePresent ().IsValid() && !qcStatementInformation.GetQCPPlusPresent().IsValid() && !qcStatementInformation .GetQCPPresent().IsValid() && qcStatementInformation.GetQcSCCDPresent().IsValid( )) { certContentCase = 8; } if (qcStatementInformation == null || (!qcStatementInformation.GetQcCompliancePresent ().IsValid() && !qcStatementInformation.GetQCPPlusPresent().IsValid() && !qcStatementInformation .GetQCPPresent().IsValid() && !qcStatementInformation.GetQcSCCDPresent().IsValid ())) { certContentCase = 9; } LOG.Info("TLCase : " + (tlContentCase + 1) + " - CertCase : " + (certContentCase + 1)); try { SignatureInformation.FinalConclusions[][] matrix = new SignatureInformation.FinalConclusions [][] { new SignatureInformation.FinalConclusions[] { SignatureInformation.FinalConclusions .AdES_QC, SignatureInformation.FinalConclusions.AdES_QC, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .AdES_QC, SignatureInformation.FinalConclusions.AdES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.AdES }, new SignatureInformation.FinalConclusions [] { SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .AdES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .AdES }, new SignatureInformation.FinalConclusions[] { SignatureInformation.FinalConclusions .AdES_QC, SignatureInformation.FinalConclusions.AdES_QC, SignatureInformation.FinalConclusions .AdES_QC, SignatureInformation.FinalConclusions.AdES_QC, SignatureInformation.FinalConclusions .AdES_QC, SignatureInformation.FinalConclusions.AdES_QC, SignatureInformation.FinalConclusions .AdES_QC, SignatureInformation.FinalConclusions.AdES, SignatureInformation.FinalConclusions .AdES_QC, SignatureInformation.FinalConclusions.AdES }, new SignatureInformation.FinalConclusions [] { SignatureInformation.FinalConclusions.AdES_QC, SignatureInformation.FinalConclusions .AdES_QC, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.AdES_QC, SignatureInformation.FinalConclusions .AdES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .AdES }, new SignatureInformation.FinalConclusions[] { SignatureInformation.FinalConclusions .AdES_QC, SignatureInformation.FinalConclusions.AdES_QC, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .AdES_QC, SignatureInformation.FinalConclusions.AdES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.AdES }, new SignatureInformation.FinalConclusions [] { SignatureInformation.FinalConclusions.AdES_QC, SignatureInformation.FinalConclusions .AdES_QC, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.AdES_QC, SignatureInformation.FinalConclusions .AdES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .AdES }, new SignatureInformation.FinalConclusions[] { SignatureInformation.FinalConclusions .AdES_QC, SignatureInformation.FinalConclusions.AdES_QC, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .AdES_QC, SignatureInformation.FinalConclusions.AdES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.AdES }, new SignatureInformation.FinalConclusions [] { SignatureInformation.FinalConclusions.AdES_QC, SignatureInformation.FinalConclusions .AdES_QC, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .QES, SignatureInformation.FinalConclusions.AdES_QC, SignatureInformation.FinalConclusions .AdES, SignatureInformation.FinalConclusions.QES, SignatureInformation.FinalConclusions .AdES } }; FinalConclusion = matrix[tlContentCase][certContentCase]; } catch (IndexOutOfRangeException) { FinalConclusion = SignatureInformation.FinalConclusions.UNDETERMINED; } }