public SignaturePolicyIdentifierModel(CadesSignaturePolicyInfo policyInfo)
 {
     Oid = policyInfo.Oid;
     Uri = policyInfo.Uri?.ToString();
     if (policyInfo.Digest != null)
     {
         Hash = new DigestAlgorithmAndValueModel(policyInfo.Digest);
     }
 }
 public SignaturePolicyIdentifierModel(XmlPolicyIdentifier identifier)
 {
     Oid = identifier.SigPolicyId;
     Uri = identifier.SigPolicyUri;
     if (identifier.SigPolicyHash != null)
     {
         Hash = new DigestAlgorithmAndValueModel(identifier.SigPolicyHash);
     }
 }
 public CadesTimestampModel(CadesTimestamp signature) : base(signature)
 {
     GenTime = signature.GenTime;
     if (signature.TstInfo.SerialNumber != null)
     {
         SerialNumber = signature.TstInfo.SerialNumber.ToString();
     }
     if (signature.TstInfo.MessageImprint != null)
     {
         MessageImprint = new DigestAlgorithmAndValueModel(signature.TstInfo.MessageImprint);
     }
 }
Ejemplo n.º 4
0
        public PadesSignerModel(PadesSignerInfo padesSigner)
        {
            var signer = padesSigner.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 {
                var dateReference = signer.GetDateReference(out bool isCertified);
                if (isCertified)
                {
                    CertifiedDateReference = dateReference;
                }
            } catch {
                // do nothing
            }
        }