This class indicates the algortithm used to calculate the digest and the digest value itself
コード例 #1
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public SignaturePolicyId()
 {
     this.sigPolicyId         = new ObjectIdentifier("SigPolicyId");
     this.transforms          = new Transforms();
     this.sigPolicyHash       = new DigestAlgAndValueType("SigPolicyHash");
     this.sigPolicyQualifiers = new SigPolicyQualifiers();
 }
コード例 #2
0
        /// <summary>
        /// Load state from an XML element
        /// </summary>
        /// <param name="xmlElement">XML element containing new state</param>
        public void LoadXml(System.Xml.XmlElement xmlElement)
        {
            XmlNamespaceManager xmlNamespaceManager;
            XmlNodeList         xmlNodeList;

            if (xmlElement == null)
            {
                throw new ArgumentNullException("xmlElement");
            }

            xmlNamespaceManager = new XmlNamespaceManager(xmlElement.OwnerDocument.NameTable);
            xmlNamespaceManager.AddNamespace("xsd", XadesSignedXml.XadesNamespaceUri);

            xmlNodeList = xmlElement.SelectNodes("xsd:OCSPIdentifier", xmlNamespaceManager);
            if (xmlNodeList.Count == 0)
            {
                throw new CryptographicException("OCSPIdentifier missing");
            }
            this.ocspIdentifier = new OCSPIdentifier();
            this.ocspIdentifier.LoadXml((XmlElement)xmlNodeList.Item(0));

            xmlNodeList = xmlElement.SelectNodes("xsd:DigestAlgAndValue", xmlNamespaceManager);
            if (xmlNodeList.Count == 0)
            {
                this.digestAlgAndValue = null;
            }
            else
            {
                this.digestAlgAndValue = new DigestAlgAndValueType("DigestAlgAndValue");
                this.digestAlgAndValue.LoadXml((XmlElement)xmlNodeList.Item(0));
            }
        }
コード例 #3
0
ファイル: Cert.cs プロジェクト: ylepikhov/dssnet
        /// <summary>
        /// Load state from an XML element
        /// </summary>
        /// <param name="xmlElement">XML element containing new state</param>
        public void LoadXml(System.Xml.XmlElement xmlElement)
        {
            XmlNamespaceManager xmlNamespaceManager;
            XmlNodeList         xmlNodeList;

            if (xmlElement == null)
            {
                throw new ArgumentNullException("xmlElement");
            }

            xmlNamespaceManager = new XmlNamespaceManager(xmlElement.OwnerDocument.NameTable);
            xmlNamespaceManager.AddNamespace("ds", SignedXml.XmlDsigNamespaceUrl);
            xmlNamespaceManager.AddNamespace("xsd", XadesSignedXml.XadesNamespaceUri);

            xmlNodeList = xmlElement.SelectNodes("xsd:CertDigest", xmlNamespaceManager);
            if (xmlNodeList.Count == 0)
            {
                throw new CryptographicException("CertDigest missing");
            }
            this.certDigest = new DigestAlgAndValueType("CertDigest");
            this.certDigest.LoadXml((XmlElement)xmlNodeList.Item(0));

            xmlNodeList = xmlElement.SelectNodes("xsd:IssuerSerial", xmlNamespaceManager);
            if (xmlNodeList.Count == 0)
            {
                throw new CryptographicException("IssuerSerial missing");
            }
            this.issuerSerial = new IssuerSerial();
            this.issuerSerial.LoadXml((XmlElement)xmlNodeList.Item(0));
        }
コード例 #4
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public SignaturePolicyId()
 {
     this.sigPolicyId = new ObjectIdentifier("SigPolicyId");
     this.transforms = new Transforms();
     this.sigPolicyHash = new DigestAlgAndValueType("SigPolicyHash");
     this.sigPolicyQualifiers = new SigPolicyQualifiers();
 }
