コード例 #1
0
        private string getSignerDescription(CadesSignerInfo signer, ValidationResults vr)
        {
            var text = new StringBuilder();

            text.Append(getCertificateDescription(signer.SigningCertificate));
            if (signer.SigningTime != null)
            {
                text.AppendFormat(" at {0:g}", signer.SigningTime.Value.LocalDateTime);
            }
            if (vr.IsValid)
            {
                text.AppendFormat(" - Valid");
            }
            else
            {
                text.AppendFormat(" - INVALID");
            }
            return(text.ToString());
        }
コード例 #2
0
 public CadesSignerInfoModel(CadesSignerInfo signerInfo)
 {
     MessageDigest = new DigestAlgorithmAndValueModel(signerInfo.DigestAlgorithm, signerInfo.MessageDigest);
     Signature     = new SignatureAlgorithmAndValueModel(signerInfo.SignatureAlgorithm, signerInfo.SignatureValue);
     if (signerInfo.SignaturePolicy != null)
     {
         SignaturePolicy = new SignaturePolicyIdentifierModel(signerInfo.SignaturePolicy);
     }
     Certificate = new CertificateModel(signerInfo.SigningCertificate);
     Timestamps  = signerInfo.SignatureTimeStamps.Select(s => new CadesTimestampModel(s)).ToList();
     try {
         bool isCertified;
         var  dateReference = signerInfo.GetDateReference(out isCertified);
         if (isCertified)
         {
             CertifiedDateReference = dateReference;
         }
     } catch {
     }
 }
コード例 #3
0
        public CadesSignerModel(CadesSignerInfo signer)
        {
            SigningTime = signer.SigningTime;
            if (signer.DigestAlgorithm != null && signer.MessageDigest != null)
            {
                MessageDigest = new DigestAlgorithmAndValueModel(signer.DigestAlgorithm, signer.MessageDigest);
            }
            if (signer.SignatureAlgorithm != null && signer.SignatureValue != null)
            {
                Signature = new SignatureAlgorithmAndValueModel(signer.SignatureAlgorithm, signer.SignatureValue);
            }
            if (signer.SignaturePolicy != null && !signer.SignaturePolicy.IsImplicit)
            {
                SignaturePolicy = new SignaturePolicyIdentifierModel(signer.SignaturePolicy);
            }
            if (signer.SigningCertificate != null)
            {
                Certificate = new CertificateModel(signer.SigningCertificate);
            }
            if (signer.SignatureTimeStamps.Any())
            {
                Timestamps = signer.SignatureTimeStamps.Select(s => new CadesTimestampModel(s)).ToList();
            }

            // Get date reference
            try {
                bool isCertified;
                var  dateReference = signer.GetDateReference(out isCertified);
                if (isCertified)
                {
                    CertifiedDateReference = dateReference;
                }
            } catch {
                // do nothing
            }
        }
コード例 #4
0
 public ValidationResultsModel(CadesSignerInfo signerInfo, ICadesPolicyMapper policyMapper, Lacuna.Pki.Cades.CadesSignature signature) :
     this(signature.ValidateSignature(signerInfo, policyMapper))
 {
 }
コード例 #5
0
 public CadesSignerInfoModel(CadesSignerInfo signerInfo, ICadesPolicyMapper policyMapper, Lacuna.Pki.Cades.CadesSignature signature) : this(signerInfo) {
     ValidationResults = new ValidationResultsModel(signerInfo, policyMapper, signature);
 }