Exemplo n.º 1
0
 public XmlElement GetXml()
 {
     // If we have a document context, then return a signature element in this context
     if (_containingDocument != null)
     {
         return(m_signature.GetXml(_containingDocument));
     }
     else
     {
         return(m_signature.GetXml());
     }
 }
Exemplo n.º 2
0
 /// <include file='doc\SignedXml.uex' path='docs/doc[@for="SignedXml.GetXml"]/*' />
 public XmlElement GetXml()
 {
     // If we have a document context, then return a signature element in this context
     if (m_containingDocument != null)
     {
         return(m_containingDocument.ImportNode(m_signature.GetXml(), true) as XmlElement);
     }
     else
     {
         return(m_signature.GetXml());
     }
 }
Exemplo n.º 3
0
        //
        // private methods
        //

        private byte[] GetC14NDigest(HashAlgorithm hash)
        {
            bool        isKeyedHashAlgorithm = hash is KeyedHashAlgorithm;
            string      baseUri = _containingDocument?.BaseURI;
            XmlDocument doc     = Utils.PreProcessElementInput(m_signature.GetXml());

            // Add non default namespaces in scope
            CanonicalXmlNodeList namespaces = (_context == null ? null : Utils.GetPropagatedAttributes(_context));

            Utils.AddNamespaces(doc.DocumentElement, namespaces);

            Transform c14nMethodTransform = m_signature.CanonicalizationMethodObject;

            c14nMethodTransform.LoadInput(doc);
            return(c14nMethodTransform.GetDigestedOutput(hash));
        }
Exemplo n.º 4
0
 public XmlElement GetXml()
 {
     return(m_signature.GetXml(envdoc));
 }
 private void UpdatePartFromSignature(Signature sig)
 {
     // write to stream
     using (Stream s = SignaturePart.GetStream(FileMode.Create, FileAccess.Write))
     {
         using (XmlTextWriter xWriter = new XmlTextWriter(s, System.Text.Encoding.UTF8))
         {
             xWriter.WriteStartDocument(true);
             sig.GetXml().WriteTo(xWriter);
             xWriter.WriteEndDocument();
         }
     }
     _signedXml = null;    // force a re-parse
 }