コード例 #5
0
        /// <summary>
        /// Load state from an XML element
        /// </summary>
        /// <param name="xmlElement">XML element containing new state</param>
        public void LoadXml(System.Xml.XmlElement xmlElement)
        {
            XmlNamespaceManager xmlNamespaceManager;
            XmlNodeList         xmlNodeList;

            if (xmlElement == null)
            {
                throw new ArgumentNullException("xmlElement");
            }

            xmlNamespaceManager = new XmlNamespaceManager(xmlElement.OwnerDocument.NameTable);
            xmlNamespaceManager.AddNamespace("ds", SignedXml.XmlDsigNamespaceUrl);
            xmlNamespaceManager.AddNamespace("xsd", XadesSignedXml.XadesNamespaceUri);

            xmlNodeList = xmlElement.SelectNodes("xsd:SigPolicyId", xmlNamespaceManager);
            if (xmlNodeList.Count == 0)
            {
                throw new CryptographicException("SigPolicyId missing");
            }
            this.sigPolicyId = new ObjectIdentifier("SigPolicyId");
            this.sigPolicyId.LoadXml((XmlElement)xmlNodeList.Item(0));

            xmlNodeList = xmlElement.SelectNodes("ds:Transforms", xmlNamespaceManager);
            if (xmlNodeList.Count != 0)
            {
                this.transforms = new Transforms();
                this.transforms.LoadXml((XmlElement)xmlNodeList.Item(0));
            }

            xmlNodeList = xmlElement.SelectNodes("xsd:SigPolicyHash", xmlNamespaceManager);
            if (xmlNodeList.Count == 0)
            {
                throw new CryptographicException("SigPolicyHash missing");
            }
            this.sigPolicyHash = new DigestAlgAndValueType("SigPolicyHash");
            this.sigPolicyHash.LoadXml((XmlElement)xmlNodeList.Item(0));

            xmlNodeList = xmlElement.SelectNodes("xsd:SigPolicyQualifiers", xmlNamespaceManager);
            if (xmlNodeList.Count != 0)
            {
                this.sigPolicyQualifiers = new SigPolicyQualifiers();
                this.sigPolicyQualifiers.LoadXml((XmlElement)xmlNodeList.Item(0));
            }
        }
コード例 #6
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public CRLRef()
 {
     this.digestAlgAndValue = new DigestAlgAndValueType("DigestAlgAndValue");
     this.crlIdentifier = new CRLIdentifier();
 }
コード例 #7
0
        /// <summary>
        /// Load state from an XML element
        /// </summary>
        /// <param name="xmlElement">XML element containing new state</param>
        public void LoadXml(System.Xml.XmlElement xmlElement)
        {
            XmlNamespaceManager xmlNamespaceManager;
            XmlNodeList xmlNodeList;

            if (xmlElement == null)
            {
                throw new ArgumentNullException("xmlElement");
            }

            xmlNamespaceManager = new XmlNamespaceManager(xmlElement.OwnerDocument.NameTable);
            xmlNamespaceManager.AddNamespace("xsd", XadesSignedXml.XadesNamespaceUri);

            xmlNodeList = xmlElement.SelectNodes("xsd:DigestAlgAndValue", xmlNamespaceManager);
            if (xmlNodeList.Count == 0)
            {
                throw new CryptographicException("DigestAlgAndValue missing");
            }
            this.digestAlgAndValue = new DigestAlgAndValueType("DigestAlgAndValue");
            this.digestAlgAndValue.LoadXml((XmlElement)xmlNodeList.Item(0));

            xmlNodeList = xmlElement.SelectNodes("xsd:CRLIdentifier", xmlNamespaceManager);
            if (xmlNodeList.Count == 0)
            {
                this.crlIdentifier = null;
            }
            else
            {
                this.crlIdentifier = new CRLIdentifier();
                this.crlIdentifier.LoadXml((XmlElement)xmlNodeList.Item(0));
            }
        }
コード例 #8
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public OCSPRef()
 {
     this.ocspIdentifier    = new OCSPIdentifier();
     this.digestAlgAndValue = new DigestAlgAndValueType("DigestAlgAndValue");
 }
コード例 #9
0
ファイル: Cert.cs プロジェクト: ylepikhov/dssnet
 /// <summary>
 /// Default constructor
 /// </summary>
 public Cert()
 {
     this.certDigest   = new DigestAlgAndValueType("CertDigest");
     this.issuerSerial = new IssuerSerial();
 }
コード例 #10
0
ファイル: SignaturePolicyId.cs プロジェクト: versh23/Xades
		/// <summary>
		/// Load state from an XML element
		/// </summary>
		/// <param name="xmlElement">XML element containing new state</param>
		public void LoadXml(System.Xml.XmlElement xmlElement)
		{
			XmlNamespaceManager xmlNamespaceManager;
			XmlNodeList xmlNodeList;
			
			if (xmlElement == null)
			{
				throw new ArgumentNullException("xmlElement");
			}

			xmlNamespaceManager = new XmlNamespaceManager(xmlElement.OwnerDocument.NameTable);
			xmlNamespaceManager.AddNamespace("ds", SignedXml.XmlDsigNamespaceUrl);
			xmlNamespaceManager.AddNamespace("xsd", XadesSignedXml.XadesNamespaceUri);

			xmlNodeList = xmlElement.SelectNodes("xsd:SigPolicyId", xmlNamespaceManager);
			if (xmlNodeList.Count == 0)
			{
				throw new CryptographicException("SigPolicyId missing");
			}
			this.sigPolicyId = new ObjectIdentifier("SigPolicyId");
			this.sigPolicyId.LoadXml((XmlElement)xmlNodeList.Item(0));

			xmlNodeList = xmlElement.SelectNodes("ds:Transforms", xmlNamespaceManager);
			if (xmlNodeList.Count != 0)
			{
				this.transforms = new Transforms();
				this.transforms.LoadXml((XmlElement)xmlNodeList.Item(0));
			}

			xmlNodeList = xmlElement.SelectNodes("xsd:SigPolicyHash", xmlNamespaceManager);
			if (xmlNodeList.Count == 0)
			{
				throw new CryptographicException("SigPolicyHash missing");
			}
			this.sigPolicyHash = new DigestAlgAndValueType("SigPolicyHash");
			this.sigPolicyHash.LoadXml((XmlElement)xmlNodeList.Item(0));

			xmlNodeList = xmlElement.SelectNodes("xsd:SigPolicyQualifiers", xmlNamespaceManager);
			if (xmlNodeList.Count != 0)
			{
				this.sigPolicyQualifiers = new SigPolicyQualifiers();
				this.sigPolicyQualifiers.LoadXml((XmlElement)xmlNodeList.Item(0));
			}
		}
