Exemplo n.º 1
0
        private void LoadStreamInput(Stream stream)
        {
            XmlResolver resolver  = (ResolverSet ? _xmlResolver : XmlResolverHelper.GetThrowingResolver());
            XmlReader   valReader = Utils.PreProcessStreamInput(stream, resolver, BaseURI);

            _document = new XmlDocument();
            _document.PreserveWhitespace = true;
            _document.Load(valReader);
        }
Exemplo n.º 2
0
        private void LoadXmlNodeListInput(XmlNodeList nodeList)
        {
            // Use C14N to get a document
            XmlResolver  resolver = (ResolverSet ? _xmlResolver : XmlResolverHelper.GetThrowingResolver());
            CanonicalXml c14n     = new CanonicalXml((XmlNodeList)nodeList, resolver, true);

            using (MemoryStream ms = new MemoryStream(c14n.GetBytes()))
            {
                LoadStreamInput(ms);
            }
        }
Exemplo n.º 3
0
        private void LoadStreamInput(Stream stream)
        {
            XmlDocument document = new XmlDocument();

            document.PreserveWhitespace = true;
            XmlResolver resolver  = (ResolverSet ? _xmlResolver : XmlResolverHelper.GetThrowingResolver());
            XmlReader   xmlReader = Utils.PreProcessStreamInput(stream, resolver, BaseURI);

            document.Load(xmlReader);
            _containingDocument = document;
            _nsm = new XmlNamespaceManager(_containingDocument.NameTable);
            _nsm.AddNamespace("enc", EncryptedXml.XmlEncNamespaceUrl);
            // select all EncryptedData elements
            _encryptedDataList = document.SelectNodes("//enc:EncryptedData", _nsm);
        }
Exemplo n.º 4
0
        private void LoadStreamInput(Stream stream)
        {
            XmlDocument doc = new XmlDocument();

            doc.PreserveWhitespace = true;
            XmlResolver resolver  = (ResolverSet ? _xmlResolver : XmlResolverHelper.GetThrowingResolver());
            XmlReader   xmlReader = Utils.PreProcessStreamInput(stream, resolver, BaseURI);

            doc.Load(xmlReader);
            _containingDocument = doc;
            if (_containingDocument == null)
            {
                throw new CryptographicException(SR.Cryptography_Xml_EnvelopedSignatureRequiresContext);
            }
            _nsm = new XmlNamespaceManager(_containingDocument.NameTable);
            _nsm.AddNamespace("dsig", SignedXml.XmlDsigNamespaceUrl);
        }
Exemplo n.º 5
0
        public override void LoadInput(object obj)
        {
            XmlResolver resolver = (ResolverSet ? _xmlResolver : XmlResolverHelper.GetThrowingResolver());

            if (obj is Stream)
            {
                _excCanonicalXml = new ExcCanonicalXml((Stream)obj, _includeComments, _inclusiveNamespacesPrefixList, resolver, BaseURI);
            }
            else if (obj is XmlDocument)
            {
                _excCanonicalXml = new ExcCanonicalXml((XmlDocument)obj, _includeComments, _inclusiveNamespacesPrefixList, resolver);
            }
            else if (obj is XmlNodeList)
            {
                _excCanonicalXml = new ExcCanonicalXml((XmlNodeList)obj, _includeComments, _inclusiveNamespacesPrefixList, resolver);
            }
            else
            {
                throw new ArgumentException(SR.Cryptography_Xml_IncorrectObjectType, nameof(obj));
            }
        }