コード例 #11
0
ファイル: OCSPRef.cs プロジェクト: versh23/Xades
		/// <summary>
		/// Default constructor
		/// </summary>
		public OCSPRef()
		{
			this.ocspIdentifier = new OCSPIdentifier();
			this.digestAlgAndValue = new DigestAlgAndValueType("DigestAlgAndValue");
		}
コード例 #12
0
ファイル: CRLRef.cs プロジェクト: gizmo75rus/HCS
 /// <summary>
 /// Default constructor
 /// </summary>
 public CRLRef()
 {
     this.digestAlgAndValue = new DigestAlgAndValueType("DigestAlgAndValue");
     this.crlIdentifier     = new CRLIdentifier();
 }
コード例 #13
0
ファイル: DigestUtil.cs プロジェクト: zinkpad/FirmaXadesNet45
 public static void SetCertDigest(byte[] rawCert, string digestAlgorithm, DigestAlgAndValueType destination)
 {
     using (var hashAlg = GetHashAlg(digestAlgorithm))
     {
         destination.DigestMethod.Algorithm = digestAlgorithm;
         destination.DigestValue = hashAlg.ComputeHash(rawCert);
     }
 }
コード例 #14
0
ファイル: DigestUtil.cs プロジェクト: zinkpad/FirmaXadesNet45
        public static void SetCertDigest(byte[] rawCert, DigestMethod digestMethod, DigestAlgAndValueType destination)
        {
            string digestAlgorithm = null;

            switch (digestMethod)
            {
                case DigestMethod.SHA1:
                    digestAlgorithm = FirmaXades.SHA1Uri;
                    break;

                case DigestMethod.SHA256:
                    digestAlgorithm = FirmaXades.SHA256Uri;
                    break;

                case DigestMethod.SHA512:
                    digestAlgorithm = FirmaXades.SHA512Uri;
                    break;
            }

            SetCertDigest(rawCert, digestAlgorithm, destination);
        }
コード例 #15
0
ファイル: Cert.cs プロジェクト: Gianluigi/dssnet
		/// <summary>
		/// Default constructor
		/// </summary>
		public Cert()
		{
			this.certDigest = new DigestAlgAndValueType("CertDigest");
			this.issuerSerial = new IssuerSerial();
		}
コード例 #16
0
ファイル: Cert.cs プロジェクト: Gianluigi/dssnet
		/// <summary>
		/// Load state from an XML element
		/// </summary>
		/// <param name="xmlElement">XML element containing new state</param>
		public void LoadXml(System.Xml.XmlElement xmlElement)
		{
			XmlNamespaceManager xmlNamespaceManager;
			XmlNodeList xmlNodeList;
			
			if (xmlElement == null)
			{
				throw new ArgumentNullException("xmlElement");
			}

			xmlNamespaceManager = new XmlNamespaceManager(xmlElement.OwnerDocument.NameTable);
			xmlNamespaceManager.AddNamespace("ds", SignedXml.XmlDsigNamespaceUrl);
			xmlNamespaceManager.AddNamespace("xsd", XadesSignedXml.XadesNamespaceUri);

			xmlNodeList = xmlElement.SelectNodes("xsd:CertDigest", xmlNamespaceManager);
			if (xmlNodeList.Count == 0)
			{
				throw new CryptographicException("CertDigest missing");
			}
			this.certDigest = new DigestAlgAndValueType("CertDigest");
			this.certDigest.LoadXml((XmlElement)xmlNodeList.Item(0));

			xmlNodeList = xmlElement.SelectNodes("xsd:IssuerSerial", xmlNamespaceManager);
			if (xmlNodeList.Count == 0)
			{
				throw new CryptographicException("IssuerSerial missing");
			}
			this.issuerSerial = new IssuerSerial();
			this.issuerSerial.LoadXml((XmlElement)xmlNodeList.Item(0));
		}