From: Miguel de Icaza Date: Fri, 24 Nov 2006 17:52:34 +0000 (-0000) Subject: Abandone X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=7e52dd64590a7cf91e1505316fcc482c65d424fb;p=mono.git Abandone svn path=/trunk/mcs/; revision=68438 --- diff --git a/mcs/class/Microsoft.Web.Services/Assembly/AssemblyInfo.cs b/mcs/class/Microsoft.Web.Services/Assembly/AssemblyInfo.cs deleted file mode 100644 index e9cfb6f0fc2..00000000000 --- a/mcs/class/Microsoft.Web.Services/Assembly/AssemblyInfo.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -// AssemblyInfo.cs -// -// Author: -// Andreas Nahr (ClassDevelopment@A-SoftTech.com) -// -// (C) 2003 Ximian, Inc. http://www.ximian.com -// - -using System; -using System.Reflection; -using System.Resources; -using System.Security; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about the system assembly - -#if (WSE1) - [assembly: AssemblyVersion("1.0.0.0")] - [assembly: SatelliteContractVersion("1.0.0.0")] -#endif -#if (WSE2) - [assembly: AssemblyVersion("2.0.0.0")] - [assembly: SatelliteContractVersion("2.0.0.0")] -// [assembly: ComCompatibleVersion(1, 0, 3300, 0)] -// [assembly: TypeLibVersion(1, 10)] -#endif - -[assembly: AssemblyTitle("Microsoft.Web.Services.dll")] -[assembly: AssemblyDescription("Web Service Enhancement")] -[assembly: AssemblyConfiguration("Development version")] -[assembly: AssemblyCompany("MONO development team")] -[assembly: AssemblyProduct("MONO CLI")] -[assembly: AssemblyCopyright("(c) 2003 Various Authors")] - -[assembly: CLSCompliant(true)] -[assembly: AssemblyDefaultAlias("Microsoft.Web.Services.dll")] -[assembly: AssemblyInformationalVersion("0.0.0.1")] -[assembly: NeutralResourcesLanguage("en-US")] - -[assembly: AssemblyDelaySign(true)] -[assembly: AssemblyKeyFile("mswse.pub")] diff --git a/mcs/class/Microsoft.Web.Services/Assembly/ChangeLog b/mcs/class/Microsoft.Web.Services/Assembly/ChangeLog deleted file mode 100644 index 85e8cbe6893..00000000000 --- a/mcs/class/Microsoft.Web.Services/Assembly/ChangeLog +++ /dev/null @@ -1,9 +0,0 @@ -2003-09-06 Sebastien Pouliot - - * AssemblyInfo.cs: Removed AllowPartiallyTrustedCallers - -2003-09-04 Sebastien Pouliot - - * AssemblyInfo.cs: Added. Copied from corlib and ajusted for WSE. - * Locale.cs: Added. Copied from corlib. - * ChangeLog: Added \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/ChangeLog b/mcs/class/Microsoft.Web.Services/ChangeLog deleted file mode 100644 index ffd661b50f2..00000000000 --- a/mcs/class/Microsoft.Web.Services/ChangeLog +++ /dev/null @@ -1,195 +0,0 @@ -2004-11-25 Raja R Harinath - - * Makefile (dist-local): Use cp -p. - -2004-03-30 Sebastien Pouliot - - * Microsoft.Web.Services.dll.2.sources: Added Mono.Xml.XmlCanonicalizer - * Microsoft.Web.Services.dll.sources: Added Mono.Xml.XmlCanonicalizer - -2004-03-23 Sebastien Pouliot - - * mswse.pub: New. Microsoft WSE public key to be used for - strongnaming the Microsoft.Web.Service assembly. - -2003-12-08 Peter Williams - - * Makefile: Update Makefile to use embedded tabs instead - of ECHO_ESCAPE. Fixes build on OS X. - -2003-10-26 Todd Berman - - * Microsoft.Web.Services.dll.2.sources: Added RoutingFault.cs - * Microsoft.Web.Services.dll.2.sources: Added Found.cs - * Microsoft.Web.Services.dll.sources: Added RoutingFault.cs - * Microsoft.Web.Services.dll.sources: Added Found.cs - -2003-10-25 Sebastien Pouliot - - * Microsoft.Web.Services.dll.2.sources: Added IMutableSecurityToken.cs - in Microsoft.Web.Services.Security (new in WSE2) - -2003-10-22 Todd Berman - - * Microsoft.Web.Services.dll.2.sources: Added SoapDimeFormatter.cs - * Microsoft.Web.Services.dll.2.sources: Added SoapChannelCollection.cs - * Microsoft.Web.Services.dll.2.sources: Added SoapChannel.cs - * Microsoft.Web.Services.dll.2.sources: Added SoapTransport.cs - * Microsoft.Web.Services.dll.2.sources: Added MessagingConfiguration.cs - * Microsoft.Web.Services.dll.2.sources: Added SoapPlainFormatter.cs - * Microsoft.Web.Services.dll.2.sources: Added SoapTcpTransport.cs - * Microsoft.Web.Services.dll.2.sources: Added SoapTcpChannel.cs - * Microsoft.Web.Services.dll.2.sources: Added SoapTcpListener.cs - * Microsoft.Web.Services.dll.2.sources: Added AsyncResult.cs - -2003-10-12 Todd Berman - - * Makefile: Fixed up the test target so it works now - -2003-10-08 Todd Berman - - * Microsoft.Web.Services.dll2.sources: Added RelatesTo.cs - -2003-10-08 Todd Berman - - * Microsoft.Web.Services.dll.2.sources: Added FaultTo.cs - * Microsoft.Web.Services.dll.2.sources: Added From.cs - * Microsoft.Web.Services.dll.2.sources: Added MessageID.cs - * Microsoft.Web.Services.dll.2.sources: Added Recipient.cs - -2003-10-07 Todd Berman - - * Microsoft.Web.Services.dll.2.sources: Added ReferenceProperties.cs - -2003-10-07 Todd Berman - - * Microsoft.Web.Services.dll.2.sources: Added OpenElementElement.cs - -2003-10-05 Sebastien Pouliot - - * Microsoft.Web.Services.Diagnostics: Added new namespace with - internal TraceFilter.cs and public TraceInputFilter.cs and - TraceOutputFilter.cs - * Microsoft.Web.Services.dll.sources: Removed classes from - Microsoft.Web.Services.Policy and Microsoft.Web.Services.Messaging - from the WSE 1.0 build (extra - corcompare). - -2003-10-05 Todd Berman - - * Microsoft.Web.Services.dll.2.sources: Added QualifiedName.cs - -2003-10-05 Todd Berman - - * Microsoft.Web.Services.dll.2.sources: Added AddressList.cs - -2003-10-05 Todd Berman - - * Microsoft.Web.Services.Security/UsernameToken.cs: small WSE2 build - fixes. - * Microsoft.Web.Services.Addressing/AttributeUri.cs: implemented. - * Microsoft.Web.Services.Addressing/Address.cs: implemented - -2003-10-04 Sebastien Pouliot - - * Microsoft.Web.Services.dll.sources: Added ChainStream to build. - * Microsoft.Web.Services.dll.2.sources: Added ChainStream to build. - -2003-10-04 Todd Berman - - * Microsoft.Web.Services.Addressing/Action.cs: implemented - -2003-09-30 Todd Berman - - * Microsoft.Web.Services.Addressing/AttributedUriString.cs: implemented - -2003-09-30 Todd Berman - - * Ok, this was the beforementioned (on -devel) WSE Makefile edit. - - Right now, this builds both WSE1 and WSE2, and installs them both, as - - Microsoft.Web.Services.1.dll and - Microsoft.Web.Services.2.dll respectively. - - It will also install Microsoft.Web.Services.1.dll as - Microsoft.Web.Services.dll. This behaviour can be overridden by defining - DEFAULT_WSE2 - - This can be defined in config.make or on the commandline (i think). - I have tested clean, all, and install, but have not tested dist or test. - dist should work, test might or might not. (however, a toplevel make - dist wont be affected, because this dir is not being built by default) - - This is pure amateur makefile hackery on my part, anyone who want to - improve on this effort, please feel free. - -2003-09-29 Todd Berman - - * Microsoft.Web.Services.Addressing/AttributedUriString.cs: stubs - * Microsoft.Web.Services.Xml/OpenAttributeElement.cs: implemented - -2003-09-29 Todd Berman - - * Microsoft.Web.Services.Addressing/AddressingHeaders.cs: Partially - stubbed. - * Microsoft.Web.Services/SoapContext.cs: using AddressingHeaders now. - -2003-09-25 Todd Berman - - * Microsoft.Web.Services/SoapContext.cs: Added Action, To and ReplyTo - properties. - * Microsoft.Web.Services.Addressing/ - Action.cs: - Address.cs: - AttributedUri.cs: - AttributedUriString.cs: - EndpointReference.cs: - EndpointReferenceType.cs: - ReplyTo.cs: - To.cs: Partially stubbed. - * Microsoft.Web.Services.Messaging/SoapReceiver.cs: Added protected - abstract method Receive. - * Microsoft.Web.Services.Messaging/ - SoapReceivers.cs: - SoapSender.cs: Partially stubbed. - * Microsoft.Web.Services.Xml/IXmlElement.cs: Moved to the Xml namespace - which is where MS has it, added the namespace to classes that needed it - * Microsoft.Web.Services.Xml/OpenAttributeElement.cs: Partially stubbed - * Microsoft.Web.Services.dll.sources: Added new files. - -2003-09-06 Sebastien Pouliot - - * Microsoft.Web.Services.dll.sources: Added stubbed input/output soap - filters for Routing and Referral so Configuration can be compiled. - -2003-09-06 Sebastien Pouliot - - * Microsoft.Web.Services.dll.sources: Added another shared (and - renamed) file from System.Security assembly (Signature.cs -> - SignedXmlSignature.cs). - -2003-09-05 Sebastien Pouliot - - * Microsoft.Web.Services.dll.sources: Added stubbed classes from - Microsoft.Web.Services.Configuration to fix compilation. - -2003-09-04 Sebastien Pouliot - - * Makefile: Added reference to System.Security assembly and a define - for WSE1 (required for classes shared between SS and WSE). - * Microsoft.Web.Services.dll.sources: Added (shared) files from - System.Security assembly. Removed unused files. Added Assembly files. - -2003-09-04 Duncan Mak - - * Integrate the files from Sebastien. - -2003-09-02 Duncan Mak - - * Microsoft.Web.Services/Soap.cs: - * Microsoft.Web.Services/IXmlElement.cs: Implemented. - -2003-09-02 Daniel Kornhauser - - * Microsoft.Web.Services: All Exceptions in this assembly - implemented. diff --git a/mcs/class/Microsoft.Web.Services/Makefile b/mcs/class/Microsoft.Web.Services/Makefile deleted file mode 100644 index 3eef36e9fc4..00000000000 --- a/mcs/class/Microsoft.Web.Services/Makefile +++ /dev/null @@ -1,229 +0,0 @@ -thisdir = class/Microsoft.Web.Services -SUBDIRS = -include ../../build/rules.make - -LIBRARY = Microsoft.Web.Services.1.dll -LIB_MCS_FLAGS = /r:System.dll /r:System.Security.dll /r:System.Web.dll /r:System.Web.Services.dll /r:System.Xml.dll /r:System.Security.dll /r:Mono.Security.dll /d:WSE1 -NO_TEST = yes - -LIBRARY2 = Microsoft.Web.Services.2.dll -LIB_MCS_FLAGS2 = /r:System.dll /r:System.Security.dll /r:System.Web.dll /r:System.Web.Services.dll /r:System.Xml.dll /r:System.Security.dll /r:Mono.Security.dll /d:WSE2 -NO_TEST2 = yes - -# We are using a custom makefile to build both WSE1 and WSE2 - -sourcefile = Microsoft.Web.Services.dll.sources -sourcefile2 = Microsoft.Web.Services.dll.2.sources -ifdef PLATFORM_CHANGE_SEPARATOR_CMD -response = $(depsdir)/$(LIBRARY).response -response2 = $(depsdir)/$(LIBRARY2).response -else -response = $(sourcefile) -response2 = $(sourcefile2) -endif -makefrag = $(depsdir)/$(LIBRARY).makefrag -makefrag2 = $(depsdir)/$(LIBRARY2).makefrag -stampfile = $(depsdir)/$(LIBRARY).stamp -stampfile2 = $(depsdir)/$(LIBRARY2).stamp -the_lib = $(topdir)/class/lib/$(LIBRARY) -the_lib2 = $(topdir)/class/lib/$(LIBRARY2) -the_pdb = $(patsubst %.dll,%.pdb,$(the_lib)) -the_pdb2 = $(patsubst %.dll,%.pdb,$(the_lib2)) - -ifndef NO_TEST -test_lib = $(patsubst %.dll,%_test.dll,$(LIBRARY)) -test_lib2 = $(patsubst %.dll, %_test.dll,$(LIBRARY2)) -test_pdb = $(patsubst %.dll,%.pdb,$(test_lib)) -test_pdb2 = $(patsubst %.dll,%.pdb,$(test_lib2)) -test_sourcefile = $(test_lib).sources -test_sourcefile2 = $(test_lib2).sources -test_response = $(depsdir)/$(test_lib).response -test_response2 = $(depsdir)/Microsoft.Web.Services.2_test.dll.response -test_makefrag = $(depsdir)/$(test_lib).makefrag -test_makefrag2 = $(depsdir)/Microsoft.Web.Services.2_test.dll.makefrag -test_stampfile = $(depsdir)/$(test_lib).stamp -test_stampfile2 = $(depsdir)/Microsoft.Web.Services.2_test.dll.stamp -test_flags = /r:$(the_lib) /r:$(topdir)/class/lib/NUnit.Framework.dll $(TEST_MCS_FLAGS) -test_flags2 = /r:$(the_lib2) /r:$(topdir)/class/lib/NUnit.Framework.dll $(TEST_MCS_FLAGS) -endif - -all-local: $(the_lib) $(the_lib2) - -ifdef DEFAULT_WSE2 -def_lib = $(the_lib2) -else -def_lib = $(the_lib) -endif - -install-local: $(the_lib) $(the_lib2) - $(MKINSTALLDIRS) $(DESTDIR)$(prefix)/lib - $(INSTALL_LIB) $(the_lib) $(DESTDIR)$(prefix)/lib - $(INSTALL_LIB) $(the_lib2) $(DESTDIR)$(prefix)/lib - $(INSTALL_LIB) $(def_lib) $(DESTDIR)$(prefix)/lib/Microsoft.Web.Services.dll - -clean-local: - -rm -f $(the_lib) $(makefrag) $(test_lib) \ - $(the_lib2) $(makefrag2) $(test_lib2) \ - $(test_makefrag) $(test_response) \ - $(test_makefrag2) $(test_response2) \ - $(stampfile) $(test_stampfile) \ - $(stampfile2) $(test_stampfile2) \ - $(the_pdb) $(test_pdb) \ - $(the_pdb2) $(test_pdb2) \ - TestResult.xml -ifdef PLATFORM_CHANGE_SEPARATOR_CMD - -rm -rf $(response) $(response2) -endif - -ifndef NO_TEST -test-local: $(the_lib) $(test_lib) $(the_lib2) $(test_lib2) - -run-test-local: - $(TEST_RUNTIME) $(TEST_HARNESS) $(test_lib) - -else -test-local: $(the_lib) $(the_lib2) - -run-test-local: -endif - -DISTFILES = $(sourcefile) $(test_sourcefile) $(EXTRA_DISTFILES) - -ifdef NO_TEST -TEST_FILES = -else -TEST_FILES = `cat $(test_sourcefile) |sed -e 's,^\(.\),Test/\1,'` -TEST_FILES2 = `cat $(test_sourcefile2) |sed -e 's,^\(.\),Test/\1,'` -endif - -dist-local: dist-default - for f in `cat $(sourcefile)` $(TEST_FILES) ; do \ - dest=`dirname $(distdir)/$$f` ; \ - $(MKINSTALLDIRS) $$dest && cp -p $$f $$dest || exit 1 ; \ - done - for f in `cat $sourcefile2)` $(TEST_FILES) ; do \ - dest=`dirname $(distdir)/$$f` ; \ - $(MKINSTALLDIRS) $$dest && cp -p $$f $$dest || exit 1; \ - done - -# Fun with dependency tracking - -$(the_lib): $(makefrag) $(stampfile) $(response) - $(CSCOMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) /target:library /out:$(topdir)/class/lib/Microsoft.Web.Services.dll @$(response) - mv $(topdir)/class/lib/Microsoft.Web.Services.dll $(topdir)/class/lib/Microsoft.Web.Services.1.dll - -# warning: embedded tab in the 'echo touch' line -$(makefrag): $(sourcefile) - @echo Creating $@ ... - @echo "HAVE_MAKEFRAG = yes" >$@.new - @echo "$(stampfile): \\" >>$@.new - @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new - @cat $@.new |sed -e '$$s, \\$$,,' >$@ - @echo " touch \$$@" >>$@ - @rm -rf $@.new - -ifdef PLATFORM_CHANGE_SEPARATOR_CMD -$(response): $(sourcefile) - @echo Creating $@ ... - @cat $< |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@ -endif - --include $(makefrag) - -ifndef HAVE_MAKEFRAG -$(stampfile): - touch $@ -endif - -$(the_lib2): $(makefrag2) $(stampfile2) $(response2) - $(CSCOMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS2) /target:library /out:$(topdir)/class/lib/Microsoft.Web.Services.dll @$(response2) - mv $(topdir)/class/lib/Microsoft.Web.Services.dll $(topdir)/class/lib/Microsoft.Web.Services.2.dll - -# warning: embedded tab in the 'echo touch' line -$(makefrag2): $(sourcefile2) - @echo Creating $@ ... - @echo "HAVE_MAKEFRAG = yes" >$@.new - @echo "$(stampfile2): \\" >>$@.new - @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new - @cat $@.new |sed -e '$$s, \\$$,,' >$@ - @echo " touch \$$@" >>$@ - @rm -rf $@.new - -ifdef PLATFORM_CHANGE_SEPARATOR_CMD -$(response2): $(sourcefile2) - @echo Creating $@ ... - @cat $< |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@ -endif - --include $(makefrag2) - -ifndef HAVE_MAKEFRAG -$(stampfile2): - touch $@ -endif - -include ../../build/config.make - -# for now, don't give any /lib flags or set MONO_PATH, since we -# give a full path to the assembly. - -ifndef NO_TEST -$(test_lib): $(test_makefrag) $(the_lib) $(test_response) $(test_stampfile) - $(CSCOMPILE) /target:library /out:$@ $(test_flags) @$(test_response) - -$(test_response): $(test_sourcefile) - @echo Creating $@ ... -ifdef PLATFORM_CHANGE_SEPARATOR_CMD - @cat $< |sed -e 's,^\(.\),Test/\1,' |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@ -else - @cat $< |sed -e 's,^\(.\),Test/\1,' >$@ -endif - -# warning: embedded tab in the 'echo touch' line -$(test_makefrag): $(test_response) - @echo Creating $@ ... - @echo "HAVE_TEST_MAKEFRAG = yes" >$@.new - @echo "$(test_stampfile): \\" >>$@.new - @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new - @cat $@.new |sed -e '$$s, \\$$,,' >$@ - @echo " touch \$$@" >>$@ - @rm -rf $@.new - --include $(test_makefrag) -endif - -ifndef HAVE_TEST_MAKEFRAG -$(test_stampfile): - touch $@ -endif - -ifndef NO_TEST -$(test_lib2): $(test_makefrag2) $(the_lib2) $(test_response2) $(test_stampfile2) - $(CSCOMPILE) /target:library /out:$@ $(test_flags2) @$(test_response2) - -$(test_response2): $(test_sourcefile2) - @echo Creating $@ ... -ifdef PLATFORM_CHANGE_SEPARATOR_CMD - @cat $< |sed -e 's,^\(.\),Test/\1,' |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@ -else - @cat $< |sed -e 's,^\(.\),Test/\1,' >$@ -endif - - -# warning: embedded tab in the 'echo touch' line -$(test_makefrag2): $(test_response2) - @echo Creating $@ ... - @echo "HAVE_TEST_MAKEFRAG = yes" >$@.new - @echo "$(test_stampfile2): \\" >>$@.new - @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new - @cat $@.new |sed -e '$$s, \\$$,,' >$@ - @echo " touch \$$@" >>$@ - @rm -rf $@.new - --include $(test_makefrag2) -endif -# -ifndef HAVE_TEST_MAKEFRAG -$(test_stampfile2): - touch $@ -endif diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.1_test.dll.sources b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.1_test.dll.sources deleted file mode 100644 index 526782ce1c1..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.1_test.dll.sources +++ /dev/null @@ -1 +0,0 @@ -Microsoft.Web.Services.Configuration/ConfigurationBaseTest.cs diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.2_test.dll.sources b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.2_test.dll.sources deleted file mode 100644 index 1bb22114710..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.2_test.dll.sources +++ /dev/null @@ -1,5 +0,0 @@ -Microsoft.Web.Services.Addressing/Action.cs -Microsoft.Web.Services.Addressing/Address.cs -Microsoft.Web.Services.Addressing/AddressingHeaders.cs -Microsoft.Web.Services.Addressing/AddressList.cs -Microsoft.Web.Services.Addressing/EndpointReference.cs diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/Action.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/Action.cs deleted file mode 100644 index 8a5b24ace05..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/Action.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -// Microsoft.Web.Services.Addressing.Action.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman -// - -using System; -using System.Xml; -using Microsoft.Web.Services.Xml; - -namespace Microsoft.Web.Services.Addressing -{ - - public class Action : AttributedUriString, IXmlElement - { - - - public Action (string uri) : base (uri) - { - } - - public Action (XmlElement element) : base () - { - LoadXml (element); - } - - public static implicit operator Action(string obj) - { - - return new Action (obj); - - } - - public static implicit operator string(Action obj) - { - - if(obj == null) { - return null; - } - return obj.Value; - - } - - public XmlElement GetXml (XmlDocument document) - { - if(document == null) { - throw new ArgumentNullException ("document"); - } - - XmlElement element = document.CreateElement ("wsa", - "Action", - "http://schemas.xmlsoap.org/ws/2003/03/addressing"); - - GetXmlUri (document, element); - - return element; - - } - - public void LoadXml (XmlElement element) - { - if(element == null) { - throw new ArgumentNullException ("element"); - } - - if(element.LocalName != "Action" || element.NamespaceURI != "http://schemas.xmlsoap.org/ws/2003/03/addressing") { - throw new ArgumentException ("Invalid Element Supplied"); - } - - LoadXmlUri (element); - } - - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/Address.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/Address.cs deleted file mode 100644 index 347743e6346..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/Address.cs +++ /dev/null @@ -1,71 +0,0 @@ -// -// Microsoft.Web.Services.Addressing.Address.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Net; -using System.Xml; -using Microsoft.Web.Services.Xml; - -namespace Microsoft.Web.Services.Addressing -{ - - public class Address : AttributedUri, IXmlElement - { - - public Address (Uri uri) : base (uri) - { - } - - public Address (XmlElement element) : base () - { - LoadXml (element); - } - - public XmlElement GetXml (XmlDocument document) - { - if(document == null) { - throw new ArgumentNullException ("document"); - } - - XmlElement element = document.CreateElement ("wsa", - "Address", - "http://schemas.xmlsoap.org/ws/2003/03/addressing"); - - GetXmlUri (document, element); - - return element; - - } - - public void LoadXml (XmlElement element) - { - - if(element == null) { - throw new ArgumentNullException ("element"); - } - if(element.LocalName != "Address" || element.NamespaceURI != "http://schemas.xmlsoap.org/ws/2003/03/addressing") { - throw new ArgumentException ("Invalid Element Supplied"); - } - - LoadXmlUri (element); - - } - - public static implicit operator Address (Uri uri) - { - return new Address(uri); - } - - public static implicit operator Uri (Address address) - { - if(address == null) { - return null; - } - return address.Value; - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/AddressList.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/AddressList.cs deleted file mode 100644 index 00f206cf647..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/AddressList.cs +++ /dev/null @@ -1,123 +0,0 @@ -// -// Microsoft.Web.Services.Addressing.AddressList.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Collections; - -namespace Microsoft.Web.Services.Addressing -{ - - public class AddressList : ICollection, IEnumerable - { - - private ArrayList _list; - - public AddressList () - { - _list = new ArrayList (); - } - - public int Add (Address address) - { - if(address == null) { - throw new ArgumentNullException ("address"); - } - return _list.Add (address); - } - - public bool Contains (Address address) - { - if(address == null) { - throw new ArgumentNullException ("address"); - } - return _list.Contains (address); - } - - public void CopyTo (Array array, int index) - { - if(array == null) { - throw new ArgumentNullException ("array"); - } - if(index < 0 || index > _list.Count) { - throw new ArgumentOutOfRangeException ("index"); - } - _list.CopyTo (array, index); - } - - public IEnumerator GetEnumerator () - { - return _list.GetEnumerator (); - } - - public int IndexOf (Address address) - { - if(address == null) { - throw new ArgumentNullException ("address"); - } - return _list.IndexOf (address); - } - - public void Insert (int index, Address address) - { - if(index < 0 || index > _list.Count) { - throw new ArgumentOutOfRangeException ("index"); - } - if(address == null) { - throw new ArgumentNullException ("address"); - } - _list.Insert (index, address); - } - - public void Remove (Address address) - { - _list.Remove (address); - } - - public void RemoveAt (int index) - { - if (index < 0 || index > _list.Count) { - throw new ArgumentOutOfRangeException ("index"); - } - _list.RemoveAt (index); - } - - public int Count { - get { return _list.Count; } - } - - public bool IsFixedSize { - get { return _list.IsFixedSize; } - } - - public bool IsReadOnly { - get { return _list.IsReadOnly; } - } - - public bool IsSynchronized { - get { return _list.IsSynchronized; } - } - - public Address this[int index] { - get { - if(index < 0 || index > _list.Count) { - throw new ArgumentOutOfRangeException ("index"); - } - return (Address) _list[index]; - } - set { - if(index < 0 || index > _list.Count) { - throw new ArgumentOutOfRangeException ("index"); - } - _list[index] = value; - } - } - - public object SyncRoot { - get { return _list.SyncRoot; } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/AddressingFormatException.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/AddressingFormatException.cs deleted file mode 100644 index 8bc1f83641d..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/AddressingFormatException.cs +++ /dev/null @@ -1,28 +0,0 @@ -// -// Microsoft.Web.Services.Addressing.AddressingFormatException.cs -// -// Author: Daniel Kornhauser dkor@alum.mit.edu -// -// (C) Copyright, Ximian, Inc. -// - -using System; -using System.Web.Services.Protocols; -using System.Xml; - -namespace Microsoft.Web.Services.Addressing { - - [Serializable] - public class AddressingFormatException : SoapHeaderException - { - public static readonly string MissingActionElement - = "The <{0}> element should not have any child nodes other than text."; - - - public AddressingFormatException (string message) - : base (message, XmlQualifiedName.Empty) - { - } - } -} - diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/AddressingHeaders.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/AddressingHeaders.cs deleted file mode 100644 index 2b420329d25..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/AddressingHeaders.cs +++ /dev/null @@ -1,189 +0,0 @@ -// -// Microsoft.Web.Services.Addressing.AddressingHeaders.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Xml; -using Microsoft.Web.Services; - -namespace Microsoft.Web.Services.Addressing -{ - - public class AddressingHeaders - { - - private Action _action; - private ReplyTo _replyTo; - private To _to; - private FaultTo _faultTo; - private From _from; - private MessageID _messageID; - private Recipient _recipient; - private RelatesTo _relatesTo; - - public AddressingHeaders (SoapEnvelope env) - { - Load (env); - } - - public AddressingHeaders () - { - Defaults (); - } - - public void Clear () - { - _action = null; - _faultTo = null; - _from = null; - _messageID = null; - _recipient = null; - _relatesTo = null; - _replyTo = null; - _to = null; - } - - public AddressingHeaders Clone () - { - AddressingHeaders clone = new AddressingHeaders (); - - clone.Action = _action; - clone.FaultTo = _faultTo; - clone.From = _from; - clone.MessageID = _messageID; - clone.Recipient = _recipient; - clone.RelatesTo = _relatesTo; - clone.ReplyTo = _replyTo; - clone.To = _to; - - return clone; - } - - public void Defaults () - { - _action = null; - _faultTo = null; - _from = new From (new Uri ("http://schemas.xmlsoap.org/ws/2003/03/addressing/role/anonymous") ); - _messageID = new MessageID (); - _recipient = null; - _relatesTo = null; - _replyTo = null; - _to = null; - } - - public void Load (SoapEnvelope env) - { - if(env == null) { - throw new ArgumentNullException ("envelope"); - } - Clear (); - if(env.Header == null) { - return; - } - int item = 0; - while (item < env.Header.ChildNodes.Count) { - XmlElement element = (XmlElement) env.Header.ChildNodes[item]; - if(element != null || element.NamespaceURI != "http://schemas.xmlsoap.org/ws/2003/03/addressing") { - - switch (element.LocalName) { - case "Action": - if(_action != null) { - throw new AddressingFormatException ("Two or more Actions detected"); - } - _action = new Action (element); - break; - case "FaultTo": - if(_faultTo != null) { - throw new AddressingFormatException ("Two or more FaultTos detected"); - } - _faultTo = new FaultTo (element); - break; - case "From": - if(_from != null) { - throw new AddressingFormatException ("Two or more Froms detected"); - } - _from = new From (element); - break; - case "MessageID": - if(_messageID != null) { - throw new AddressingFormatException ("Two or more MessageIDs detected"); - } - _messageID = new MessageID (element); - break; - case "Recipient": - if(_recipient != null) { - throw new AddressingFormatException ("Two or more Recipients detected"); - } - _recipient = new Recipient (element); - break; - case "RelatesTo": - if(_relatesTo != null) { - throw new AddressingFormatException ("Two or more RelatesTos detected"); - } - _relatesTo = new RelatesTo (element); - break; - case "ReplyTo": - if(_replyTo != null) { - throw new AddressingFormatException ("Two or more ReplyTos detected"); - } - _replyTo = new ReplyTo (element); - break; - case "To": - if(_to != null) { - throw new AddressingFormatException ("Two or more Tos detected"); - } - _to = new To (element); - break; - } - - } - item++; - } - } - - public Action Action { - get { return _action; } - set { _action = value; } - } - - public FaultTo FaultTo { - get { return _faultTo; } - set { _faultTo = value; } - } - - public From From { - get { return _from; } - set { _from = value; } - } - - public MessageID MessageID { - get { return _messageID; } - set { _messageID = value; } - } - - public Recipient Recipient { - get { return _recipient; } - set { _recipient = value; } - } - - public RelatesTo RelatesTo { - get { return _relatesTo; } - set { _relatesTo = value; } - } - - public ReplyTo ReplyTo { - get { return _replyTo; } - set { _replyTo = value; } - } - - public To To { - get { return _to; } - set { _to = value; } - } - - } - -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/AttributedQName.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/AttributedQName.cs deleted file mode 100644 index 3db0be6e39a..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/AttributedQName.cs +++ /dev/null @@ -1,68 +0,0 @@ -// -// Microsoft.Web.Services.Addressing.AttributedQName.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Xml; -using Microsoft.Web.Services.Xml; - -namespace Microsoft.Web.Services.Addressing -{ - - public class AttributedQName : OpenAttributeElement - { - - private QualifiedName _qname; - - public AttributedQName (QualifiedName qname) : base () - { - if(qname == null) { - throw new ArgumentNullException ("qname"); - } - _qname = qname; - } - - public AttributedQName () : base () - { - } - - public void GetXmlQName (XmlDocument document, XmlElement element) - { - if(document == null) { - throw new ArgumentNullException ("document"); - } - if(element == null) { - throw new ArgumentNullException ("document"); - } - - GetXmlAny (document, element); - _qname.GetQualifiedName (document, element); - } - - public void LoadXmlQName (XmlElement element) - { - ValidateSchema (element); - - LoadXmlAny (element); - - _qname = QualifiedName.FromString (element.InnerText, element); - } - - public void ValidateSchema (XmlElement element) - { - if(element.ChildNodes.Count > 1) { - throw new AddressingFormatException ("wsa_InvalidQName"); - } - } - - public QualifiedName Value { - get { return _qname; } - set { _qname = value; } - } - - } - -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/AttributedUri.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/AttributedUri.cs deleted file mode 100644 index 824040b5602..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/AttributedUri.cs +++ /dev/null @@ -1,89 +0,0 @@ -// -// Microsoft.Web.Services.Addressing.AttributedUri -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Net; -using System.Xml; -using Microsoft.Web.Services.Xml; - -namespace Microsoft.Web.Services.Addressing -{ - - public abstract class AttributedUri : OpenAttributeElement - { - - private Uri _value; - - public AttributedUri (Uri uri) : base () - { - if(uri == null) { - throw new ArgumentNullException ("uri"); - } - - _value = uri; - } - - public AttributedUri (AttributedUri aUri) : base () - { - - _value = aUri.Value; - - foreach (XmlAttribute attribute in aUri.AnyAttributes) { - - AnyAttributes.Add (attribute); - - } - - } - - public AttributedUri () : base () - { - } - - public void GetXmlUri (XmlDocument document, XmlElement element) - { - if(element == null) { - throw new ArgumentNullException ("element"); - } - - element.InnerText = _value.ToString(); - - GetXmlAny(document, element); - } - - public void LoadXmlUri (XmlElement element) - { - if(element == null) { - throw new ArgumentNullException ("element"); - } - - ValidateSchema (element); - - LoadXmlAny (element); - - _value = new Uri(element.InnerText); - - } - - public void ValidateSchema (XmlElement element) - { - if(element.ChildNodes.Count > 1) { - throw new AddressingFormatException ("wsa_InvalidAttributeUri"); - } - if(element.ChildNodes.Count == 1 && !(element.FirstChild is XmlText)) { - throw new AddressingFormatException ("wsa_InvalidAttributeUri"); - } - } - - public Uri Value { - get { return _value; } - set { _value = value; } - } - - } - -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/AttributedUriString.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/AttributedUriString.cs deleted file mode 100644 index ee831ec6627..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/AttributedUriString.cs +++ /dev/null @@ -1,68 +0,0 @@ -// -// Microsoft.Web.Services.Addressing.AttributedUriString -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Xml; -using Microsoft.Web.Services.Xml; - -namespace Microsoft.Web.Services.Addressing -{ - - public abstract class AttributedUriString : OpenAttributeElement - { - - private string _uri; - - public AttributedUriString () : base () - { - } - - public AttributedUriString (string uri) - { - if(uri == null) { - throw new ArgumentNullException ("uri"); - } - _uri = uri; - } - - public void GetXmlUri (XmlDocument document, XmlElement element) - { - if(element == null) { - throw new ArgumentNullException ("element"); - } - element.InnerText = _uri; - GetXmlAny (document, element); - } - - public void LoadXmlUri (XmlElement element) - { - if(element == null) { - throw new ArgumentNullException ("element"); - } - ValidateSchema (element); - LoadXmlAny (element); - _uri = element.InnerText; - } - - public void ValidateSchema (XmlElement element) - { - if(element.ChildNodes.Count >= 2) { - throw new AddressingFormatException ("wsa_InvalidAttributeUri"); - } - if(element.ChildNodes.Count == 1 && !(element.FirstChild is XmlText)) { - throw new AddressingFormatException ("wsa_InvalidAttributeUri"); - } - } - - public string Value { - get { return _uri; } - set { _uri = value; } - } - - } - -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ChangeLog b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ChangeLog deleted file mode 100644 index 939fd8930d9..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ChangeLog +++ /dev/null @@ -1,31 +0,0 @@ -2003-10-12 Todd Berman - - * AddressingHeaders.cs: implemented - * EndpointReferenceType.cs: fixes - -2003-10-08 Todd Berman - - * RelatesTo.cs: Implemented - * ReplyTo.cs: Implemented - * To.cs: Implemented - -2003-10-08 Todd Berman - - * FaultTo.cs: Implemented - * From.cs: Implemented - * MessageID.cs: Implemented - * Recipient.cs: Implemented - -2003-10-07 Todd Berman - - * ReferenceProperties.cs: Implemented - * ServiceName.cs: Partially Implemented - * EndpointReferenceType.cs: Implemented - * EndpointReference.cs: Implemented - -2003-10-05 Todd Berman - - * AddressList.cs: Implemented. - * AttributedQName.cs: Implemented. - * PortType.cs: Implemented - * ChangeLog: Added. diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/EndpointReference.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/EndpointReference.cs deleted file mode 100644 index b91d7fe4d26..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/EndpointReference.cs +++ /dev/null @@ -1,70 +0,0 @@ -// -// Microsoft.Web.Services.Addressing.EndpointReference -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Xml; -using Microsoft.Web.Services.Xml; - -namespace Microsoft.Web.Services.Addressing -{ - - public class EndpointReference : EndpointReferenceType, IXmlElement - { - - public EndpointReference (Address address) : base (address) - { - } - - public EndpointReference (Uri uri) : base (uri) - { - } - - public EndpointReference (XmlElement element) : base () - { - LoadXml (element); - } - - public XmlElement GetXml (XmlDocument document) - { - if(document == null) { - throw new ArgumentNullException ("document"); - } - XmlElement element = document.CreateElement ("wsa", - "EndpointReference", - "http://schemas.xmlsoap.org/ws/2003/03/addressing"); - - GetXmlAny (document, element); - return element; - } - - public void LoadXml (XmlElement element) - { - if(element == null) { - throw new ArgumentNullException ("element"); - } - if(element.LocalName != "EndpointReference" || element.NamespaceURI != "http://schemas.xmlsoap.org/ws/2003/03/addressing") { - throw new ArgumentException ("Invalid Element Supplied"); - } - LoadXmlAny (element); - } - - public static implicit operator EndpointReference (Uri uri) - { - return new EndpointReference (uri); - } - - public static implicit operator Uri (EndpointReference obj) - { - if(obj == null) { - return null; - } - return obj.Address.Value; - } - - } - -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/EndpointReferenceType.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/EndpointReferenceType.cs deleted file mode 100644 index 1a89cd5c243..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/EndpointReferenceType.cs +++ /dev/null @@ -1,129 +0,0 @@ -// -// Microsoft.Web.Services.Addressing -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Xml; -using Microsoft.Web.Services.Xml; - -namespace Microsoft.Web.Services.Addressing -{ - - public abstract class EndpointReferenceType : OpenElement - { - - private Address _address; - private PortType _portType; - private ReferenceProperties _properties; - private ServiceName _serviceName; - - public EndpointReferenceType (Uri address) : base () - { - if(address == null) { - throw new ArgumentNullException ("address"); - } - _address = new Address (address); - } - - public EndpointReferenceType (Address address) : base () - { - if(address == null) { - throw new ArgumentNullException ("address"); - } - _address = address; - } - - public EndpointReferenceType () : base () - { - } - - protected override void GetXmlAny (XmlDocument document, XmlElement element) - { - if(document == null) { - throw new ArgumentNullException ("document"); - } - if(element == null) { - throw new ArgumentNullException ("element"); - } - - element.AppendChild (_address.GetXml (document)); - - if(_portType != null) { - element.AppendChild (_portType.GetXml (document)); - } - - if(_properties != null) { - element.AppendChild (_properties.GetXml (document)); - } - - if(_serviceName != null) { - element.AppendChild (_serviceName.GetXml (document)); - } - - base.GetXmlAny (document, element); - } - - protected override void LoadXmlAny (XmlElement element) - { - if(element == null) { - throw new ArgumentNullException ("element"); - } - - foreach (XmlAttribute attrib in element.Attributes) { - AnyAttributes.Add (attrib); - } - - foreach (XmlElement node in element.ChildNodes) { - if(node.NamespaceURI != "http://schemas.xmlsoap.org/ws/2003/03/addressing") { - continue; - } - switch (node.LocalName) { - case "Address": - _address = new Address (node); - continue; - case "ReferenceProperties": - _properties = new ReferenceProperties (node); - continue; - case "PortType": - _portType = new PortType (node); - continue; - case "ServiceName": - _serviceName = new ServiceName (node); - continue; - } - - AnyElements.Add (node); - } - } - - public Address Address { - get { return _address; } - set { - if(value == null) { - throw new ArgumentNullException ("Address"); - } - _address = value; - } - } - - public PortType PortType { - get { return _portType; } - set { _portType = value; } - } - - public ReferenceProperties ReferenceProperties { - get { return _properties; } - set { _properties = value; } - } - - public ServiceName ServiceName { - get { return _serviceName; } - set { _serviceName = value; } - } - - } - -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/FaultTo.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/FaultTo.cs deleted file mode 100644 index 5e9a65e47b8..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/FaultTo.cs +++ /dev/null @@ -1,63 +0,0 @@ -// -// Microsoft.Web.Services.Addressing.FaultTo.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Xml; -using Microsoft.Web.Services.Xml; - -namespace Microsoft.Web.Services.Addressing -{ - public class FaultTo : EndpointReferenceType, IXmlElement - { - public FaultTo (Address address) : base (address) - { - } - - public FaultTo (Uri uri) : base (uri) - { - } - - public FaultTo (XmlElement element) : base () - { - LoadXml (element); - } - - public XmlElement GetXml (XmlDocument document) - { - XmlElement element = document.CreateElement ("wsa", - "FaultTo", - "http://schemas.xmlsoap.org/2003/03/addressing"); - - GetXmlAny (document, element); - return element; - } - - public void LoadXml (XmlElement element) - { - if(element == null) { - throw new ArgumentNullException ("element"); - } - if(element.LocalName != "FaultTo" || element.NamespaceURI != "http://schemas.xmlsoap.org/2003/03/addressing") { - throw new ArgumentException ("Invalid Element Supplied"); - } - LoadXmlAny (element); - } - - public static implicit operator FaultTo (Uri uri) - { - return new FaultTo (uri); - } - - public static implicit operator Uri (FaultTo obj) - { - if(obj == null) { - return null; - } - return obj.Address.Value; - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/From.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/From.cs deleted file mode 100644 index f7264af5a0b..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/From.cs +++ /dev/null @@ -1,64 +0,0 @@ -// -// Microsoft.Web.Services.Addressing.From.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Xml; -using Microsoft.Web.Services.Xml; - -namespace Microsoft.Web.Services.Addressing -{ - public class From : EndpointReferenceType, IXmlElement - { - public From (Address address) : base (address) - { - } - - public From (Uri uri) : base (uri) - { - } - - public From (XmlElement element) : base () - { - LoadXml (element); - } - - public XmlElement GetXml (XmlDocument document) - { - XmlElement element = document.CreateElement ("wsa", - "From", - "http://schemas.xmlsoap.org/2003/03/addressing"); - - GetXmlAny (document, element); - return element; - } - - public void LoadXml (XmlElement element) - { - if(element == null) { - throw new ArgumentNullException ("element"); - } - if(element.LocalName != "From" || element.LocalName != "http://schemas.xmlsoap.org/2003/03/addressing") { - throw new ArgumentException ("Invalid Element Supplied"); - } - - LoadXmlAny (element); - } - - public static implicit operator From (Uri uri) - { - return new From (uri); - } - - public static implicit operator Uri (From obj) - { - if(obj == null) { - return null; - } - return obj.Address.Value; - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/MessageID.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/MessageID.cs deleted file mode 100644 index 42abc1e656a..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/MessageID.cs +++ /dev/null @@ -1,56 +0,0 @@ -// -// Microsoft.Web.Services.Addressing.MessageID.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Xml; -using Microsoft.Web.Services.Xml; - -namespace Microsoft.Web.Services.Addressing -{ - public class MessageID : AttributedUri, IXmlElement - { - public MessageID (Uri uri) : base (uri) - { - } - - public MessageID (XmlElement element) : base () - { - LoadXml (element); - } - - public MessageID () : base ( new Uri ("uuid:" + Guid.NewGuid ())) - { - } - - public XmlElement GetXml (XmlDocument document) - { - if(document == null) { - throw new ArgumentNullException ("document"); - } - - XmlElement element = document.CreateElement ("wsa", - "MessageID", - "http://scemas.xmlsoap.org/2003/03/addressing"); - - GetXmlUri (document, element); - return element; - } - - public void LoadXml (XmlElement element) - { - if(element == null) { - throw new ArgumentNullException ("element"); - } - if(element.LocalName != "MessageID" || element.NamespaceURI != "http://schemas.xmlsoap.org/2003/03/addressing") { - throw new ArgumentException ("Invalid Element Supplied"); - } - - LoadXmlUri (element); - - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/PortType.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/PortType.cs deleted file mode 100644 index 34b9f9bcdc5..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/PortType.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// Microsoft.Web.Services.Addressing.PortType.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Xml; -using Microsoft.Web.Services.Xml; - -namespace Microsoft.Web.Services.Addressing -{ - - public class PortType : AttributedQName, IXmlElement - { - - public PortType (XmlElement element) : base () - { - LoadXml (element); - } - - public PortType (QualifiedName qname) : base (qname) - { - } - - public XmlElement GetXml (XmlDocument document) - { - if(document == null) { - throw new ArgumentNullException ("document"); - } - XmlElement element = document.CreateElement("wsa", - "PortType", - "http://schemas.xmlsoap.org/ws/2003/03/addressing"); - GetXmlQName (document, element); - - return element; - } - - public void LoadXml (XmlElement element) - { - if(element == null) { - throw new ArgumentNullException ("element"); - } - if(element.LocalName != "PortType" || element.NamespaceURI != "http://schemas.xmlsoap.org/ws/2003/03/addressing") { - throw new ArgumentException ("Invalid Element Supplied"); - } - LoadXmlQName (element); - } - - } - -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/Recipient.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/Recipient.cs deleted file mode 100644 index c3abd53a6cf..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/Recipient.cs +++ /dev/null @@ -1,64 +0,0 @@ -// -// Microsoft.Web.Services.Addressing.Recipient.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Xml; -using Microsoft.Web.Services.Xml; - -namespace Microsoft.Web.Services.Addressing -{ - public class Recipient : EndpointReferenceType, IXmlElement - { - public Recipient (Address address) : base (address) - { - } - - public Recipient (Uri uri) : base (uri) - { - } - - public Recipient (XmlElement element) : base () - { - LoadXml (element); - } - - public XmlElement GetXml (XmlDocument document) - { - XmlElement element = document.CreateElement ("wsa", - "Recipient", - "http://schemas.xmlsoap.org/2003/03/addressing"); - - GetXmlAny (document, element); - return element; - } - - public void LoadXml (XmlElement element) - { - if(element == null) { - throw new ArgumentNullException ("element"); - } - if(element.LocalName != "Recipient" || element.LocalName != "http://schemas.xmlsoap.org/2003/03/addressing") { - throw new ArgumentException ("Invalid Element Supplied"); - } - - LoadXmlAny (element); - } - - public static implicit operator Recipient (Uri uri) - { - return new Recipient (uri); - } - - public static implicit operator Uri (Recipient obj) - { - if(obj == null) { - return null; - } - return obj.Address.Value; - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ReferenceProperties.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ReferenceProperties.cs deleted file mode 100644 index 9a3ec1a6f0c..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ReferenceProperties.cs +++ /dev/null @@ -1,54 +0,0 @@ -// -// Microsoft.Web.Services.Addressing.ReferenceProperties.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Xml; -using Microsoft.Web.Services.Xml; - -namespace Microsoft.Web.Services.Addressing -{ - - public class ReferenceProperties : OpenElementElement, IXmlElement - { - public ReferenceProperties (XmlElement element) : base () - { - LoadXml (element); - } - - public ReferenceProperties () : base () - { - } - - public XmlElement GetXml (XmlDocument document) - { - if(document == null) { - throw new ArgumentNullException ("document"); - } - - XmlElement element = document.CreateElement ("wsa", - "ReferenceProperties", - "http://schemas.xmlsoap.org/ws/2003/03/addressing"); - - GetXmlAny (document, element); - return element; - } - - public void LoadXml (XmlElement element) - { - if(element == null) { - throw new ArgumentNullException ("element"); - } - - if(element.LocalName != "ReferenceProperties" || element.NamespaceURI != "http://schemas.xmlsoap.org/ws/2003/03/addressing") { - throw new ArgumentException ("Invalid Element Supplied"); - } - - LoadXmlAny (element); - } - } - -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/RelatesTo.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/RelatesTo.cs deleted file mode 100644 index 80fec335361..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/RelatesTo.cs +++ /dev/null @@ -1,101 +0,0 @@ -// -// Microsoft.Web.Services.Addressing.RelatesTo.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Xml; -using Microsoft.Web.Services.Xml; - -namespace Microsoft.Web.Services.Addressing -{ - public class RelatesTo : AttributedUri, IXmlElement - { - private QualifiedName _type; - - public RelatesTo (XmlElement element) : base () - { - _type = new QualifiedName ("wsa", - "Response", - "http://schemas.xmlsoap.org/ws/2003/03/addressing"); - LoadXml (element); - } - - public RelatesTo (Uri uri) : base (uri) - { - _type = new QualifiedName ("wsa", - "Response", - "http://schemas.xmlsoap.org/ws/2003/03/addressing"); - if(uri == null) { - throw new ArgumentNullException ("related"); - } - } - - public XmlElement GetXml (XmlDocument document) - { - if(document == null) { - throw new ArgumentNullException ("related"); - } - XmlElement element = document.CreateElement ("wsa", - "RelatesTo", - "http://schemas.xmlsoap.org/ws/2003/03/addressing"); - if(_type != null) { - XmlAttribute attrib = document.CreateAttribute ("RelationshipType"); - - attrib.Value = _type.Value; - - element.Attributes.Append (attrib); - - if(_type.Namespace != "http://schemas.xmlsoap.org/ws/2003/03/addressing") { - element.Attributes.Append (_type.GetNamespaceDecl (document)); - } - } - - GetXmlUri (document, element); - return element; - } - - public void LoadXml (XmlElement element) - { - if(element == null) { - throw new ArgumentNullException ("element"); - } - - if(element.LocalName != "RelatesTo" || element.NamespaceURI != "http://schemas.xmlsoap.org/ws/2003/03/addressing") { - throw new ArgumentException ("Invalid Element Supplied"); - } - - ValidateSchema (element); - - _type = new QualifiedName ("wsa", - "Response", - "http://schemas.xmlsoap.org/ws/2003/03/addressing"); - - foreach(XmlAttribute attrib in element.Attributes) { - if(attrib.LocalName == "RelationshipType") { - _type = QualifiedName.FromString (attrib.InnerText, element); - } else { - AnyAttributes.Add (attrib); - } - } - - Value = new Uri (element.InnerText); - - } - - public static implicit operator RelatesTo (Uri uri) - { - return new RelatesTo (uri); - } - - public static implicit operator Uri (RelatesTo obj) - { - if(obj == null) { - return null; - } - return obj.Value; - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ReplyTo.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ReplyTo.cs deleted file mode 100644 index 732250ad6fa..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ReplyTo.cs +++ /dev/null @@ -1,72 +0,0 @@ -// -// Microsoft.Web.Services.Addressing.ReplyTo -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Xml; -using Microsoft.Web.Services.Xml; - -namespace Microsoft.Web.Services.Addressing -{ - - public class ReplyTo : EndpointReferenceType, IXmlElement - { - - public ReplyTo (Address address) : base (address) - { - } - - public ReplyTo (Uri address) : base (address) - { - } - - public ReplyTo (XmlElement element) : base () - { - LoadXml (element); - } - - public XmlElement GetXml (XmlDocument document) - { - if(document == null) { - throw new ArgumentNullException ("document"); - } - - XmlElement element = document.CreateElement ("wsa", - "ReplyTo", - "http://schemas.xmlsoap.org/2003/03/addressing"); - GetXmlAny (document, element); - return element; - } - - public void LoadXml (XmlElement element) - { - if(element == null) { - throw new ArgumentNullException ("element"); - } - - if(element.LocalName != "ReplyTo" || element.NamespaceURI != "http://schemas.xmlsoap.org/2003/03/addressing") { - throw new ArgumentException ("Invalid Argument Supplied"); - } - - LoadXmlAny (element); - } - - public static implicit operator ReplyTo (Uri uri) - { - return new ReplyTo (uri); - } - - public static implicit operator Uri (ReplyTo obj) - { - if(obj == null) { - return null; - } - return obj.Address.Value; - } - - } - -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ServiceName.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ServiceName.cs deleted file mode 100644 index 70651ba9b21..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ServiceName.cs +++ /dev/null @@ -1,44 +0,0 @@ -// -// Microsoft.Web.Services.Addressing.ServiceName.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Xml; -using Microsoft.Web.Services.Xml; - -namespace Microsoft.Web.Services.Addressing -{ - public class ServiceName : AttributedQName, IXmlElement - { - private string _port; - - public ServiceName (XmlElement element) : base () - { - LoadXml (element); - } - - public ServiceName (QualifiedName qname) : base (qname) - { - } - - [MonoTODO] - public XmlElement GetXml (XmlDocument document) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public void LoadXml (XmlElement element) - { - throw new NotImplementedException (); - } - - public string PortName { - get { return _port; } - set { _port = value; } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/To.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/To.cs deleted file mode 100644 index dacae94ad08..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/To.cs +++ /dev/null @@ -1,73 +0,0 @@ -// -// Microsoft.Web.Services.Addressing.To -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Xml; -using Microsoft.Web.Services.Xml; - -namespace Microsoft.Web.Services.Addressing -{ - - public class To : AttributedUri, IXmlElement - { - - public To (AttributedUri uri) : base (uri) - { - } - - public To (Uri uri) : base (uri) - { - } - - public To (XmlElement element) : base () - { - LoadXml (element); - } - - public XmlElement GetXml (XmlDocument document) - { - if(document == null) { - throw new ArgumentNullException ("document"); - } - - XmlElement element = document.CreateElement ("wsa", - "To", - "http://schemas.xmlsoap.org/2003/03/addressing"); - - GetXmlUri (document, element); - return element; - } - - public void LoadXml (XmlElement element) - { - if(element == null) { - throw new ArgumentNullException ("element"); - } - - if(element.LocalName != "To" || element.NamespaceURI != "http://schemas.xmlsoap.org/2003/03/addressing") { - throw new ArgumentException ("Invalid Element Supplied"); - } - - LoadXmlUri (element); - } - - public static implicit operator To (Uri uri) - { - return new To (uri); - } - - public static implicit operator Uri (To obj) - { - if(obj == null) { - return null; - } - return obj.Value; - } - - } - -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Configuration/ChangeLog b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Configuration/ChangeLog deleted file mode 100644 index 5d790e638f6..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Configuration/ChangeLog +++ /dev/null @@ -1,27 +0,0 @@ -2003-10-26 Todd Berman - - * WebServicesConfiguration.cs: Allowing the MessagingConfiguration to - stay the same one (prevents double socket binding attempts) - -2003-10-22 Todd Berman - - * WebServicesConfiguration.cs: Added MessagingConfiguration - * FilterConfiguration.cs: #if'd out some stuff breaking wse2 - -2003-10-05 Sebastien Pouliot - - * FilterConfiguration.cs: Added Trace[In/Out]putFilters support. - * WebServicesConfiguration.cs: now reads - - -2003-09-06 Sebastien Pouliot - - * ConfigurationBase.cs: Completed implementation (both WSE1 and WSE2). - * FilterConfiguration.cs: Now returns the default input/output filters. - * WebServicesConfiguration.cs: Works for WSE1. Added WSE2 stubs. - -2003-09-05 Sebastien Pouliot - - * ConfigurationBase.cs: New. Limited implementation to fix compile. - * FilterConfiguration.cs: New. Stub to fix compile. - * WebServicesConfiguration.cs: New. Stub to fix compile. diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Configuration/ConfigurationBase.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Configuration/ConfigurationBase.cs deleted file mode 100644 index 942680122a1..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Configuration/ConfigurationBase.cs +++ /dev/null @@ -1,106 +0,0 @@ -// -// FilterConfiguration.cs: Filter Configuration -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Configuration; -using System.Xml; - -namespace Microsoft.Web.Services.Configuration { - - public class ConfigurationBase { - - public ConfigurationBase () {} - - protected static void CheckForChildNodes (XmlNode node) - { - if (node == null) - throw new ArgumentNullException ("node"); - if (node.HasChildNodes) - throw new ConfigurationException (Locale.GetText ("has child nodes")); - } - - protected static void CheckForDuplicateChildNodes (XmlNode node) - { - if (node == null) - throw new ArgumentNullException ("node"); - int n = node.ChildNodes.Count; - if (n > 1) { - // (n - 1) last is unimportant - for (int i=0; i < n - 1; i++) { - string xname = node.ChildNodes [i].Name; - // (i + 1) don't look back (again) - for (int j=i+1; j < n; i++) { - if (xname == node.ChildNodes [j].Name) - throw new ConfigurationException (Locale.GetText ("found duplicate nodes")); - } - } - } - } - - protected static void CheckForUnrecognizedAttributes (XmlNode node) - { - if (node == null) - throw new ArgumentNullException ("node"); - if (node.Attributes.Count > 0) - throw new ConfigurationException (Locale.GetText ("node has attributes")); - } - - protected static XmlNode GetAndRemoveAttribute (XmlNode node, string attrib, bool fRequired) - { - if (node == null) - throw new ArgumentNullException ("node"); - XmlNode xn = node.Attributes [attrib]; - if (xn != null) - node.Attributes.Remove (xn as XmlAttribute); - else if (fRequired) - throw new ConfigurationException (Locale.GetText ("missing required attribute")); - return xn; - } - - protected static XmlNode GetAndRemoveBoolAttribute (XmlNode node, string attrib, bool fRequired, ref bool val) - { - XmlNode xn = GetAndRemoveAttribute (node, attrib, fRequired); - if (xn != null) - val = Convert.ToBoolean (xn.Value); - return xn; - } -#if WSE2 - protected static XmlNode GetAndRemoveIntegerAttribute (XmlNode node, string attrib, bool fRequired, ref int val) - { - XmlNode xn = GetAndRemoveAttribute (node, attrib, fRequired); - if (xn != null) - val = Convert.ToInt32 (xn.Value); - return xn; - } -#endif - protected static XmlNode GetAndRemoveStringAttribute (XmlNode node, string attrib, bool fRequired, ref string val) - { - XmlNode xn = GetAndRemoveAttribute (node, attrib, fRequired); - if (xn != null) - val = xn.Value; - return xn; - } - - protected static void ThrowIfElement (XmlNode node) - { - if (node == null) - throw new ArgumentNullException ("node"); - if (node.NodeType == XmlNodeType.Element) - throw new ConfigurationException (Locale.GetText ("node is XmlNodeType.Element")); - } - - protected static void ThrowIfNotComment (XmlNode node) - { - if (node == null) - throw new ArgumentNullException ("node"); - if (node.NodeType != XmlNodeType.Comment) - throw new ConfigurationException (Locale.GetText ("node isn't XmlNodeType.Comment")); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Configuration/FilterConfiguration.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Configuration/FilterConfiguration.cs deleted file mode 100644 index 0f4020683a1..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Configuration/FilterConfiguration.cs +++ /dev/null @@ -1,67 +0,0 @@ -// -// FilterConfiguration.cs: Filter Configuration -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -using Microsoft.Web.Services; -using Microsoft.Web.Services.Configuration; -using Microsoft.Web.Services.Diagnostics; -using Microsoft.Web.Services.Security; -using Microsoft.Web.Services.Timestamp; -using Microsoft.Web.Services.Referral; -using Microsoft.Web.Services.Routing; - -namespace Microsoft.Web.Services.Configuration { - - public sealed class FilterConfiguration : ConfigurationBase { - - private SoapInputFilterCollection input; - private SoapOutputFilterCollection output; - - [MonoTODO("see in WSE documentation")] - internal FilterConfiguration () - { - input = new SoapInputFilterCollection (); - // trace availability depends on config (or manual setup) -#if WSE1 - if (WebServicesConfiguration.Config.Trace) { - input.Add (new TraceInputFilter ()); - } -#endif - // the following 4 filters always seems present (notwithstanding config) - input.Add (new SecurityInputFilter ()); - input.Add (new TimestampInputFilter ()); - input.Add (new ReferralInputFilter ()); - input.Add (new RoutingInputFilter ()); - // TODO: add custom input filters - - output = new SoapOutputFilterCollection (); - // trace availability depends on config (or manual setup) -#if WSE1 - if (WebServicesConfiguration.Config.Trace) { - output.Add (new TraceOutputFilter ()); - } -#endif - // the following 4 filters always seems present (notwithstanding config) - output.Add (new SecurityOutputFilter ()); - output.Add (new TimestampOutputFilter ()); - output.Add (new ReferralOutputFilter ()); - output.Add (new RoutingOutputFilter ()); - // TODO: add custom output filters - } - - public SoapInputFilterCollection InputFilters { - get { return input; } - } - - public SoapOutputFilterCollection OutputFilters { - get { return output; } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Configuration/WebServicesConfiguration.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Configuration/WebServicesConfiguration.cs deleted file mode 100644 index e42a7f5daa3..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Configuration/WebServicesConfiguration.cs +++ /dev/null @@ -1,106 +0,0 @@ -// -// WebServicesConfiguration.cs: Web Services Configuration -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Configuration; -using System.Xml; -#if WSE2 -using Microsoft.Web.Services.Messaging.Configuration; -#endif - -namespace Microsoft.Web.Services.Configuration { - - internal class WSEConfig { - bool diagnosticsTraceEnabled; - string diagnosticsTraceInputFilename; - string diagnosticsTraceOutputFilename; -#if WSE2 - private MessagingConfiguration _messagingConfiguration = new MessagingConfiguration (); -#endif - - public WSEConfig (XmlNode section) - { - XmlNode trace = section.SelectSingleNode ("/diagnostics/trace"); - if (trace != null) { - diagnosticsTraceEnabled = (trace.Attributes ["enabled"].InnerText == "true"); - diagnosticsTraceInputFilename = trace.Attributes ["input"].InnerText; - diagnosticsTraceOutputFilename = trace.Attributes ["output"].InnerText; - } - } - -#if WSE2 //Not sure why this keeps happenning, this code will workaround it though - public WSEConfig () - { - - } -#endif - - public bool Trace { - get { return diagnosticsTraceEnabled; } - } - - public string TraceInput { - get { return diagnosticsTraceInputFilename; } - } - - public string TraceOutput { - get { return diagnosticsTraceOutputFilename; } - } -#if WSE2 - public MessagingConfiguration MessagingConfiguration { - get { return _messagingConfiguration; } - } -#endif - } - - [MonoTODO("This whole class requires some serious attention")] - public sealed class WebServicesConfiguration : ConfigurationBase, IConfigurationSectionHandler { - - static WSEConfig config = (WSEConfig) ConfigurationSettings.GetConfig ("microsoft.web.services"); - - internal WebServicesConfiguration () {} - - internal static WSEConfig Config { - get { return config; } - } - - public static FilterConfiguration FilterConfiguration { - get { return new FilterConfiguration (); } - } -#if WSE2 - - static WebServicesConfiguration () - { - if(config == null) { - config = new WSEConfig (); - } - } - - public static MessagingConfiguration MessagingConfiguration { - get { - return config.MessagingConfiguration; - } - } - -/* Class not stubbed - [MonoTODO()] - public static TokenIssuerConfiguration TokenIssuerConfiguration { - get { return null; } - } -*/ -#endif - - // from IConfigurationSectionHandler - [MonoTODO()] - object IConfigurationSectionHandler.Create (object parent, object configContext, XmlNode section) - { - return new WSEConfig (section); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Diagnostics/ChangeLog b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Diagnostics/ChangeLog deleted file mode 100644 index d9f98d78976..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Diagnostics/ChangeLog +++ /dev/null @@ -1,5 +0,0 @@ -2003-10-05 Sebastien Pouliot - - * TraceFilter.cs: New. Generic trace logging (for input/output). - * TraceInputFilter.cs: New. Trace SOAP input to logfile. - * TraceOutputFilter.cs: New. Trace SOAP output to logfile. diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Diagnostics/TraceFilter.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Diagnostics/TraceFilter.cs deleted file mode 100644 index 88600604d71..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Diagnostics/TraceFilter.cs +++ /dev/null @@ -1,54 +0,0 @@ -// -// TraceFilter.cs: Internal generic (Input/Output) trace filter -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.IO; -using System.Reflection; -using System.Xml; - -namespace Microsoft.Web.Services.Diagnostics { - - internal class TraceFilter { - - public static string GetCompleteFilename (string filename) - { - return AppDomain.CurrentDomain.BaseDirectory + Path.DirectorySeparatorChar + filename; - } - - public static void WriteEnvelope (string filename, SoapEnvelope envelope) - { - if (envelope == null) - throw new ArgumentNullException ("envelope"); - - FileStream fs = null; - XmlDocument log = null; - try { - // load and lock xml document - if (!File.Exists (filename)) { - fs = File.Open (filename, FileMode.Create, FileAccess.Write, FileShare.Read); - log = new XmlDocument (); - log.LoadXml (String.Format ("{0}", Environment.NewLine)); - } - else { - fs = File.Open (filename, FileMode.Open, FileAccess.ReadWrite, FileShare.Read); - log = new XmlDocument (); - log.Load (fs); - } - // add new entry - XmlNode xn = log.ImportNode (envelope.DocumentElement, true); - log.DocumentElement.AppendChild (xn); - fs.Position = 0; - log.Save (fs); - } - finally { - fs.Close (); - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Diagnostics/TraceInputFilter.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Diagnostics/TraceInputFilter.cs deleted file mode 100644 index 23da73b4d7e..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Diagnostics/TraceInputFilter.cs +++ /dev/null @@ -1,37 +0,0 @@ -// -// TraceInputFilter.cs: Trace Input Filter -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.IO; -using System.Reflection; -using System.Xml; - -using Microsoft.Web.Services.Configuration; - -namespace Microsoft.Web.Services.Diagnostics { - - public class TraceInputFilter : SoapInputFilter { - - private const string tracename = "InputTrace.webinfo"; - private string file; - - public TraceInputFilter () - { - string filename = WebServicesConfiguration.Config.TraceInput; - if (filename == null) - filename = tracename; - file = TraceFilter.GetCompleteFilename (filename); - } - - public override void ProcessMessage (SoapEnvelope envelope) - { - TraceFilter.WriteEnvelope (file, envelope); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Diagnostics/TraceOutputFilter.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Diagnostics/TraceOutputFilter.cs deleted file mode 100644 index 696b3f50986..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Diagnostics/TraceOutputFilter.cs +++ /dev/null @@ -1,34 +0,0 @@ -// -// TraceOutputFilter.cs: Trace Output Filter -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -using Microsoft.Web.Services.Configuration; - -namespace Microsoft.Web.Services.Diagnostics { - - public class TraceOutputFilter : SoapOutputFilter { - - private const string tracename = "OutputTrace.webinfo"; - private string file; - - public TraceOutputFilter () - { - string filename = WebServicesConfiguration.Config.TraceOutput; - if (filename == null) - filename = tracename; - file = TraceFilter.GetCompleteFilename (filename); - } - - public override void ProcessMessage (SoapEnvelope envelope) - { - TraceFilter.WriteEnvelope (file, envelope); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/ChangeLog b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/ChangeLog deleted file mode 100644 index cfe39a2eb38..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/ChangeLog +++ /dev/null @@ -1,4 +0,0 @@ -2003-09-04 Sebastien Pouliot - - * DimeAttachmentCollection.cs: Fixed compilation issues - * DimeReader.cs: Fixed compilation issues diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeAttachment.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeAttachment.cs deleted file mode 100644 index 23a5b0196c1..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeAttachment.cs +++ /dev/null @@ -1,99 +0,0 @@ -// -// Microsoft.Web.Services.Dime.DimeAttachment.cs -// -// Name: Duncan Mak (duncan@ximian.com) -// -// Copyright (C) Ximian, Inc. 2003 -// - -using System; -using System.IO; - -namespace Microsoft.Web.Services.Dime { - - public class DimeAttachment - { - int chunk_size = Int32.MaxValue; // docs list this as default - string id; - string type; - Stream stream; - TypeFormatEnum type_format; - - public DimeAttachment () - { - id = String.Empty; - stream = null; - type = null; - type_format = TypeFormatEnum.Unchanged; - } - - public DimeAttachment (string type, TypeFormatEnum typeFormat, string path) - { - this.type = type; - this.type_format = typeFormat; - - if (File.Exists (path) == false) - throw new FileNotFoundException ( - Locale.GetText ("The path is not valid.")); - } - - public DimeAttachment (string type, TypeFormatEnum typeFormat, Stream stream) - { - this.type = type; - this.type_format = typeFormat; - this.stream = stream; - } - - public DimeAttachment (string id, string type, TypeFormatEnum typeFormat, string path) - : this (type, typeFormat, path) - { - this.id = id; - } - - public DimeAttachment (string id, string type, TypeFormatEnum typeFormat, Stream stream) - : this (type, typeFormat, stream) - { - this.id = id; - } - - public int ChunkSize { - - get { return chunk_size; } - - set { chunk_size = value; } - } - - public string Id { - - get { return id; } - - set { id = value; } - } - - public Stream Stream { - - get { return stream; } - - set { - if (value == null) - throw new ArgumentNullException ( - Locale.GetText ("Argument is null.")); - stream = value; - } - } - - public string Type { - - get { return type; } - - set { type = value; } - } - - public TypeFormatEnum TypeFormat { - - get { return type_format; } - - set { type_format = value; } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeAttachmentCollection.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeAttachmentCollection.cs deleted file mode 100644 index 7535a2c25c2..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeAttachmentCollection.cs +++ /dev/null @@ -1,91 +0,0 @@ -// -// Microsoft.Web.Services.Dime.DimeAttachmentCollection.cs -// -// Name: Daniel Kornhauser -// -// Copyright (C) Ximian, Inc. 2003 -// - -using Microsoft.Web.Services; -using System; -using System.Collections; -using System.Globalization; - -namespace Microsoft.Web.Services.Dime { - - - public class DimeAttachmentCollection : CollectionBase - { - - DimeReader reader; - - public DimeAttachmentCollection () - { - } - - public DimeAttachmentCollection (DimeReader reader) - { - if (reader == null) - throw new ArgumentNullException ( - Locale.GetText ("Argument is null.")); - - - if (reader.CanRead == false) - throw new ArgumentException ( - Locale.GetText ("The reader is not readable")); - - this.reader = reader; - } - - public DimeAttachment this [int key] { - get { - return (DimeAttachment) InnerList [key]; - } - } - - public DimeAttachment this [string key] { - get { - // FIXME: must iterate in collection - return null; - } - } - - public void Add (DimeAttachment attachment) - { - InnerList.Add (attachment); - } - - public void AddRange (ICollection collection) - { - foreach (object o in collection) - InnerList.Add (o); - } - - public bool Contains (string id) - { - return InnerList.Contains (id); - } - - public void CopyTo (DimeAttachment[] attachments, int index) - { - InnerList.CopyTo (attachments, index); - } - - public int IndexOf (DimeAttachment attachment) - { - return InnerList.IndexOf(attachment); - } - - public int IndexOf (string id) - { - return InnerList.IndexOf(id); - } - - public void Remove (DimeAttachment attachment) - { - InnerList.Remove (attachment); - } - } -} - - diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeFormatException.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeFormatException.cs deleted file mode 100644 index 2aed4b7e21c..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeFormatException.cs +++ /dev/null @@ -1,29 +0,0 @@ -// -// Microsoft.Web.Services.DimeFormatException.cs -// -// Author: Daniel Kornhauser dkor@alum.mit.edu -// -// (C) Copyright, Ximian, Inc. -// - -using System; -using System.Web.Services.Protocols; -using System.Xml; - -namespace Microsoft.Web.Services.Dime { - - [Serializable] - public class DimeFormatException: SoapHeaderException - { - public DimeFormatException (string message) - : base (String.Empty, XmlQualifiedName.Empty) - { - } - - public DimeFormatException (string message, Exception ex) - : base (message, XmlQualifiedName.Empty, ex) - { - } - } -} - diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeReader.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeReader.cs deleted file mode 100644 index 9e39d7406a3..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeReader.cs +++ /dev/null @@ -1,59 +0,0 @@ -// -// Microsoft.Web.Services.Dime.DimeReader.cs -// -// Name: Duncan Mak (duncan@ximian.com) -// -// Copyright (C) Ximian, Inc. 2003 -// - -using System; -using System.IO; - -namespace Microsoft.Web.Services.Dime { - - public class DimeReader - { - - Stream stream; - bool opened; - - public DimeReader (Stream stream) - { - if (stream == null) - throw new ArgumentNullException ( - Locale.GetText ("Argument is null.")); - - if (stream.CanRead == false) - throw new ArgumentException ( - Locale.GetText ("The stream is not readable")); - - this.stream = stream; - opened = true; - } - - public void Close () - { - if (opened == false) - throw new InvalidOperationException ( - Locale.GetText ("The stream is currently open.")); - - stream.Close (); - opened = false; - } - - public bool CanRead { - get { return stream.CanRead; } - } - - [MonoTODO] - public DimeRecord ReadRecord () - { - if (opened == false) - throw new InvalidOperationException ( - Locale.GetText ("The stream is currently closed.")); - opened = true; - - throw new NotImplementedException (); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeRecord.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeRecord.cs deleted file mode 100644 index 8a15c1132d4..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeRecord.cs +++ /dev/null @@ -1,18 +0,0 @@ -// -// Microsoft.Web.Services.Dime.DimeRecord.cs -// -// Name: Duncan Mak (duncan@ximian.com) -// -// Copyright (C) Ximian, Inc. 2003 -// - -using System; -using System.IO; - -namespace Microsoft.Web.Services.Dime { - - [MonoTODO] - public class DimeRecord - { - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/TypeFormatEnum.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/TypeFormatEnum.cs deleted file mode 100644 index 3cca2e1aa4b..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/TypeFormatEnum.cs +++ /dev/null @@ -1,20 +0,0 @@ -// -// Microsfot.Web.Services.TypeFormatEnum.cs -// -// Author: Daniel Kornhauser -// -// (C) Copyright, Ximian, Inc. -// - - -namespace Microsoft.Web.Services.Dime { - - public enum TypeFormatEnum - { - Unchanged = 0, - MediaType = 16, - AbsoluteUri = 32, - Unknown = 48, - None = 64 - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/ChangeLog b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/ChangeLog deleted file mode 100644 index 836adf9bcb4..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/ChangeLog +++ /dev/null @@ -1,26 +0,0 @@ -2004-01-26 Todd Berman - - * SoapTcpChannel.cs: fix from Sami Vaaraniemi - -2003-10-25 Todd Berman - - * SoapTcpChannel.cs: fixes for csc - * SoapTcpListener.cs: fix for csc - * SoapTcpTransport.cs: fix for csc - -2003-10-22 Todd Berman - - * SoapPort.cs: Implemented. - * MessagingConfiguration.cs: Inital implementation, missing Load () - * SoapTransport.cs: Implemented. - * SoapChannelCollection.cs: Implemented. - * SoapChannel.cs: Implemented. - * SoapPlainFormatter.cs: Implemented. - * SoapTcpChannel.cs: Implemented. - * SoapTcpListener.cs: Implemented. - * SoapTcpTransport.cs: Implemented. - * SoapReceiver.cs: Initial implementation. - * SoapReceivers.cs: Initial implementation. - * SoapSender.cs: Initial implementation. - * SoapDimeFormatter.cs: basic stubs. - * ChangeLog: Added. diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/ISoapFormatter.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/ISoapFormatter.cs deleted file mode 100644 index c07ee3c2999..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/ISoapFormatter.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Microsoft.Web.Services.Messaging.ISoapFormmatter.cs -// -// Author: Duncan Mak -// -// (C) Ximian, Inc. 2003. - -using System.IO; -using Microsoft.Web.Services; - -namespace Microsoft.Web.Services.Messaging { - public interface ISoapFormatter { - - SoapEnvelope Deserialize (Stream stream); - - void Serialize (SoapEnvelope envelope, Stream stream); - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/ISoapTransport.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/ISoapTransport.cs deleted file mode 100644 index bd15fae6116..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/ISoapTransport.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -// Microsoft.Web.Services.Messaging.ISoapTransport.cs -// -// Author: Daniel Kornhauser -// -// (C) Ximian, Inc. 2003. -// - -using System; -using System.IO; -using System.Net; -using Microsoft.Web.Services; - -namespace Microsoft.Web.Services.Messaging { - - public interface ISoapTransport { - - ICredentials Credentials { get; set; } - - int IdleTimeout { get; set; } - - //string Scheme { get; } - - IAsyncResult BeginSend ( - SoapEnvelope envelope, - Uri destination, - AsyncCallback callback, - object state); - - void EndSend (IAsyncResult result); - - void RegisterPort (Uri to, Type port); - - void RegisterPort (Uri to, SoapReceiver receiver); - - void Send (SoapEnvelope envelop, Uri destination); - - void UnregisterAll (); - - void UnregisterPort (Uri to); - - } -} - - - - - - - diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/MessagingConfiguration.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/MessagingConfiguration.cs deleted file mode 100644 index 1f679a6cc70..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/MessagingConfiguration.cs +++ /dev/null @@ -1,70 +0,0 @@ -// -// Microsoft.Web.Services.Messaging.Configuration.MessagingConfiguration.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Xml; -using System.Collections; -using Microsoft.Web.Services.Messaging; -using Microsoft.Web.Services.Configuration; - -namespace Microsoft.Web.Services.Messaging.Configuration -{ - public class MessagingConfiguration : ConfigurationBase - { - - private static Hashtable _transports; - - static MessagingConfiguration () - { - _transports = new Hashtable (); - } - - public MessagingConfiguration () : base () - { - //Add transports here - AddTransport ("soap.tcp", new SoapTcpTransport ()); - } - - public void AddTransport (string scheme, ISoapTransport trans) - { - if(scheme == null || scheme.Length == 0) { - throw new ArgumentNullException ("scheme"); - } - if(trans == null) { - throw new ArgumentNullException ("transport"); - } - _transports[scheme] = trans; - } - - public ISoapTransport GetTransport (string scheme) - { - if(scheme == null || scheme.Length == 0) { - throw new ArgumentNullException ("scheme"); - } - return (ISoapTransport)_transports[scheme]; - } - - public void RemoveTransport (string scheme) - { - if(scheme == null || scheme.Length == 0) { - throw new ArgumentNullException ("scheme"); - } - _transports.Remove (scheme); - } - - [MonoTODO] - public void Load (XmlNode node) - { - throw new NotImplementedException (); - } - - public ICollection Transports { - get { return _transports.Values; } - } - - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapChannel.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapChannel.cs deleted file mode 100644 index 83ae17e6cf8..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapChannel.cs +++ /dev/null @@ -1,155 +0,0 @@ -// -// Microsoft.Web.Services.Messaging.SoapChannel.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.IO; -using Microsoft.Web.Services; - -namespace Microsoft.Web.Services.Messaging -{ - public abstract class SoapChannel - { - - private ISoapFormatter _formatter; - private object _sync_obj = new object (); - - public SoapChannel (ISoapFormatter format) - { - if(format == null) { - throw new ArgumentNullException ("formatter"); - } - _formatter = format; - } - - public abstract void Close (); - - public SoapEnvelope DeserializeMessage (Stream stream) - { - return _formatter.Deserialize (stream); - } - - public void SerializeMessage (SoapEnvelope envelope, Stream stream) - { - _formatter.Serialize (envelope, stream); - } - - public abstract SoapEnvelope Receive (); - public abstract void Send (SoapEnvelope envelope); - - public abstract bool Active { - get; - } - - public abstract string Scheme { - get; - } - - public object SyncRoot { - get { return _sync_obj; } - } - - public IAsyncResult BeginReceive (AsyncCallback callback, object state) - { - return new ReceiveAsyncResult (this, callback, state); - } - - public SoapEnvelope EndReceive (IAsyncResult result) - { - if(result == null) { - throw new ArgumentNullException ("result"); - } - - ReceiveAsyncResult res = result as ReceiveAsyncResult; - - if(res != null) { - ReceiveAsyncResult.End (result); - return res.Envelope; - } - - throw new InvalidOperationException ("Invalid IAsyncResult type"); - } - - public IAsyncResult BeginSend (SoapEnvelope env, AsyncCallback callback, object state) - { - if(env == null) { - throw new ArgumentNullException ("envelope"); - } - return new SendAsyncResult (this, env, callback, state); - } - - public void EndSend (IAsyncResult result) - { - if(result == null) { - throw new ArgumentNullException ("result"); - } - SendAsyncResult a_res = result as SendAsyncResult; - - if(a_res != null) { - AsyncResult.End (result); - } - throw new InvalidOperationException ("Invalid IAsyncResult type"); - } - - protected class ReceiveAsyncResult : AsyncResult - { - private SoapEnvelope _envelope; - - private delegate SoapEnvelope Receive (); - - public ReceiveAsyncResult (SoapChannel channel, - AsyncCallback callback, - object state) : base (callback, state) - { - Receive rec = new Receive (channel.Receive); - - rec.BeginInvoke (new AsyncCallback (OnReceiveComplete), rec); - } - - private void OnReceiveComplete (IAsyncResult result) - { - Receive rec = (Receive) result.AsyncState; - - try { - _envelope = rec.EndInvoke (result); - Complete (result.CompletedSynchronously); - } catch (Exception e) { - Complete (result.CompletedSynchronously, e); - } - } - - public SoapEnvelope Envelope { - get { return _envelope; } - } - } - - protected class SendAsyncResult : AsyncResult - { - private delegate void Send (SoapEnvelope e); - - public SendAsyncResult (SoapChannel channel, - SoapEnvelope env, - AsyncCallback callback, - object state) : base (callback, state) - { - Send send_delegate = new Send (channel.Send); - send_delegate.BeginInvoke (env, new AsyncCallback (OnSendComplete), send_delegate); - } - - private void OnSendComplete (IAsyncResult result) - { - Send s_del = result.AsyncState as Send; - - try { - s_del.EndInvoke (result); - this.Complete (result.CompletedSynchronously); - } catch (Exception e) { - Complete (result.CompletedSynchronously, e); - } - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapChannelCollection.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapChannelCollection.cs deleted file mode 100644 index c05f454fdf6..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapChannelCollection.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -// Microsoft.Web.Services.Messaging.SoapChannelCollection.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Collections; - -namespace Microsoft.Web.Services.Messaging -{ - public class SoapChannelCollection - { - - private Hashtable _channels = new Hashtable (); - - public void Add (string to, SoapChannel channel) - { - if(to == null || to.Length == 0) { - throw new ArgumentNullException ("to"); - } - if(channel == null) { - throw new ArgumentNullException ("channel"); - } - - _channels[to] = channel; - } - - public void Clear () - { - _channels.Clear (); - } - - public bool Contains (string to) - { - if(to == null || to.Length == 0) { - throw new ArgumentNullException ("to"); - } - return _channels.Contains (to); - } - - public IEnumerator GetEnumerator () - { - return _channels.Values.GetEnumerator (); - } - - public void Remove (string to) - { - if(to == null || to.Length == 0) { - throw new ArgumentNullException ("to"); - } - _channels.Remove (to); - } - - public int Count { - get { return _channels.Values.Count; } - } - - public SoapChannel this [string index] { - get { return (SoapChannel) _channels[index]; } - } - - public ICollection Keys { - get { return _channels.Keys; } - } - - public object SyncRoot { - get { return _channels.SyncRoot; } - } - - public ICollection Values { - get { return _channels.Values; } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapDimeFormatter.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapDimeFormatter.cs deleted file mode 100644 index 0ee0d9a98b3..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapDimeFormatter.cs +++ /dev/null @@ -1,29 +0,0 @@ -// -// Microsoft.Web.Services.Messaging.SoapDimeFormatter.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.IO; -using Microsoft.Web.Services; - -namespace Microsoft.Web.Services.Messaging -{ - public class SoapDimeFormatter : ISoapFormatter - { - - [MonoTODO] - public SoapEnvelope Deserialize (Stream stream) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public void Serialize (SoapEnvelope envelope, Stream stream) - { - throw new NotImplementedException (); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapPlainFormatter.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapPlainFormatter.cs deleted file mode 100644 index b56b022a085..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapPlainFormatter.cs +++ /dev/null @@ -1,59 +0,0 @@ -// -// Microsoft.Web.Services.Messaging.SoapPlainFormatter.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.IO; - -//FIXME: Can be removed when workaround is removed. -using System.Text; -using System.Net.Sockets; - -using Microsoft.Web.Services; - -namespace Microsoft.Web.Services.Messaging -{ - public class SoapPlainFormatter : ISoapFormatter - { - public SoapEnvelope Deserialize (Stream stream) - { - if(stream == null) { - throw new ArgumentNullException ("stream"); - } - SoapEnvelope env = new SoapEnvelope (); - //env.Load (stream); - - - //FIXME: Workaround for XmlDocument.Load's love of stream closing - byte[] buf = new byte[1024]; - String msg = ""; - int numRead = 0; - - do { - numRead = stream.Read(buf, 0, buf.Length); - msg = String.Concat (msg, Encoding.ASCII.GetString (buf, 0, numRead)); - } while(((NetworkStream)stream).DataAvailable); - - env.LoadXml (msg); - - return env; - } - - [MonoTODO("Should error if envelope has DimeAttachments")] - public void Serialize (SoapEnvelope env, Stream stream) - { - if(stream == null) { - throw new ArgumentNullException ("stream"); - } - if(env == null) { - throw new ArgumentNullException ("envelope"); - } - - env.Save (stream); - stream.Flush(); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapPort.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapPort.cs deleted file mode 100644 index d3f7137d82b..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapPort.cs +++ /dev/null @@ -1,34 +0,0 @@ -// -// Microsoft.Web.Services.Messaging.SoapPort.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using Microsoft.Web.Services; - -namespace Microsoft.Web.Services.Messaging -{ - - public abstract class SoapPort - { - private Pipeline _pipeline; - - public SoapPort () : base () - { - _pipeline = null; - } - - protected abstract void FilterMessage (SoapEnvelope env); - - public Pipeline Pipeline { - get { - if(_pipeline == null) { - _pipeline = new Pipeline (); - } - return _pipeline; - } - set { _pipeline = value; } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapReceiver.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapReceiver.cs deleted file mode 100644 index 6a45024ce22..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapReceiver.cs +++ /dev/null @@ -1,152 +0,0 @@ -// -// Microsoft.Web.Services.Messaging.SoapReceiver.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Web; -using Microsoft.Web.Services; -using Microsoft.Web.Services.Addressing; -using Microsoft.Web.Services.Configuration; - -namespace Microsoft.Web.Services.Messaging { - - public abstract class SoapReceiver : SoapPort, IHttpHandler - { - - private static Pipeline _defPipe = new Pipeline (); - - protected abstract void Receive (SoapEnvelope envelope); - - public SoapReceiver () : base () - { - } - - protected void Receive (SoapEnvelope envelope, Exception e) - { - } - - public static void DispatchMessage (SoapEnvelope env) - { - DispatchMessage (env, null); - } - - public static void DispatchMessage (SoapEnvelope env, RelatesTo relation) - { - if(env == null) { - throw new ArgumentNullException ("envelope"); - } - SoapReceiver rec = null; - AddressingHeaders header = null; - - try { - - header = env.Context.Addressing; - - header.Load (env); - - if(header.RelatesTo != null || header.To != null || relation != null) - { - object to = null; - if(header.RelatesTo != null) { - if(WebServicesConfiguration.MessagingConfiguration.GetTransport (header.RelatesTo.Value.Scheme) == null) { - //FIXME: Incorrect exception here, should be using something in Routing. - throw new ArgumentException ("Transport " + header.RelatesTo.Value.Scheme + " is not supported"); - } - to = SoapReceivers.Receiver (header.RelatesTo.Value); - env.Context.SetActor (header.RelatesTo); - } - if(to == null && header.To != null) { - if(env.Context.Channel.Scheme != header.To.Value.Scheme) { - //FIXME: Incorrect exception again. - throw new ArgumentException ("Channel's Scheme and To's Scheme are not the same."); - } - to = SoapReceivers.Receiver (header.To.Value); - env.Context.SetActor (header.RelatesTo); - } - if(to == null && relation != null) { - to = SoapReceivers.Receiver (relation.Value); - env.Context.Addressing.RelatesTo = relation; - env.Context.SetActor (relation); - } - if(to != null) { - rec = to as SoapReceiver; - if(rec == null) { - rec = (SoapReceiver) Activator.CreateInstance (to as Type); - } - if(rec != null) { - Exception excep = null; - try { - env.Context.SetIsInbound (true); - rec.FilterMessage (env); - } catch (Exception e) { - excep = e; - } - if(excep != null) { - //FIXME: again, wrong exception type, should be throwing something XmlElement like - rec.Receive (env, excep); - } else { - rec.Receive (env); - } - } else { - //FIXME: same thing - throw new InvalidOperationException ("no receiver found"); - } - } else { - //FIXME: same - throw new InvalidOperationException ("no receiver found pt 2"); - } - } - } catch (Exception e) { - if(rec == null) { - DispatchMessageFault (env, e); - } else { - DispatchMessageFault (env, e, rec.Pipeline); - } - } - } - - public static void DispatchMessageFault (SoapEnvelope env, Exception e) - { - DispatchMessageFault (env, e, _defPipe); - } - - public static void DispatchMessageFault (SoapEnvelope env, Exception e, Pipeline pipe) - { - } - - public bool IsReusable { - get { - return true; - } - } - - protected override void FilterMessage (SoapEnvelope env) - { - if(env == null) { - throw new ArgumentNullException ("envelope"); - } - Pipeline.ProcessInputMessage (env); - } - - public void ProcessSoapRequest (HttpContext context) - { - - } - - public void ProcessNonSoapRequest (HttpContext context) - { - - } - - public void ProcessRequest (HttpContext context) - { - if(context.Request.HttpMethod == "POST" || context.Request.Headers["SOAPAction"] != null) { - ProcessSoapRequest (context); - } - ProcessNonSoapRequest (context); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapReceivers.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapReceivers.cs deleted file mode 100644 index 6853f17918e..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapReceivers.cs +++ /dev/null @@ -1,144 +0,0 @@ -// -// Microsoft.Web.Services.Messaging.SoapReceivers -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Collections; -using Microsoft.Web.Services.Configuration; - -namespace Microsoft.Web.Services.Messaging -{ - - public class SoapReceivers - { - - private static Hashtable _receivers = new Hashtable (); - - private SoapReceivers () { } - - public static void Add (Uri uri, SoapReceiver receiver) - { - Add (uri, receiver, false); - } - - public static void Add (Uri uri, Type type) - { - Add (uri, type, false); - } - - public static void Add (Uri uri, SoapReceiver receiver, bool passive) - { - if(uri == null) { - throw new ArgumentNullException ("uri"); - } - if(receiver == null) { - throw new ArgumentNullException ("receiver"); - } - - lock(SyncRoot) { - if(_receivers.Contains (uri)) { - throw new ArgumentException ("An item with this key already exists"); - } - - if(passive == false) { - ISoapTransport trans = WebServicesConfiguration.MessagingConfiguration.GetTransport (uri.Scheme); - - if(trans != null) { - trans.RegisterPort (uri, receiver); - } else { - throw new NotSupportedException ("Transport " + uri.Scheme + " not supported."); - } - } - - _receivers.Add (uri, receiver); - } - } - - public static void Add (Uri uri, Type type, bool passive) - { - if(uri == null) { - throw new ArgumentNullException ("uri"); - } - if(type == null) { - throw new ArgumentNullException ("type"); - } - lock(SyncRoot) { - if(_receivers.Contains (uri)) { - throw new ArgumentException ("An item with this key already exists"); - } - - if(passive == false) { - ISoapTransport trans = WebServicesConfiguration.MessagingConfiguration.GetTransport (uri.Scheme); - - if(trans != null) { - trans.RegisterPort (uri, type); - } else { - throw new NotSupportedException ("Transport " + uri.Scheme + " is not supported"); - } - } - - _receivers.Add (uri, type); - } - } - - public static void Clear () - { - lock(SyncRoot) { - foreach(ISoapTransport trans in WebServicesConfiguration.MessagingConfiguration.Transports) { - trans.UnregisterAll (); - } - _receivers.Clear (); - } - } - - public static bool Contains (Uri to) - { - if(to == null) { - throw new ArgumentNullException ("to"); - } - bool retVal = false; - lock(SyncRoot) { - retVal = _receivers.Contains (to); - } - return retVal; - } - - public static IDictionaryEnumerator GetEnumerator () - { - return _receivers.GetEnumerator (); - } - - public static object Receiver (Uri to) - { - return _receivers[to]; - } - - public static void Remove (Uri to) - { - if(to == null) { - throw new ArgumentNullException ("to"); - } - - lock(SyncRoot) { - if(_receivers.Contains (to) == false) { - ISoapTransport trans = WebServicesConfiguration.MessagingConfiguration.GetTransport (to.Scheme); - if(trans != null) { - trans.UnregisterPort (to); - _receivers.Remove (to); - } - } - } - } - - public static int Count { - get { return _receivers.Values.Count; } - } - - public static object SyncRoot { - get { return _receivers.SyncRoot; } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapSender.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapSender.cs deleted file mode 100644 index 485c0210510..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapSender.cs +++ /dev/null @@ -1,103 +0,0 @@ -// -// Microsoft.Web.Services.Messaging.SoapSender -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Web; -using Microsoft.Web.Services; -using Microsoft.Web.Services.Addressing; -using Microsoft.Web.Services.Configuration; - -namespace Microsoft.Web.Services.Messaging { - - public class SoapSender : SoapPort - { - - private EndpointReference _destination = null; - private ISoapTransport _transport = null; - - public SoapSender () : base () - { - } - - public SoapSender (EndpointReference dest) : base () - { - if(dest == null) { - throw new ArgumentNullException ("destination"); - } - Destination = dest; - } - - public SoapSender (Uri destination) : this (new EndpointReference (destination)) - { - } - - protected override void FilterMessage (SoapEnvelope env) - { - if(env == null) { - throw new ArgumentNullException ("envelope"); - } - Pipeline.ProcessOutputMessage (env); - } - - public void Send (SoapEnvelope env) - { - if(env == null) { - throw new ArgumentNullException ("envelope"); - } - if(env.Context.Action == null) { - throw new ArgumentException ("Action not set"); - } - if(env.Processed == true || env.Context.Processed == true) { - throw new ArgumentException ("Attempting to re-process an envelope"); - } - - if(_destination == null) { - throw new ArgumentException ("Destination is not set, cant send"); - } - if(_transport == null) { - throw new ArgumentException ("Transport is not set, cant send"); - } - - env.Context.SetTo(_destination.Address); - - FilterMessage (env); - - _transport.Send (env, _destination); - } - - [MonoTODO] - public IAsyncResult BeginSend (SoapEnvelope env, AsyncCallback callback, object state) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public void EndSend (IAsyncResult result) - { - throw new NotImplementedException (); - } - - public ISoapTransport Transport { - get { return _transport; } - } - - public EndpointReference Destination { - get { return _destination; } - set { - if(value == null || value.Address == null || value.Address.Value == null) { - throw new ArgumentNullException ("destination"); - } - ISoapTransport trans = WebServicesConfiguration.MessagingConfiguration.GetTransport (value.Address.Value.Scheme); - if(trans == null) { - throw new ArgumentException ("Transport " + value.Address.Value.Scheme + " is not supported"); - } - _destination = value; - _transport = trans; - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapTcpChannel.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapTcpChannel.cs deleted file mode 100644 index a6fb29d87c5..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapTcpChannel.cs +++ /dev/null @@ -1,188 +0,0 @@ -// -// Microsoft.Web.Services.Messaging.SoapTcpChannel.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Net; -using System.Net.Sockets; - -namespace Microsoft.Web.Services.Messaging -{ - - public class SoapTcpChannel : SoapChannel - { - - private bool _active = false; - private bool _disposed = false; - private AddressFamily _addrFam = AddressFamily.InterNetwork; - private DateTime _lastActivity = DateTime.Now; - private int _port = 0; - private Socket _socket = null; - private NetworkStream _stream = null; - private Uri _destination = null; - private string _hostname = null; - - public SoapTcpChannel (Socket sock, ISoapFormatter format) : base (format) - { - _socket = sock; - _stream = new NetworkStream (sock, false); - _active = true; - - IPEndPoint ep = sock.RemoteEndPoint as IPEndPoint; - - _destination = new Uri ("soap.tcp://" + ep.Address.ToString () + ":" + ep.Port); - } - - public SoapTcpChannel (Uri uri, ISoapFormatter format) : base (format) - { - if(uri == null) { - throw new ArgumentNullException ("to"); - } - if(uri.Scheme != "soap.tcp") { - throw new ArgumentException ("Invalid Scheme"); - } - _hostname = uri.Host; - _port = uri.Port < 0 ? 8081 : uri.Port; - } - - public override void Close () - { - lock(SyncRoot) { - try { - _active = false; - if(_socket != null || !_socket.Connected) { - _socket.Close (); - } - } catch { - _socket = null; - } - } - } - - public void Connect () - { - if(_disposed) { - throw new ObjectDisposedException (GetType ().FullName); - } - if(_active) { - return; - } - lock(SyncRoot) { - if(_active) { - return; - } - IPHostEntry host = Dns.Resolve (_hostname); - - IPAddress[] ip_addrs = host.AddressList; - - Exception exception = null; - - for (int i = 0; i < ip_addrs.Length; i++) { - IPAddress addy = ip_addrs[i]; - - _addrFam = addy.AddressFamily; - _socket = new Socket (_addrFam, SocketType.Stream, ProtocolType.Tcp); - _active = false; - - try { - Connect ( new IPEndPoint (addy, _port) ); - break; - } catch (Exception e) { - _socket.Close (); - _socket = null; - exception = e; - } - } - - if(_active == false) { - if(exception != null) { - throw exception; - } - - throw new Exception ("Not Connected"); - } - _stream = new NetworkStream (_socket, false); - } - } - - public void Connect (IPEndPoint endpoint) - { - if(_disposed) { - throw new ObjectDisposedException (GetType ().FullName); - } - if(endpoint == null) { - throw new ArgumentNullException ("endpoint"); - } - - _socket.Connect (endpoint); - _active = true; - UpdateLastActivity (); - } - - - ~SoapTcpChannel () - { - if(_active == false) { - Close (); - _disposed = true; - } - } - - - public override SoapEnvelope Receive () - { - if(!_active) { - Connect (); - } - - SoapEnvelope env = DeserializeMessage (_stream); - - if(env != null) { - env.Context.Channel = this; - } - - UpdateLastActivity (); - - return env; - } - - public override void Send (SoapEnvelope env) - { - lock(SyncRoot) { - if(!_active) { - Connect (); - } - SerializeMessage (env, _stream); - UpdateLastActivity (); - } - } - - public void UpdateLastActivity () - { - lock (SyncRoot) { - _lastActivity = DateTime.Now; - } - } - - public override bool Active { - get { return _active; } - } - - public Uri Destination { - get { return _destination; } - } - - public DateTime LastActivity { - get { return _lastActivity; } - } - - public override string Scheme { - get { return "soap.tcp"; } - } - - } - -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapTcpListener.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapTcpListener.cs deleted file mode 100644 index 1dff617edbc..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapTcpListener.cs +++ /dev/null @@ -1,71 +0,0 @@ -// -// Microsoft.Web.Services.Messaging.SoapTcpListener.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Net; -using System.Net.Sockets; - -namespace Microsoft.Web.Services.Messaging -{ - public class SoapTcpListener : TcpListener - { - - private int _refs = 0; - - private delegate Socket AcceptSock (); - - private AcceptSock _acceptSocket; - - public SoapTcpListener (IPEndPoint endpoint) : base (endpoint) - { - if(Server == null) { - Server.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ExclusiveAddressUse, true); - } - } - - public SoapTcpListener (IPAddress address, int port) : base (address, port) - { - if(Server == null) { - Server.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ExclusiveAddressUse, true); - } - } - - public SoapTcpListener (int port) : base (port) - { - if(Server == null) { - Server.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ExclusiveAddressUse, true); - } - } - - public void AddReference () - { - _refs++; - } - - public int ReleaseReference () - { - return --_refs; - } - - public IAsyncResult BeginAcceptSocket (AsyncCallback callback, object state) - { - if(_acceptSocket == null) { - _acceptSocket = new AcceptSock (base.AcceptSocket); - } - return _acceptSocket.BeginInvoke (callback, state); - } - - public Socket EndAcceptSocket (IAsyncResult result) - { - return _acceptSocket.EndInvoke (result); - } - - public bool IsListening { - get { return Active; } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapTcpTransport.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapTcpTransport.cs deleted file mode 100644 index 54341135902..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapTcpTransport.cs +++ /dev/null @@ -1,229 +0,0 @@ -// -// Microsoft.Web.Services.Messaging.SoapTcpTransport.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Net; -using System.Net.Sockets; -using System.Collections; -using Microsoft.Web.Services; -using Microsoft.Web.Services.Addressing; - -namespace Microsoft.Web.Services.Messaging -{ - public class SoapTcpTransport : SoapTransport, ISoapTransport - { - - public static string Scheme = "soap.tcp"; - - private Hashtable _listeners = new Hashtable (); - private Hashtable _receivers = new Hashtable (); - - public SoapTcpChannel GetTcpChannel (Uri to) - { - SoapTcpChannel chan = null; - lock (Channels.SyncRoot) { - int port = (to.Port == -1) ? 8081 : to.Port; - - Uri uri = new Uri (String.Format("{0}://{1}:{2}", Scheme, to.Host, port)); - - chan = Channels[uri.AbsoluteUri] as SoapTcpChannel; - - if(chan == null) { - SoapTcpChannel newChan = new SoapTcpChannel (uri, Formatter); - Channels.Add (uri.AbsoluteUri, newChan); - - newChan.BeginReceive(new AsyncCallback (OnReceive), newChan); - chan = newChan; - - } - } - return chan; - } - - public IAsyncResult BeginSend (SoapEnvelope env, - Uri dest, - AsyncCallback callback, - object state) - { - SoapTcpChannel chan = GetTcpChannel (dest); - - return new SendAsyncResult (chan, env, callback, state); - } - - public void EndSend (IAsyncResult result) - { - if(result == null) { - throw new ArgumentNullException ("result"); - } - - if(result is SendAsyncResult) { - AsyncResult.End (result); - } else { - throw new InvalidOperationException ("Invalid IAsyncResult Type"); - } - } - - public void RegisterPort (Uri to, Type rType) - { - GenericRegister (to, rType); - } - - public void RegisterPort (Uri to, SoapReceiver rec) - { - GenericRegister (to, rec); - } - - private void GenericRegister (Uri to, object rType) - { - if(to == null) { - throw new ArgumentNullException ("to"); - } - if(Scheme != to.Scheme) { - throw new ArgumentException ("invalid Scheme"); - } - //if(to.Host != "localhost") { - // throw new ArgumentException ("Host name " + to.Host + " does not equal " + Dns.GetHostName() ); - //} - - lock(Channels.SyncRoot) { - if(Receivers.Contains (to) == true) { - throw new ArgumentException ("URI has already been registered"); - } - int port = to.Port <= -1 ? 8081 : to.Port; - Uri to_with_port = new Uri (Scheme + "://" + to.Host + ":" + port); - SoapTcpListener tcp = (SoapTcpListener) _listeners[to_with_port]; - - if(tcp == null) { - - //This is what Hervey says it does, not WSE2 TP tested. - - if(to.Host == "localhost") { - tcp = new SoapTcpListener (IPAddress.Loopback, port); - } else { - tcp = new SoapTcpListener (IPAddress.Any, port); - } - - tcp.Start (); - tcp.AddReference (); - - tcp.BeginAcceptSocket (new AsyncCallback (OnAcceptSocket), tcp); - - _listeners[to_with_port] = tcp; - } else { - tcp.AddReference (); - } - - Receivers[to] = rType; - } - } - - public void Send (SoapEnvelope env, Uri to) - { - SoapTcpChannel tcp = GetTcpChannel (to); - - tcp.Send (env); - } - - public void UnregisterAll () - { - lock (Channels.SyncRoot) { - - Receivers.Clear (); - foreach(SoapTcpListener tcp in _listeners.Values) { - tcp.Stop (); - } - _listeners.Clear (); - } - } - - public void UnregisterPort (Uri to) - { - if(to == null) { - throw new ArgumentNullException ("to"); - } - lock(Channels.SyncRoot) { - int port = to.Port < 0 ? 8081 : to.Port; - - Uri newTo = new Uri (Scheme + "://" + to.Host + ":" + port); - SoapTcpListener tcp = _listeners[newTo] as SoapTcpListener; - - if(tcp != null) { - if(tcp.ReleaseReference () == 0) { - _listeners.Remove(newTo); - tcp.Stop(); - } - Receivers.Remove(to); - } - } - } - - //private string Scheme { - // get { return "soap.tcp"; } - //} - - private void OnAcceptSocket (IAsyncResult result) - { - try { - SoapTcpListener tcp = (SoapTcpListener) result.AsyncState; - - if(tcp != null) { - Socket sock = tcp.EndAcceptSocket (result); - if(tcp.IsListening != true) { - tcp.BeginAcceptSocket (new AsyncCallback (OnAcceptSocket), result); - } - if(sock != null) { - SoapTcpChannel chan = new SoapTcpChannel (sock, Formatter); - lock (Channels.SyncRoot) { - Channels.Add (chan.Destination.AbsoluteUri, chan); - } - chan.BeginReceive (new AsyncCallback (OnReceive), chan); - } - } - } catch (Exception) - { - } - } - - private void OnReceive (IAsyncResult result) - { - SoapTcpChannel tcp = result.AsyncState as SoapTcpChannel; - SoapEnvelope env = null; - - try { - env = tcp.EndReceive (result); - tcp.BeginReceive (new AsyncCallback (OnReceive), tcp); - } catch (Exception) { - lock (Channels.SyncRoot) { - Channels.Remove (tcp.Destination.AbsoluteUri); - tcp.Close (); - } - } - - if(env != null) { - env.Context.Channel = tcp; - - AddressingHeaders header = env.Context.Addressing; - - header.Load (env); - - //FIXME: There is a lot more checking to do here for a valid message. - if(header.To != null) { - if(header.To.Value.Scheme != "soap.tcp") { - SoapReceiver.DispatchMessageFault (env, new ArgumentException ("soap error")); - } - } - SoapReceiver.DispatchMessage (env); - } - } - - protected IDictionary Receivers { - get { return _receivers; } - } - - } - -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapTransport.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapTransport.cs deleted file mode 100644 index a9d8433ab01..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapTransport.cs +++ /dev/null @@ -1,88 +0,0 @@ -// -// Microsoft.Web.Services.Messaging.SoapTransport.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Net; - -namespace Microsoft.Web.Services.Messaging -{ - public abstract class SoapTransport - { - private SoapChannelCollection _channels; - private ICredentials _credentials; - private ISoapFormatter _formatter; - private int _timeout; - - [MonoTODO("DimeFormatter is the default here, but not impl yet")] - protected SoapTransport () : base () - { - _credentials = null; - _formatter = new SoapPlainFormatter (); - _channels = new SoapChannelCollection (); - _timeout = 120000; - } - - public SoapChannelCollection Channels { - get { return _channels; } - } - - public ICredentials Credentials { - get { return _credentials; } - set { _credentials = value; } - } - - public ISoapFormatter Formatter { - get { return _formatter; } - set { - if(value == null) { - throw new ArgumentNullException ("formatter"); - } - _formatter = value; - } - } - - public int IdleTimeout { - get { return _timeout; } - set { - if(value < 0) { - throw new ArgumentNullException ("Timeout"); - } - _timeout = value; - } - } - - protected class SendAsyncResult : AsyncResult - { - private delegate void Send (SoapEnvelope env); - - private SoapChannel _channel; - - public SendAsyncResult (SoapChannel chan, - SoapEnvelope env, - AsyncCallback callback, - object state) : base (callback, state) - { - _channel = chan; - chan.BeginSend (env, new AsyncCallback (OnSendComplete), null); - } - - public void OnSendComplete (IAsyncResult result) - { - try { - _channel.EndSend (result); - Complete (result.CompletedSynchronously); - } catch (Exception e) { - Complete (result.CompletedSynchronously, e); - } - } - - public SoapChannel Channel { - get { return _channel; } - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Policy/PolicyEnforcementException.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Policy/PolicyEnforcementException.cs deleted file mode 100644 index 65a663e83ca..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Policy/PolicyEnforcementException.cs +++ /dev/null @@ -1,24 +0,0 @@ -// -// Microsoft.Web.Services.PolicyEnforcementException.cs -// -// Author Daniel Kornhauser dkor@alum.mit.edu -// -// (C) Copyright, Ximian, Inc. 2003. -// - -using System; -using System.Web.Services.Protocols; -using System.Xml; - -namespace Microsoft.Web.Services.Policy { - - [Serializable] - public class PolicyEnforcementException : SoapException - { - public PolicyEnforcementException (string message) - : base (message, XmlQualifiedName.Empty) - { - } - } -} - diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ChangeLog b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ChangeLog deleted file mode 100644 index b5be106ce1c..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ChangeLog +++ /dev/null @@ -1,22 +0,0 @@ -2003-09-07 Sebastien Pouliot - - * Referral.cs: Removed virtual from Clone/GetXml/LoadXml for WSE1 - (corcompare). - * ReferralCollection.cs: Removed virtual from LoadXml/GetXml/ - GetEnumerator/CopyTo/Count/IsSynchronized/SyncRoot for WSE1 - (corcompare) - * ReferralException.cs: Removed ReferralFormatException implementation - and added ReferralException. - * ReferralFormatException.cs: Moved code from ReferralException.cs and - added missing string constants. - * ReferralInputFilter.cs: Added missing TODO. - * ReferralOutputFilter.cs: Added missing TODO. - -2003-09-06 Sebastien Pouliot - - * ReferralInputFilter.cs: Stubbed for compilation (configuration). - * ReferralOutputFilter.cs: Stubbed for compilation (configuration) - -2003-09-04 Sebastien Pouliot - - * ReferralCollection.cs: Added missing ICollection properties. diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/Desc.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/Desc.cs deleted file mode 100644 index 62e3b5272b9..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/Desc.cs +++ /dev/null @@ -1,34 +0,0 @@ -// -// Microsoft.Web.Services.Referral.Desc.cs -// -// Name: Daniel Kornhauser -// -// Copyright (C) Ximian, Inc. 2003 -// - -using System; -using System.Globalization; - -namespace Microsoft.Web.Services.Referral { - - public class Desc - { - Uri uri; - - public Desc () - { - } - - public Uri RefAddr { - get { - return uri; - } - set { - if (value.AbsoluteUri != value.ToString ()) - throw new ArgumentException ( - Locale.GetText ("uri is not absolute")); - uri = value; - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/For.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/For.cs deleted file mode 100644 index 32546a22f01..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/For.cs +++ /dev/null @@ -1,45 +0,0 @@ -// -// Microsoft.Web.Services.Referral.For.cs -// -// Name: Daniel Kornhauser -// -// Copyright (C) Ximian, Inc. 2003 -// - -using System; -using System.Globalization; - -namespace Microsoft.Web.Services.Referral { - - public class For - { - Uri exact; - Uri prefix; - - public For () - { - } - - [MonoTODO] - public Uri Exact { - get { - return exact; - } - set { - - exact = value; - } - } - - [MonoTODO] - public Uri Prefix { - get { - return prefix; - } - - set { - prefix = value; - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/If.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/If.cs deleted file mode 100644 index f24d93a499d..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/If.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -// Microsoft.Web.Service.Referral.If.cs -// -// Name: Daniel Kornhauser -// -// Copyright (C) Ximian, Inc. 2003 -// - -using System; -using System.Globalization; - -namespace Microsoft.Web.Services.Referral { - - public class If - { - - UriList uris; - long milliseconds; - - public If() - { - } - - public UriList Invalidates{ - get { - return uris; - } - } - - [MonoTODO] - public long Ttl { - - get { - return milliseconds; - } - - set { - milliseconds = value; - - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/Referral.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/Referral.cs deleted file mode 100644 index 8d7304ca30e..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/Referral.cs +++ /dev/null @@ -1,120 +0,0 @@ -// -// Microsoft.Web.Services.Referral.Referral.cs -// -// Authors: -// Duncan Mak (duncan@ximian.com) -// Daniel Kornhauser -// -// Copyright (C) Ximian, Inc. 2003 -// - -using System; -using System.Collections; -using System.Globalization; -using System.Web.Services.Protocols; -using System.Xml; -using Microsoft.Web.Services.Routing; -#if !WSE1 -using Microsoft.Web.Services.Xml; -#endif - -namespace Microsoft.Web.Services.Referral { - - public class Referral : ICloneable, IXmlElement - { - Uri uri; - - public Referral () - { - } - - public Referral (Uri uri) - { - this.uri = uri; - } - - [MonoTODO] - public void CheckValid () - { - } - -#if WSE1 - public object Clone () -#else - public virtual object Clone () -#endif - { - return new Referral (uri); - } - - [MonoTODO] -#if WSE1 - public XmlElement GetXml (XmlDocument document) -#else - public virtual XmlElement GetXml (XmlDocument document) -#endif - { - if (document == null) - throw new ArgumentNullException ( - Locale.GetText ("Argument is null.")); - - throw new NotImplementedException (); - } - - [MonoTODO] -#if WSE1 - public void LoadXml (XmlElement element) -#else - public virtual void LoadXml (XmlElement element) -#endif - { - if (element == null) - throw new ArgumentNullException ( - Locale.GetText ("Argument is null.")); - - throw new NotImplementedException (); - } - - [MonoTODO] - public Desc Desc { - get { - throw new NotImplementedException (); - } - } - - [MonoTODO] - public ViaCollection Go { - get { - throw new NotImplementedException (); - } - } - - [MonoTODO] - public For For{ - get { - throw new NotImplementedException (); - } - } - - [MonoTODO] - public If If { - get { - throw new NotImplementedException (); - } - } - - [MonoTODO] - public Uri RefId { - get { - throw new NotImplementedException (); - } - set { - - if (value == null) - throw new ArgumentNullException (); - - throw new NotImplementedException (); - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralCollection.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralCollection.cs deleted file mode 100644 index fa82d1abf8a..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralCollection.cs +++ /dev/null @@ -1,133 +0,0 @@ -// -// Microsoft.Web.Services.Referral.ReferralCollection.cs -// -// Name: Duncan Mak (duncan@ximian.com) -// -// Copyright (C) Ximian, Inc. 2003 -// - -using System; -using System.Collections; -using System.Globalization; -using System.Web.Services.Protocols; -using System.Xml; -#if !WSE1 -using Microsoft.Web.Services.Xml; -#endif - -namespace Microsoft.Web.Services.Referral { - - public class ReferralCollection : SoapHeader, ICollection, IEnumerable, IXmlElement - { - ArrayList list; - - public ReferralCollection () - { - list = new ArrayList (); - } - - public void Add (Referral referral) - { - list.Add (referral); - } - - public void AddRange (Referral [] referrals) - { - list.AddRange (referrals); - } - - public void Clear () - { - list.Clear (); - } - - public bool Contains (Referral referral) - { - return list.Contains (referral); - } - - public bool Contains (Uri uri) - { - return list.Contains (new Referral (uri)); - } - -#if WSE1 - public void CopyTo (Array array, int index) -#else - public virtual void CopyTo (Array array, int index) -#endif - { - list.CopyTo (array, index); - } - -#if WSE1 - public int Count { -#else - public virtual int Count { -#endif - get { return list.Count; } - } - -#if WSE1 - public IEnumerator GetEnumerator () -#else - public virtual IEnumerator GetEnumerator () -#endif - { - return list.GetEnumerator (); - } - - [MonoTODO] -#if WSE1 - public XmlElement GetXml (XmlDocument document) -#else - public virtual XmlElement GetXml (XmlDocument document) -#endif - { - if (document == null) - throw new ArgumentNullException ( - Locale.GetText ("Argument is null.")); - - throw new NotImplementedException (); - } -#if WSE1 - public bool IsSynchronized { -#else - public virtual bool IsSynchronized { -#endif - get { return list.IsSynchronized; } - } - - [MonoTODO] -#if WSE1 - public void LoadXml (XmlElement element) -#else - public virtual void LoadXml (XmlElement element) -#endif - { - if (element == null) - throw new ArgumentNullException ( - Locale.GetText ("Argument is null.")); - - throw new NotImplementedException (); - } - - public void Remove (Referral referral) - { - list.Remove (referral); - } - - public void Remove (Uri uri) - { - list.Remove (new Referral (uri)); - } - -#if WSE1 - public object SyncRoot { -#else - public virtual object SyncRoot { -#endif - get { return list.SyncRoot; } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralException.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralException.cs deleted file mode 100644 index 5ce2539be1d..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralException.cs +++ /dev/null @@ -1,24 +0,0 @@ -// -// Microsoft.Web.Services.Referral.ReferralException.cs -// -// Authors: -// Daniel Kornhauser -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) Ximian, Inc. 2003. -// Portions (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services.Referral { - - [Serializable] - public class ReferralException : SystemException { - - public ReferralException (string message) : base (message) {} - - public ReferralException (string message, Exception ex) : base (message, ex) {} - } -} - diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralFormatException.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralFormatException.cs deleted file mode 100644 index f1805e2add4..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralFormatException.cs +++ /dev/null @@ -1,70 +0,0 @@ -// -// Microsoft.Web.Services.Referral.ReferralFormatException.cs -// -// Authors: -// Daniel Kornhauser -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) Ximian, Inc. 2003. -// Portions (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -// TODO: Figure out what the Uri parameter does. - -using System; -using System.Web.Services.Protocols; -using System.Xml; - -namespace Microsoft.Web.Services.Referral { - - [Serializable] - [MonoTODO("I18N")] - public class ReferralFormatException : SoapHeaderException { - - public static readonly string BadDescValue = Locale.GetText ("BadDescValue"); - public static readonly string BadExactValue = Locale.GetText ("BadExactValue"); - public static readonly string BadMatchCombination = Locale.GetText ("BadMatchCombination"); - public static readonly string BadPrefixValue = Locale.GetText ("BadPrefixValue"); - public static readonly string BadRefAddrValue = Locale.GetText ("BadRefAddrValue"); - public static readonly string BadRefIdValue = Locale.GetText ("BadRefIdValue"); - public static readonly string BadRidValue = Locale.GetText ("BadRidValue"); - public static readonly string BadTransport = Locale.GetText ("BadTransport"); - public static readonly string BadTtlValue = Locale.GetText ("BadTtlValue"); - public static readonly string BadViaValue = Locale.GetText ("BadViaValue"); - public static readonly string DuplicateDescElement = Locale.GetText ("DuplicateDescElement"); - public static readonly string DuplicateExactElement = Locale.GetText ("DuplicateExactElement"); - public static readonly string DuplicateForElement = Locale.GetText ("DuplicateForElement"); - public static readonly string DuplicateGoElement = Locale.GetText ("DuplicateGoElement"); - public static readonly string DuplicateIfElement = Locale.GetText ("DuplicateIfElement"); - public static readonly string DuplicatePrefixElement = Locale.GetText ("DuplicatePrefixElement"); - public static readonly string DuplicateRefIdElement = Locale.GetText ("DuplicateRefIdElement"); - public static readonly string ExactIsNotAbsoluteUri = Locale.GetText ("ExactIsNotAbsoluteUri"); - public static readonly string MissingForElement = Locale.GetText ("MissingForElement"); - public static readonly string MissingGoElement = Locale.GetText ("MissingGoElement"); - public static readonly string MissingRefIdElement = Locale.GetText ("MissingRefIdElement"); - public static readonly string MissingRidElement = Locale.GetText ("MissingRidElement"); - public static readonly string MissingViaElement = Locale.GetText ("MissingViaElement"); - public static readonly string MoreThanOneReferralHeaders = Locale.GetText ("MoreThanOneReferralHeaders"); - public static readonly string NegativeTtlValue = Locale.GetText ("NegativeTtlValue"); - public static readonly string PrefixIsNotAbsoluteUri = Locale.GetText ("PrefixIsNotAbsoluteUri"); - public static readonly string RefAddrIsNotAbsoluteUri = Locale.GetText ("RefAddrIsNotAbsoluteUri"); - public static readonly string SignedTtlValue = Locale.GetText ("SignedTtlValue"); - public static readonly string ViaIsNotAbsoluteUri = Locale.GetText ("ViaIsNotAbsoluteUri"); - - Uri reference; - - public ReferralFormatException (string message) - : base (message, XmlQualifiedName.Empty) { - } - - public ReferralFormatException (Uri refid, string message) - : base (message, XmlQualifiedName.Empty) { - reference = refid; - } - - public ReferralFormatException (Uri refid, string message, Exception innerException) - : base (message, XmlQualifiedName.Empty, innerException) { - reference = refid; - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralInputfilter.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralInputfilter.cs deleted file mode 100644 index 24179183fee..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralInputfilter.cs +++ /dev/null @@ -1,26 +0,0 @@ -// -// ReferralInputFilter.cs: Referral SOAP Input Filter -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services.Referral { - - public class ReferralInputFilter : SoapInputFilter { - - public ReferralInputFilter () {} - - [MonoTODO] - public override void ProcessMessage (SoapEnvelope envelope) - { - if (envelope == null) - throw new ArgumentNullException ("envelope"); - // TODO - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralOutputFilter.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralOutputFilter.cs deleted file mode 100644 index 5a1e62f0d6c..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralOutputFilter.cs +++ /dev/null @@ -1,26 +0,0 @@ -// -// ReferralOutputFilter.cs: Referral SOAP Output Filter -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services.Referral { - - public class ReferralOutputFilter : SoapOutputFilter { - - public ReferralOutputFilter () {} - - [MonoTODO] - public override void ProcessMessage (SoapEnvelope envelope) - { - if (envelope == null) - throw new ArgumentNullException ("envelope"); - // TODO - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/ChangeLog b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/ChangeLog deleted file mode 100644 index a3399193ddf..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/ChangeLog +++ /dev/null @@ -1,36 +0,0 @@ -2003-10-26 Todd Berman - - * RoutingFault.cs: Implementation - * Path.cs: More Implementation - * Found.cs: Implementation - -2003-10-26 Todd Berman - - * RoutingOutputFilter.cs: Adding ReplyTo - -2003-10-22 Todd Berman - - * RoutingOutputFilter.cs: Quick WSE2 hack for the To and Action fields, - still needs a lot of implementation. - -2003-09-07 Sebastien Pouliot - - * Path.cs: Constructors are internal and Clone is non virtual in WSE1 - (corcompare). Added missing properties (many are obsolete in WSE2). - * RoutingInputFilter.cs: Added missing TODO. - * RoutingOutputFilter.cs: Added missing TODO. - * Via.cs: Removed virtual from Clone for WSE1 (corcompare). - * ViaCollection.cs: Removed virtual from Clone/GetEnumerator/CopyTo/ - SyncRoot for WSE1 (corcompare). - * WSRouting.cs: New. Routing constant strings. - -2003-09-06 Sebastien Pouliot - - * RoutingInputFilter.cs: Stubbed for compilation (configuration). - * RoutingOutputFilter.cs: Stubbed for compilation (configuration). - -2003-09-04 Sebastien Pouliot - - * Path.cs: Corrected typos to fix compilation. - * Via.cs: Corrected typos to fix compilation. - * ViaCollection.cs: Corrected typos to fix compilation. diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/Found.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/Found.cs deleted file mode 100644 index bf5ffb4306d..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/Found.cs +++ /dev/null @@ -1,22 +0,0 @@ -// -// Microsoft.Web.Services.Routing.Found.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using Microsoft.Web.Services; - -namespace Microsoft.Web.Services.Routing -{ - - public class Found - { - private UriList _uris = new UriList (); - - public UriList At { - get { return _uris; } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/Path.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/Path.cs deleted file mode 100644 index 5ca1ff2d593..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/Path.cs +++ /dev/null @@ -1,191 +0,0 @@ -// -// Microsoft.Web.Services.Routing.Path.cs -// -// Name: Duncan Mak (duncan@ximian.com) -// -// Copyright (C) Ximian, Inc. 2003 -// - -using System; -using System.Globalization; -using System.Web.Services.Protocols; -using System.Xml; - -namespace Microsoft.Web.Services.Routing { - - [MonoTODO] - public class Path : SoapHeader, ICloneable - { -#if WSE1 - XmlElement element; -#endif - private ViaCollection _forward; - private ViaCollection _reverse; - private RoutingFault _fault; - -#if WSE1 - internal Path () {} -#else - public Path () { - Actor = "http://schemas.xmlsoap.org/soap/actor/next"; - MustUnderstand = true; - } -#endif - -#if WSE1 - internal Path (XmlElement element) -#else - public Path (XmlElement element) : base () -#endif - { -#if WSE1 - this.element = element; -#else - LoadXml (element); -#endif - } - -#if WSE2 - public void CheckValid () - { - if(Actor.Length == 0 || Actor != "http://schemas.xmlsoap.org/soap/actor/next") - { - throw new RoutingFormatException ("Bad Actor value"); - } - } -#endif - - public XmlElement GetXml (XmlDocument document) - { - if (document == null) - throw new ArgumentNullException ( - Locale.GetText ("Argument is null.")); - throw new NotImplementedException (); - } - - [MonoTODO] - public void LoadXml (XmlElement element) - { - if (element == null) - throw new ArgumentNullException ( - Locale.GetText ("Argument is null.")); - throw new NotImplementedException (); - } - -#if WSE1 - [MonoTODO] - public object Clone () -#else - public virtual object Clone () -#endif - { -#if WSE1 - throw new NotImplementedException (); -#else - Path newPath = new Path (); - - if(_forward != null) { - newPath._forward = _forward.Clone () as ViaCollection; - } - - if(_reverse != null) { - newPath._reverse = _reverse.Clone () as ViaCollection; - } - - newPath._fault = _fault; - - return newPath; -#endif - } - -#if !WSE1 - [Obsolete] - public string Action { - get { throw new NotSupportedException (); } - set { throw new NotSupportedException (); } - } -#else - [MonoTODO] - public string Action { - get { return null; } - set { ; } - } -#endif - - public RoutingFault Fault { - get { return _fault; } - set { _fault = value; } - } - -#if !WSE1 - [Obsolete] - public Uri From { - get { throw new InvalidOperationException (); } - set { throw new InvalidOperationException (); } - } -#else - [MonoTODO] - public Uri From { - get { return null; } - set { ; } - } -#endif - - public ViaCollection Fwd { - get { - if(_forward == null) { - _forward = new ViaCollection (); - } - return _forward; - } - } - -#if !WSE1 - [Obsolete("Use SoapContext.MessageId")] - public Uri Id { - get { throw new InvalidOperationException (); } - } -#else - [MonoTODO] - public Uri Id { - get { return null; } - } -#endif - -#if !WSE1 - [Obsolete("Use SoapContext.RelatesTo")] - public Uri RelatesTo { - get { throw new InvalidOperationException (); } - set { throw new InvalidOperationException (); } - } -#else - [MonoTODO] - public Uri RelatesTo { - get { return null; } - set { ; } - } -#endif - - public ViaCollection Rev { - get { - if(_reverse == null) { - _reverse = new ViaCollection (); - } - return _reverse; - } - set { _reverse = value; } - } - -#if !WSE1 - [Obsolete("Use SoapContext.To")] - public Uri To { - get { throw new InvalidOperationException (); } - } -#else - [MonoTODO] - public Uri To { - get { return null; } - } -#endif - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/RoutingFault.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/RoutingFault.cs deleted file mode 100644 index 6a4e62e07d8..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/RoutingFault.cs +++ /dev/null @@ -1,114 +0,0 @@ -// -// Microsoft.Web.Services.Routing.RoutingFault.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Xml; -using System.Web.Services.Protocols; - -namespace Microsoft.Web.Services.Routing -{ - public class RoutingFault : Exception - { - private string _code; - private Exception _detailedException = null; - private string _endpoint; - private Found _found = null; - private int _maxsize = 0; - private int _maxtime = 0; - private string _reason; - private int _retryAfter = 0; - - public RoutingFault () : base () - { - } - - public RoutingFault (XmlElement element) : base () - { - LoadXml (element); - } - - public RoutingFault (string code, string reason, int maxtime, Exception ex) : base (reason) - { - _code = code; - _reason = reason; - _maxtime = maxtime; - _detailedException = ex; - } - - public RoutingFault (string code, string reason, string endpoint, Exception ex) : base (reason) - { - _code = code; - _reason = reason; - _endpoint = endpoint; - _detailedException = ex; - } - - public RoutingFault (string code, string reason, Exception ex) : base (reason) - { - _code = code; - _reason = reason; - _detailedException = ex; - } - - public SoapHeaderException GetSoapHeaderException () - { - return new SoapHeaderException (Reason, SoapException.ClientFaultCode, DetailException); - } - - [MonoTODO] - public XmlElement GetXml (XmlDocument doc) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public void LoadXml (XmlElement element) - { - throw new NotImplementedException (); - } - - public string Code { - get { return _code; } - set { _code = value; } - } - - public Exception DetailException { - get { return _detailedException; } - set { _detailedException = value; } - } - - public string Endpoint { - get { return _endpoint; } - set { _endpoint = value; } - } - - public Found Found { - get { return _found; } - set { _found = value; } - } - - public int MaxSize { - get { return _maxsize; } - set { _maxsize = value; } - } - - public int MaxTime { - get { return _maxtime; } - set { _maxtime = value; } - } - - public string Reason { - get { return _reason; } - set { _reason = value; } - } - - public int RetryAfter { - get { return _retryAfter; } - set { _retryAfter = value; } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/RoutingFormatException.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/RoutingFormatException.cs deleted file mode 100644 index 0fd80d6455c..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/RoutingFormatException.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Microsoft.Web.Services.Routing.RoutingFormatException.cs -// -// Author: Daniel Kornhauser -// -// (C) Ximian, Inc. 2003 - -using System; -using System.Web.Services.Protocols; -using System.Xml; - - -namespace Microsoft.Web.Services.Routing { - - [Serializable] - public class RoutingFormatException : SoapHeaderException - { - public RoutingFormatException (string message) : base (message, XmlQualifiedName.Empty) - { - } - - public RoutingFormatException (string message, Exception ex) : base (message, XmlQualifiedName.Empty, ex) - { - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/RoutingInputfilter.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/RoutingInputfilter.cs deleted file mode 100644 index 268c80d3999..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/RoutingInputfilter.cs +++ /dev/null @@ -1,26 +0,0 @@ -// -// RoutingInputFilter.cs: Routing SOAP Input Filter -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services.Routing { - - public class RoutingInputFilter : SoapInputFilter { - - public RoutingInputFilter () {} - - [MonoTODO] - public override void ProcessMessage (SoapEnvelope envelope) - { - if (envelope == null) - throw new ArgumentNullException ("envelope"); - // TODO - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/RoutingOutputFilter.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/RoutingOutputFilter.cs deleted file mode 100644 index e33ed8705c1..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/RoutingOutputFilter.cs +++ /dev/null @@ -1,39 +0,0 @@ -// -// SecurityOutputFilter.cs: Security SOAP Output Filter -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services.Routing { - - public class RoutingOutputFilter : SoapOutputFilter { - - public RoutingOutputFilter () {} - - [MonoTODO] - public override void ProcessMessage (SoapEnvelope envelope) - { - if (envelope == null) - throw new ArgumentNullException ("envelope"); - // TODO -#if WSE2 -//Quick quick quick Hack for some Addressing stuff - if(envelope.Context.To != null) { - envelope.CreateHeader ().AppendChild (envelope.Context.To.GetXml (envelope)); - } - if(envelope.Context.Action != null) { - envelope.CreateHeader ().AppendChild (envelope.Context.Action.GetXml (envelope)); - } - if(envelope.Context.ReplyTo != null) { - envelope.CreateHeader ().AppendChild (envelope.Context.ReplyTo.GetXml (envelope)); - } - -#endif - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/Via.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/Via.cs deleted file mode 100644 index 9d9646ab6f2..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/Via.cs +++ /dev/null @@ -1,57 +0,0 @@ -// -// Microsfot.Web.Services.Routing.Via.cs -// -// Author: Daniel Kornhauser -// -// Copyright (C) Ximian, Inc. 2003 -// - -using System; - -namespace Microsoft.Web.Services.Routing { - - public class Via: ICloneable - { - Uri val; - Uri vid; - - public Via() - { - } - - public Via (Uri value) - { - this.val = value; - } - - private Via (Uri value, Uri vid) - { - this.val = value; - this.vid = vid; - } - - public Uri Value - { - get { return val; } - set { val = value; } - } - - public Uri Vid - { - get { return vid; } - set { vid = value; } - } - -#if WSE1 - public object Clone () -#else - public virtual object Clone () -#endif - { - return new Via (val, vid); - } - - } -} - - diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/ViaCollection.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/ViaCollection.cs deleted file mode 100644 index 9f83f6fd64f..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/ViaCollection.cs +++ /dev/null @@ -1,90 +0,0 @@ -// -// Microsoft.Web.Services.Routing.ViaCollection.cs -// -// Author: Daniel Kornhauser -// -// Copyright (C) Ximian, Inc. 2003 -// - -using System; -using System.Collections; - -namespace Microsoft.Web.Services.Routing { - - public class ViaCollection : ICollection, IEnumerable, ICloneable - { - ArrayList list; - - public ViaCollection () - { - list = new ArrayList (); - } - - ViaCollection (ArrayList list) - { - this.list = list; - } - - - public int Count { - get { return list.Count; } - } - - - public bool IsSynchronized { - get { return list.IsSynchronized; } - } - - - public Via this [int filter] { - get { - return (Via) list [filter]; - } - set { - list[filter] = value; - } - - } - - public virtual object SyncRoot { - get { - return list.SyncRoot; - } - } - - public int Add (Via via) - { - return list.Add (via); - } - - public virtual object Clone () - { - return new ViaCollection (list); - } - - public virtual void CopyTo (Array array, int index) - { - list.CopyTo(array, index); - } - - public virtual IEnumerator GetEnumerator () - { - return list.GetEnumerator(); - } - - public void Insert (int index, Via via) - { - list.Insert(index, via); - } - - public void InsertRange (int index, ViaCollection collection) - { - list.InsertRange(index, collection); - } - - public void RemoveAt (int index) - { - list.RemoveAt(index); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/WSRouting.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/WSRouting.cs deleted file mode 100644 index 56f1f9659fa..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/WSRouting.cs +++ /dev/null @@ -1,51 +0,0 @@ -// -// WSRouting.cs: WSRouting definitions -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services.Routing { - - public class WSRouting { - - public class ActionUri { - - public const string Fault = "http://schemas.xmlsoap.org/soap/fault"; - - public ActionUri () {} - } - - public class ElementNames { - - public const string Action = "action"; - public const string Code = "code"; - public const string Endpoint = "endpoint"; - public const string Fault = "fault"; - public const string Found = "found"; - public const string From = "from"; - public const string Fwd = "fwd"; - public const string Id = "id"; - public const string MaxSize = "maxsize"; - public const string MaxTime = "maxtime"; - public const string Path = "path"; - public const string Reason = "reason"; - public const string RelatesTo = "relatesTo"; - public const string RetryAfter = "retryAfter"; - public const string Rev = "rev"; - public const string To = "to"; - public const string Via = "via"; - - public ElementNames () {} - } - - public const string NamespaceURI = "http://schemas.xmlsoap.org/rp"; - public const string Prefix = "wsrp"; - - public WSRouting () {} - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/ChangeLog b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/ChangeLog deleted file mode 100644 index e407f157dbb..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/ChangeLog +++ /dev/null @@ -1,9 +0,0 @@ -2003-10-05 Sebastien Pouliot - - * X509Certificate.cs: Class is sealed (corcompare). Implemented - GetSubjectAlternativeName for WSE2. - * X509CertificateCollection.cs: Removed Item[] set (corcompare). - -2003-09-04 Sebastien Pouliot - - * FileCertificateStore.cs: Fixed compilation. diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/FileCertificateStore.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/FileCertificateStore.cs deleted file mode 100644 index a9f2b8a84bf..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/FileCertificateStore.cs +++ /dev/null @@ -1,48 +0,0 @@ -// -// FileCertificateStore.cs: Handles a file-based certificate store. -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using Mono.Security.Authenticode; - -namespace Microsoft.Web.Services.Security.X509 { - - internal class FileCertificateStore : ICertificateStore { - - private string _storeName; - private X509CertificateStore.StoreOpenFlags _flags; - private X509CertificateStore.StoreLocation _location; - private IntPtr _handle; - - public FileCertificateStore (X509CertificateStore.StoreLocation location, string storeName, X509CertificateStore.StoreOpenFlags flags) - { - _location = location; - _storeName = storeName; - _flags = flags; - } - - public IntPtr Handle { - get { return (IntPtr) 0; } - } - - public X509CertificateCollection GetCollection () - { - if (_spc == null) { - _spc = SoftwarePublisherCertificate.CreateFromFile (_storeName); - } - X509CertificateCollection coll = new X509CertificateCollection (); - Mono.Security.X509.X509CertificateCollection spcoll = _spc.Certificates; - foreach (Mono.Security.X509.X509Certificate x in spcoll) { - coll.Add (new X509Certificate (x.RawData)); - } - return coll; - } - - public void Close () {} - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/ICertificateStore.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/ICertificateStore.cs deleted file mode 100644 index 205eeb25ada..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/ICertificateStore.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; - -namespace Microsoft.Web.Services.Security.X509 { - - public interface ICertificateStore { - - void Close (); - - IntPtr Handle { - get; - } - - X509CertificateCollection GetCollection (); - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/MemoryCertificateStore.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/MemoryCertificateStore.cs deleted file mode 100644 index fb2470c7f91..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/MemoryCertificateStore.cs +++ /dev/null @@ -1,52 +0,0 @@ -// -// MemoryCertificateStore.cs: Handles an in-memory certificate store. -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services.Security.X509 { - - internal class MemoryCertificateStore : ICertificateStore { - - private string _storeName; - private X509CertificateStore.StoreOpenFlags _flags; - private X509CertificateStore.StoreLocation _location; - private IntPtr _handle; - private X509CertificateCollection _coll; - - public MemoryCertificateStore (X509CertificateStore.StoreLocation location, string storeName, X509CertificateStore.StoreOpenFlags flags) - { - _location = location; - _storeName = storeName; - _flags = flags; - _coll = new X509CertificateCollection (); - } - - public void Close () - { - } - - public IntPtr Handle { - get { return (IntPtr) _coll.GetHashCode (); } - } - - public X509CertificateCollection GetCollection () - { - if (_flags == X509CertificateStore.StoreOpenFlags.ReadOnly) { - // return a copy of the collection so changes aren't persisted - X509CertificateCollection copy = new X509CertificateCollection (); - foreach (X509Certificate x in _coll) { - copy.Add (x); - } - return copy; - } - else - return _coll; - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/X509Certificate.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/X509Certificate.cs deleted file mode 100644 index fd100b30523..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/X509Certificate.cs +++ /dev/null @@ -1,192 +0,0 @@ -// -// X509Certificates.cs: Handles (a little better) X509 certificates. -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.ComponentModel; -using System.Security.Cryptography; -using System.Security.Cryptography.X509Certificates; - -using Mono.Security; -using MX = Mono.Security.X509; -using Mono.Security.X509.Extensions; - -namespace Microsoft.Web.Services.Security.X509 { - - public sealed class X509Certificate : System.Security.Cryptography.X509Certificates.X509Certificate, IDisposable { - - // do not includes: KeyUsage.keyEncipherment and KeyUsage.keyAgreement (see "OWN.cer") - private static KeyUsages[] dataEncryption = new KeyUsages [3] { KeyUsages.dataEncipherment, KeyUsages.decipherOnly, KeyUsages.encipherOnly }; - // do not includes KeyUsage.cRLSign, KeyUsage.keyCertSign - private static KeyUsages[] digitalSignature = new KeyUsages [2] { KeyUsages.digitalSignature, KeyUsages.nonRepudiation }; - - private MX.X509Certificate x509; - private bool m_disposed; - - public X509Certificate (byte[] rawCertificate) : base (rawCertificate) - { - x509 = new MX.X509Certificate (rawCertificate); - m_disposed = false; - } - - public X509Certificate (IntPtr handle) : base (handle) - { - x509 = new MX.X509Certificate (base.GetRawCertData ()); - m_disposed = false; - } - - ~X509Certificate () - { - Dispose (); - } - - // IDisposable - public void Dispose () - { - if (!m_disposed) { - // Finalization is now unnecessary - GC.SuppressFinalize (this); - } - // call base class - // no need as they all are abstract before us - m_disposed = true; - } - - // LAMESPEC: Do not confuse with CreateFromCertFile - public static X509Certificate CreateCertFromFile (string fileName) - { - System.Security.Cryptography.X509Certificates.X509Certificate x = System.Security.Cryptography.X509Certificates.X509Certificate.CreateFromCertFile (fileName); - return new X509Certificate (x.GetRawCertData ()); - } - - // LAMESPEC: Do not confuse with CreateFromSignedFile - public static X509Certificate CreateCertFromSignedFile (string fileName) - { - System.Security.Cryptography.X509Certificates.X509Certificate x = System.Security.Cryptography.X509Certificates.X509Certificate.CreateFromSignedFile (fileName); - return new X509Certificate (x.GetRawCertData ()); - } - - // I knew that using string for date were a bad idea! - public bool IsCurrent { - get { return x509.IsCurrent; } - } - - // Well it seems that DSA certificates aren't popular enough :-( - // Note: Private key isn't available - [MonoTODO("Private key isn't yet supported - requires cert stores")] - public RSA Key { - get { - throw new Win32Exception (0, "Private key is unavailable (TODO)"); - } - } - - // Well it seems that DSA certificates aren't popular enough :-( - public RSA PublicKey { - get { return x509.RSA; } - } - - // Just KeyUsage or also ExtendedKeyUsage ? - // it doesn't seems to interpret NetscapeCertType - private bool Supports (KeyUsages[] usages) - { - // X.509 KeyUsage - MX.X509Extension extn = x509.Extensions ["2.5.29.15"]; - if (extn != null) { - KeyUsageExtension keyUsage = new KeyUsageExtension (extn); - foreach (KeyUsages usage in usages) { - if (keyUsage.Support (usage)) - return true; - } - return false; - } - // DEPRECATED keyAttributes - extn = x509.Extensions ["2.5.29.2"]; - if (extn != null) { - KeyAttributesExtension keyAttr = new KeyAttributesExtension (extn); - foreach (KeyUsages usage in usages) { - if (keyAttr.Support (usage)) - return true; - } - return false; - } - // key usage isn't specified (so it's not limited) - return true; - } - - public bool SupportsDataEncryption { - get { - // always true for older certificates - if (x509.Version < 3) - return true; - return Supports (dataEncryption); - } - } - - public bool SupportsDigitalSignature { - get { - // always true for older certificates - if (x509.Version < 3) - return true; - return Supports (digitalSignature); - } - } - - public static X509Certificate FromBase64String (string rawString) - { - byte[] cert = Convert.FromBase64String (rawString); - return new X509Certificate (cert); - } - - public byte[] GetKeyIdentifier () - { - // if present in certificate return value of the SubjectKeyIdentifier - MX.X509Extension extn = x509.Extensions ["2.5.29.14"]; - if (extn != null) { - ASN1 bs = new ASN1 (extn.Value.Value); - return bs.Value; - } - // strangely DEPRECATED keyAttributes isn't used here (like KeyUsage) - - // if not then we must calculate the SubjectKeyIdentifier ourselve - // Note: MS does that hash on the complete subjectPublicKeyInfo (unlike PKIX) - // http://groups.google.ca/groups?selm=e7RqM%24plCHA.1488%40tkmsftngp02&oe=UTF-8&output=gplain - ASN1 subjectPublicKeyInfo = new ASN1 (0x30); - ASN1 algo = subjectPublicKeyInfo.Add (new ASN1 (0x30)); - algo.Add (new ASN1 (CryptoConfig.EncodeOID (x509.KeyAlgorithm))); - // FIXME: does it work for DSA certs (without an 2.5.29.14 extension ?) - algo.Add (new ASN1 (x509.KeyAlgorithmParameters)); - byte[] pubkey = x509.PublicKey; - byte[] bsvalue = new byte [pubkey.Length + 1]; // add unused bits (0) before the public key - Array.Copy (pubkey, 0, bsvalue, 1, pubkey.Length); - subjectPublicKeyInfo.Add (new ASN1 (0x03, bsvalue)); - SHA1 sha = SHA1.Create (); - return sha.ComputeHash (subjectPublicKeyInfo.GetBytes ()); - } -#if !WSE1 - public string GetSubjectAlternativeName () - { - // if present in certificate return value of the SubjectAltName - MX.X509Extension extn = x509.Extensions ["2.5.29.17"]; - if (extn != null) - return null; - SubjectAltNameExtension altname = new SubjectAltNameExtension (extn); - return ((altname.RFC822.Length > 0) ? altname.RFC822 [0] : null); - } -#endif - // overloaded but WHY ? - public override int GetHashCode () - { - return base.GetHashCode (); - } - - public string ToBase64String () - { - return Convert.ToBase64String (base.GetRawCertData ()); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/X509CertificateCollection.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/X509CertificateCollection.cs deleted file mode 100644 index fd10ebb9136..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/X509CertificateCollection.cs +++ /dev/null @@ -1,61 +0,0 @@ -// -// X509CertificateCollection.cs: Handles certificate collection. -// based on: mcs\class\System\System.Security.Cryptography.X509Certificates\X509CertificateCollection.cs -// -// Authors: -// Lawrence Pit (loz@cable.a2000.nl) -- original work -// Sebastien Pouliot (spouliot@motus.com) -- all modifications and bugs ;-) -// - -using System; -using System.Collections; - -namespace Microsoft.Web.Services.Security.X509 { - - public class X509CertificateCollection : CollectionBase { - - public X509CertificateCollection () {} - - public X509Certificate this [int index] { - get { - // required for exception ? - if ((index < 0) || (index > InnerList.Count)) - throw new ArgumentOutOfRangeException ("index"); - return (X509Certificate) InnerList [index]; - } - } - - public int Add (X509Certificate certificate) - { - if (certificate == null) - throw new ArgumentNullException ("value"); - - return InnerList.Add (certificate); - } - - public bool Contains (X509Certificate certificate) - { - return InnerList.Contains (certificate); - } - - public void CopyTo (Array array, int index) - { - InnerList.CopyTo (array, index); - } - - public int IndexOf (X509Certificate certificate) - { - return InnerList.IndexOf (certificate); - } - - public void Insert (int index, X509Certificate certificate) - { - InnerList.Insert (index, certificate); - } - - public void Remove (X509Certificate certificate) - { - InnerList.Remove (certificate); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/X509CertificateStore.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/X509CertificateStore.cs deleted file mode 100644 index 3d4274bed4f..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/X509CertificateStore.cs +++ /dev/null @@ -1,244 +0,0 @@ -// -// X509CertificateStore.cs: Handles certificate stores. -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Security.Cryptography; -using System.Security.Cryptography.X509Certificates; -using System.Text; - -namespace Microsoft.Web.Services.Security.X509 { - - public class X509CertificateStore { - - [Serializable] - public enum StoreLocation { - CurrentService = 262144, - CurrentUser = 65536, - CurrentUserGroupPolicy = 458752, - LocalMachine = 131072, - LocalMachineEnterprise = 589824, - LocalMachineGroupPolicy = 524288, - Services = 327680, - Unknown = 0, - Users = 393216 - } - - [Flags] - [Serializable] - public enum StoreOpenFlags { - CreateNew = 8192, - DeferClose = 4, - Delete = 16, - None = 0, - OpenExisting = 16384, - ReadOnly = 32768 - } - - [Serializable] - public enum StoreProvider { - Collection = 11, - File = 3, - Memory = 1, - System = 10 - } - - public const string CAStore = "CA"; - public const string MyStore = "My"; - public const string RootStore = "Root"; - public const string TrustStore = "Trust"; - public const string UnTrustedStore = "Disallowed"; - - private const string storeAlreadyOpened = "store already opened"; - private const string storeNotOpened = "store not opened"; - - private StoreOpenFlags storeOpenFlags; - private StoreProvider storeProvider; - private StoreLocation storeLocation; - private string storeName; - private ICertificateStore store; - - public X509CertificateStore (StoreProvider provider, StoreLocation location, string storeName) - { - storeProvider = provider; - storeLocation = location; - this.storeName = storeName; - } - - ~X509CertificateStore () - { - if (store != null) { - store.Close (); - store = null; - } - } - - public X509CertificateCollection Certificates { - get { - if (store == null) - return null; - return store.GetCollection (); - } - } - - public IntPtr Handle { - get { - if (store == null) - return (IntPtr) 0; - return store.Handle; - } - } - - public StoreLocation Location { - get { return storeLocation; } - } - - public bool Open () - { - return InternalOpen (StoreOpenFlags.None); - } - - public bool OpenRead () - { - return InternalOpen (StoreOpenFlags.ReadOnly); - } - - internal bool InternalOpen (StoreOpenFlags flags) - { - if (store != null) - throw new InvalidOperationException (storeAlreadyOpened); - - storeOpenFlags = flags; - switch (storeProvider) { - case StoreProvider.Collection: - store = null; - break; - case StoreProvider.File: - store = null; - break; - case StoreProvider.Memory: - store = new MemoryCertificateStore (storeLocation, storeName, flags); - break; - case StoreProvider.System: - store = null; - break; - default: - throw new NotSupportedException ("Unknown store provider"); - } - return (store != null); - } - - public void Close () - { - store.Close (); - store = null; - storeOpenFlags = StoreOpenFlags.None; - } - - internal bool Compare (byte[] array1, byte[] array2) - { - if ((array1 == null) && (array2 == null)) - return true; - if ((array1 == null) || (array2 == null)) - return false; - if (array1.Length != array2.Length) - return false; - for (int i=0; i < array1.Length; i++) { - if (array1 [i] != array2 [i]) - return false; - } - return true; - } - - public X509CertificateCollection FindCertificateByHash (byte[] certHash) - { - if (certHash == null) - throw new ArgumentNullException ("certHash"); - if (store != null) - throw new InvalidOperationException (storeNotOpened); - - X509CertificateCollection results = new X509CertificateCollection (); - if (store != null) { - X509CertificateCollection certs = store.GetCollection (); - // apply filter - foreach (X509Certificate c in certs) { - if (Compare (c.GetCertHash (), certHash)) - results.Add (c); - } - } - return results; - } - - public X509CertificateCollection FindCertificateByKeyIdentifier (byte[] keyIdentifier) - { - if (keyIdentifier == null) - throw new ArgumentNullException ("keyIdentifier"); - if (store != null) - throw new InvalidOperationException (storeNotOpened); - - X509CertificateCollection results = new X509CertificateCollection (); - if (store != null) { - X509CertificateCollection certs = store.GetCollection (); - // apply filter - foreach (X509Certificate c in certs) { - if (Compare (c.GetKeyIdentifier (), keyIdentifier)) - results.Add (c); - } - } - return results; - } - - public X509CertificateCollection FindCertificateBySubjectName (string subjectstring) - { - if (subjectstring == null) - throw new ArgumentNullException ("subjectstring"); - if (store != null) - throw new InvalidOperationException (storeNotOpened); - - X509CertificateCollection results = new X509CertificateCollection (); - if (store != null) { - X509CertificateCollection certs = store.GetCollection (); - // apply filter - foreach (X509Certificate c in certs) { - if (c.GetName() != subjectstring) - results.Add (c); - } - } - return results; - } - - public X509CertificateCollection FindCertificateBySubjectString (string subjectsubstring) - { - if (subjectsubstring == null) - throw new ArgumentNullException ("subjectsubstring"); - if (store != null) - throw new InvalidOperationException (storeNotOpened); - - X509CertificateCollection results = new X509CertificateCollection (); - if (store != null) { - X509CertificateCollection certs = store.GetCollection (); - // apply filter - foreach (X509Certificate c in certs) { - if (c.GetName ().IndexOf (subjectsubstring) > 0) - results.Add (c); - } - } - return results; - } - - public static X509CertificateStore CurrentUserStore (string storeName) - { - return new X509CertificateStore (StoreProvider.System, StoreLocation.CurrentUser, storeName); - } - - public static X509CertificateStore LocalMachineStore (string storeName) - { - return new X509CertificateStore (StoreProvider.System, StoreLocation.LocalMachine, storeName); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/AsymmetricDecryptionKey.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/AsymmetricDecryptionKey.cs deleted file mode 100644 index dc17000d58d..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/AsymmetricDecryptionKey.cs +++ /dev/null @@ -1,32 +0,0 @@ -// -// AsymmetricDecryptionKey.cs: Handles WS-Security AsymmetricDecryptionKey -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Security.Cryptography; -using System.Web.Services.Protocols; - -namespace Microsoft.Web.Services.Security { - - public sealed class AsymmetricDecryptionKey : DecryptionKey { - - private AsymmetricAlgorithm key; - - public AsymmetricDecryptionKey (AsymmetricAlgorithm key) - { - if (key is System.Security.Cryptography.RSACryptoServiceProvider) - this.key = key; - else - throw new SecurityFault ("not RSACryptoServiceProvider", null); - } - - internal AsymmetricAlgorithm Algorithm { - get { return key; } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/AsymmetricEncryptionKey.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/AsymmetricEncryptionKey.cs deleted file mode 100644 index a790e6c3115..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/AsymmetricEncryptionKey.cs +++ /dev/null @@ -1,31 +0,0 @@ -// -// AsymmetricEncryptionKey.cs: Handles WS-Security AsymmetricEncryptionKey -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Security.Cryptography; - -namespace Microsoft.Web.Services.Security { - - public sealed class AsymmetricEncryptionKey : EncryptionKey { - - private AsymmetricAlgorithm key; - - public AsymmetricEncryptionKey (AsymmetricAlgorithm key) - { - if (key == null) - throw new ArgumentNullException ("key"); - this.key = key; - // TODO ? impact on KeyInfo ? not seen in tests !!! - } - - internal AsymmetricAlgorithm Algorithm { - get { return key; } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/AuthenticationKey.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/AuthenticationKey.cs deleted file mode 100644 index 305e0edaf0f..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/AuthenticationKey.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -// AuthenticationKey.cs: Handles WS-Security AuthenticationKey -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// -// Licensed under MIT X11 (see LICENSE) with this specific addition: -// -// “This source code may incorporate intellectual property owned by Microsoft -// Corporation. Our provision of this source code does not include any licenses -// or any other rights to you under any Microsoft intellectual property. If you -// would like a license from Microsoft (e.g. rebrand, redistribute), you need -// to contact Microsoft directly.” -// - -using System.Security.Cryptography; -// temp -//using System.Security.Cryptography.Xml; - -namespace Microsoft.Web.Services.Security { - - public class AuthenticationKey { - - private AsymmetricAlgorithm asymKey; - private SymmetricAlgorithm symKey; - - public AuthenticationKey (AsymmetricAlgorithm key) - { - asymKey = key; - } - - public AuthenticationKey (SymmetricAlgorithm key) - { - symKey = key; - } - - public bool CheckSignature (SignedXml signedXml) - { - if (asymKey != null) { - return signedXml.CheckSignature (asymKey); - } - else { - HMACSHA1 hmac = new HMACSHA1 (symKey.Key); - return signedXml.CheckSignature (hmac); - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/BinarySecurityToken.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/BinarySecurityToken.cs deleted file mode 100644 index 5396c9df4fa..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/BinarySecurityToken.cs +++ /dev/null @@ -1,128 +0,0 @@ -// -// BinarySecurityToken.cs: Handles WS-Security BinarySecurityToken -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Security.Cryptography.Xml; -using System.Xml; - -using Microsoft.Web.Services.Timestamp; - -namespace Microsoft.Web.Services.Security { - - public abstract class BinarySecurityToken : SecurityToken { - - private const string name = "Base64Binary"; - - private XmlQualifiedName encoding; - internal XmlQualifiedName valueType; - private byte[] rawData; - - public BinarySecurityToken (XmlElement element) : base (element) - { - } - - public BinarySecurityToken (XmlQualifiedName valueType) - { - if (valueType == null) - throw new ArgumentNullException ("valueType"); - - encoding = new XmlQualifiedName (name, WSSecurity.NamespaceURI); - this.valueType = valueType; - } - - public XmlQualifiedName EncodingType { - get { return encoding; } - set { - if (value == null) - throw new ArgumentNullException ("value"); - encoding = value; - } - } - - public virtual byte[] RawData { - get { return rawData; } - set { rawData = value; } - } - - public virtual XmlQualifiedName ValueType { - get { return valueType; } - set { - if (value == null) - throw new ArgumentNullException ("value"); - valueType = value; - } - } - - public override XmlElement GetXml (XmlDocument document) - { - if (document == null) - throw new ArgumentNullException ("document"); - - XmlAttribute nsa = null; - string prefix = document.GetPrefixOfNamespace (valueType.Namespace); - if ((prefix == null) || (prefix == String.Empty)) { - nsa = document.CreateAttribute ("xmlns:vt"); - nsa.InnerText = valueType.Namespace; - prefix = "vt"; - } - - XmlAttribute bstvt = document.CreateAttribute (WSSecurity.AttributeNames.ValueType); - bstvt.InnerText = String.Concat (prefix, ":", valueType.Name); - XmlAttribute bstet = document.CreateAttribute (WSSecurity.AttributeNames.EncodingType); - bstet.InnerText = String.Concat (WSSecurity.Prefix, ":", name); - XmlAttribute bstid = document.CreateAttribute (WSTimestamp.Prefix, WSTimestamp.AttributeNames.Id, WSTimestamp.NamespaceURI); - bstid.InnerText = Id; - - XmlElement bst = document.CreateElement (WSSecurity.Prefix, WSSecurity.ElementNames.BinarySecurityToken, WSSecurity.NamespaceURI); - if (nsa != null) { - bst.Attributes.Append (nsa); - } - bst.Attributes.Append (bstvt); - bst.Attributes.Append (bstet); - bst.Attributes.Append (bstid); - if (rawData != null) { - bst.InnerText = Convert.ToBase64String (rawData); - } - return bst; - } - - public override void LoadXml (XmlElement element) - { - if (element == null) - throw new ArgumentNullException ("element"); - if ((element.LocalName != WSSecurity.ElementNames.BinarySecurityToken) || (element.NamespaceURI != WSSecurity.NamespaceURI)) - throw new System.ArgumentException ("invalid LocalName or NamespaceURI"); - - XmlAttribute xaid = element.Attributes [WSTimestamp.AttributeNames.Id, WSTimestamp.NamespaceURI]; - if (xaid != null) { - Id = xaid.InnerText; - } - - char[] separator = new char[1] { ':' }; - - XmlAttribute xavt = element.Attributes [WSTimestamp.AttributeNames.ValueType]; - if (xavt != null) { - string[] vt = xavt.InnerText.Split (separator); - string ns = element.GetNamespaceOfPrefix (vt [0]); - XmlQualifiedName xqnv = new XmlQualifiedName (vt [1], ns); - ValueType = xqnv; - } - - XmlAttribute xaet = element.Attributes [WSSecurity.AttributeNames.EncodingType]; - if (xaet != null) { - string[] et = xaet.InnerText.Split (separator); - string prefix = element.GetPrefixOfNamespace (WSSecurity.NamespaceURI); - XmlQualifiedName xqne = new XmlQualifiedName (et [1], WSSecurity.NamespaceURI); - EncodingType = xqne; - if ((et [0] == prefix) && (et [1] == name) && (element.InnerText.Length > 0)) - RawData = Convert.FromBase64String (element.InnerText); - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/ChangeLog b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/ChangeLog deleted file mode 100644 index 1434e4f5eb1..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/ChangeLog +++ /dev/null @@ -1,122 +0,0 @@ -2004-03-30 Sebastien Pouliot - - * XmlDsigExcC14NTransform.cs: Updated to match current System.Security - XmlDSigC14NTransform. - * XmlDSigExcC14NWithCommentsTransform.cs: Updated to match current - System.Security XmlDSigC14NWithCommentsTransform. - -2003-11-06 Sebastien Pouliot - - * BinarySecurityToken.cs: Oops unit tests were failing on this one. Also implemented RawData (it's actually used - see updated unit tests). - * DecryptionKeyProvider.cs: Basic implementation based on code I (wrongly) put in EncryptedKey. - * EncrypedKey.cs: Now calls DecryptionKeyProvider. - * SignatureOptions.cs: Updated for WSE2 compatibility (removed IncludePath*). - -2003-10-31 Sebastien Pouliot - - * IReplayCache.cs: New. Interface for ReplayCache. - * OASIS.cs: New. Implementation for OASIS WS-Security (prefix "wsse"). - * ReplayCacheManager.cs: New. Stub, with MonoTODO, for WSE2. - * SaML.cs: New. SAML description (prefix/ns) for WS-Security. - * SecurityTokenCache.cs: New. Stub, with MonoTODO, for WSE2. - * SecurityTokenReferenceType.cs: New. Stub, with MonoTODO, for WSE2. - * SMSecurity.cs: New. Implementation for WS-Security ("wsse" and - "http://schemas.xmlsoap.org/ws/2002/12/secext"). - * SMSecurityBase.cs: New. Abstract class to retrieve Prefix and Namespace. - * SynchronizedSecurityTokenCache.cs: New. Stub, with MonoTODO, for WSE2. - * WSEReplayCache.cs: New. Stub, with MonoTODO, for WSE2. - * Xmltok.cs: New. WS-Security Profile for XML-based Tokens (descriptions). - * XrML.cs: New. eXtensible rights Markup Language descriptions for WS-Security. - -2003-10-26 Sebastien Pouliot - - * AsymmetricDecryptionKey.cs: Added internal property to the - asymmetric keypair. - * EncryptedData.cs: Added minimal support for decryption. - * EncryptedKey.cs: Added minimal support for decryption. - * KeyIdentifier.cs: Added internal properties to get access to - X509Certificate, DecryptionKey and EncryptionKey from the key identifier. - * Security.cs: Implemented support for EncryptedData in LoadXml and - implemented part of GetXml. - * SecurityInputFilter.cs: Now process incoming security headers (but - not ExtendedSecurity). - * SecurityOutputFilter.cs: Now uses Security class to Load/Get the - security headers (code moved into Security.cs). - -2003-10-25 Sebastien Pouliot - - * EncryptedData.cs: Can now encrypt SOAP body message (no decrypt yet). - * EncryptedKey.cs: Updated symmetric key creation. - * IMutableSecurityToken.cs: New. Interface in WSE2 to clone SecurityTokens. - * ReferenceList.cs: Completed implementation. - * Security.cs: Fixed Elements and Tokens collections that weren't always created. - * SecurityOutputFilter: Added support for EncryptedData. - * SecurityToken.cs: Private member IPrincipal is now only defined for WSE2 (removed warning). - * UsernameToken.cs: Updated for WSE2. - * X509SecurityToken.cs: Added SecurityTokenReference/KeyIdentifier in KeyInfo. - -2003-10-25 Todd Berman - - * Nonce.cs: WSE2 Compilation fix - -2003-10-24 Sebastien Pouliot - - * AsymmetricDecryptionKey.cs: Change to license and line-ends. - * PasswordOption.cs: Inversed SendNone and SendHashed because they had - the wrong values (corcompare) - * Signature.cs: Stub completed. - * SignedXml.cs: Added interface IXmlElement and missing virtual to - CheckSignature (corcompare) - * XmlSignature.cs: Removed license from header. - -2003-10-22 Sebastien Pouliot - - * KeyIdentifier.cs: Completed implementation. - * Nonce.cs: Added WSE2 support so I could include the unit tests. - * SecurityTokenReference.cs: Completed implementation. - -2003-10-20 Sebastien Pouliot - - * AsymmetricEncryptionKey.cs: Added internal property to get the AsymmetricAlgorithm object. - * EncryptedKey.cs: Almost complete (still lacking LoadXml). - * SymmetricEncryptionKey.cs: Added internal property to get the SymmetricAlgorithm object. - -2003-10-18 Sebastien Pouliot - - * BinarySecurityToken.cs: Added support for GetXml/LoadXml - * SecurityToken.cs: Better support for WSE2 - * X509SecurityToken.cs: Implemented most of the TODO. - -2003-10-05 Sebastien Pouliot - - * SecurityOutputFilter.cs: Added missing "1" to soap:mustUnderstand - -2003-10-04 Sebastien Pouliot - - * Nonce.cs: Added new internal constructor. - * Security.cs: Fixed Tokens. - * SecurityOutputFilter.cs: Implemented support for Tokens. - * UsernameToken.cs: Completed GetXml/LoadXml. Still missing - authentication/signature key. - -2003-09-06 Sebastien Pouliot - - * EncryptedKey.cs: Fixed typo. - * Security.cs: Fixed compilation issues. - * SignedXml.cs: Fixed compilation issues. - * SignedXmlSignature.cs: Copied from System.Security assembly (where - it is known as Signature.cs) as MS duplicate the class (in WSE) to - fixed some issues. - * XmlSignature.cs: Added more missing string used in System.Security. - -2003-09-04 Sebastien Pouliot - - * Reference.cs: Copied from System.Security assembly as MS duplicate - the class (in WSE) to fixed some issues. - * SignedInfo.cs: Copied from System.Security assembly as MS duplicate - the class (in WSE) to fixed some issues. - * SignedXml.cs: Copied from System.Security assembly as MS duplicate - the class (in WSE) to fixed some issues. - * TransformChain.cs: Copied from System.Security assembly as MS duplicate - the class (in WSE) to fixed some issues. - * XmlSignature.cs: Added missing string used in System.Security. diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/DecryptionKey.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/DecryptionKey.cs deleted file mode 100644 index dd19773407d..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/DecryptionKey.cs +++ /dev/null @@ -1,33 +0,0 @@ -// -// DecryptionKey.cs: Handles WS-Security DecryptionKey -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// -// Licensed under MIT X11 (see LICENSE) with this specific addition: -// -// “This source code may incorporate intellectual property owned by Microsoft -// Corporation. Our provision of this source code does not include any licenses -// or any other rights to you under any Microsoft intellectual property. If you -// would like a license from Microsoft (e.g. rebrand, redistribute), you need -// to contact Microsoft directly.” -// - -using System; - -namespace Microsoft.Web.Services.Security { - - public abstract class DecryptionKey { - - private string name; - - protected DecryptionKey () {} - - public string Name { - get { return name; } - set { name = value; } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/DecryptionKeyProvider.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/DecryptionKeyProvider.cs deleted file mode 100644 index 28cae85a142..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/DecryptionKeyProvider.cs +++ /dev/null @@ -1,48 +0,0 @@ -// -// DecryptionKeyProvider.cs: Decryption Key Provider -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Security.Cryptography.Xml; - -namespace Microsoft.Web.Services.Security { - -#if !WSE1 - [ObsoleteAttribute ("Use SecurityTokenManager instead", true)] -#endif - public class DecryptionKeyProvider : IDecryptionKeyProvider { - - public DecryptionKeyProvider () {} - - public virtual DecryptionKey GetDecryptionKey (string algorithmUri, KeyInfo keyInfo) - { - if (keyInfo == null) - throw new ArgumentNullException ("keyInfo"); - - switch (algorithmUri) { - case XmlEncryption.AlgorithmURI.RSA15: - // permission to continue further - break; - default: // including null - return null; - } - - foreach (KeyInfoClause kic in keyInfo) { - if (kic is KeyInfoNode) { - KeyInfoNode kin = (kic as KeyInfoNode); - if ((kin != null) && (kin.Value.LocalName == WSSecurity.ElementNames.SecurityTokenReference)) { - SecurityTokenReference str = new SecurityTokenReference (kin.Value); - if (str.KeyIdentifier != null) - return str.KeyIdentifier.DecryptionKey; - } - } - } - return null; - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/EncryptedData.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/EncryptedData.cs deleted file mode 100644 index 2d864101281..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/EncryptedData.cs +++ /dev/null @@ -1,267 +0,0 @@ -// -// EncryptedData.cs: Handles WS-Security EncryptedData -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Security.Cryptography; -using System.Security.Cryptography.Xml; -using System.Text; -using System.Xml; -using Microsoft.Web.Services.Timestamp; -#if !WSE1 -using Microsoft.Web.Services.Xml; -#endif - -namespace Microsoft.Web.Services.Security { - - public sealed class EncryptedData : ISecurityElement, IXmlElement { - - private SecurityToken token; - private EncryptionKey encryptionKey; - private EncryptedKey encryptedKey; - private string reference; - private string type; - private KeyInfo ki; - private XmlElement target; - - public EncryptedData (EncryptionKey key) : this (key, null) {} - - public EncryptedData (SecurityToken token) : this (token, null) {} - - public EncryptedData (XmlElement element) - { - LoadXml (element); - } - - public EncryptedData (EncryptionKey key, string reference) - { - this.encryptionKey = key; - this.reference = reference; - } - - [MonoTODO] - public EncryptedData (SecurityToken token, string reference) - { -// to be compatible with WSE1 -// if (token == null) -// throw new ArgumentNullException ("token"); - if (!token.SupportsDataEncryption) - throw new NotSupportedException ("!SupportsDataEncryption"); - if ((reference != null) && (reference [0] != '#')) - throw new ArgumentException ("reference must start with a #"); - - this.reference = reference; - this.token = token; - encryptionKey = token.EncryptionKey; - - AsymmetricEncryptionKey aek = (token.EncryptionKey as AsymmetricEncryptionKey); - if (aek != null) { - encryptedKey = new EncryptedKey (aek); - } -#if !WSE1 - SymmetricEncryptionKey sek = (token.EncryptionKey as SymmetricEncryptionKey); - if (sek != null) { - encryptedKey = new EncryptedKey (sek); - } -#endif - type = XmlEncryption.TypeURI.Content; - } - - public EncryptedData (XmlElement element, EncryptedKey encryptedKey) - { - this.encryptedKey = encryptedKey; - LoadXml (element); - } - - public EncryptedKey EncryptedKey { - get { return encryptedKey; } - } - - public string EncryptionMethod { - get { return encryptedKey.SessionAlgorithmURI; } - } - - public KeyInfo KeyInfo { - get { return ki; } - } - - public string Reference { - get { return reference; } - } - - public XmlElement TargetElement { - get { return target; } - } - - [MonoTODO] - public string Type { - get { return type; } - set { - if (value == null) - throw new ArgumentNullException ("value"); - switch (value) { - case XmlEncryption.TypeURI.Content: - type = value; - break; - case XmlEncryption.TypeURI.Element: - type = value; - break; - default: - throw new ArgumentException ("bad Type"); - } - } - } - - [MonoTODO("incomplete - only works for soap:Body")] - public XmlElement Decrypt () - { - if (target == null) - throw new InvalidOperationException ("no document to decrypt"); - if ((encryptedKey == null) || (encryptedKey.Key == null)) - throw new InvalidOperationException ("no key to decrypt with"); - - string algo = null; - XmlNodeList xnl = target.GetElementsByTagName (XmlEncryption.ElementNames.EncryptionMethod, XmlEncryption.NamespaceURI); - if ((xnl != null) && (xnl.Count > 0)) { - XmlAttribute ema = xnl [0].Attributes [XmlEncryption.AttributeNames.Algorithm]; - if (ema != null) - algo = ema.InnerText; - } - if (algo != encryptedKey.SessionAlgorithmURI) - throw new Exception ("TODO ???"); - - byte[] encdata = null; - xnl = target.GetElementsByTagName (XmlEncryption.ElementNames.CipherData, XmlEncryption.NamespaceURI); - if ((xnl != null) && (xnl.Count > 0)) { - XmlElement cd = (XmlElement) xnl [0]; - foreach (XmlNode xn in cd.ChildNodes) { - if ((xn.LocalName == XmlEncryption.ElementNames.CipherValue) && (xn.NamespaceURI == XmlEncryption.NamespaceURI)) { - encdata = Convert.FromBase64String (xn.InnerText); - } - } - } - - // get the IV in front of the encrypted data - int ivLength = encryptedKey.Key.Algorithm.IV.Length; - byte[] iv = new byte [ivLength]; - Buffer.BlockCopy (encdata, 0, iv, 0, ivLength); - encryptedKey.Key.Algorithm.IV = iv; - - ICryptoTransform ct = encryptedKey.Key.Algorithm.CreateDecryptor (); - byte[] decdata = ct.TransformFinalBlock (encdata, ivLength, encdata.Length - ivLength); - string xml = Encoding.UTF8.GetString (decdata); - target.ParentNode.InnerXml = xml; - - return target; - } - - // copied from SoapEnvelope.cs to avoid creating the object - private XmlElement GetBody (XmlDocument message) - { - XmlNodeList xnl = message.GetElementsByTagName (Soap.ElementNames.Body, Soap.NamespaceURI); - return (XmlElement) xnl [0]; - } - - [MonoTODO("incomplete - only works for soap:Body")] - public void Encrypt (XmlDocument message) - { - if (message == null) - throw new ArgumentNullException ("message"); - - if (reference != null) { - // TODO - } - else { - target = GetBody (message); - } - - // now the XML encryption stuff - if (target != null) { - SymmetricAlgorithm sa = encryptedKey.Key.Algorithm; - // IMPORTANT: each encryption MUST have it's own IV ! - sa.GenerateIV (); - ICryptoTransform ct = sa.CreateEncryptor (); - byte[] toencrypt = Encoding.UTF8.GetBytes (target.InnerXml); - byte[] encrypted = ct.TransformFinalBlock (toencrypt, 0, toencrypt.Length); - // it's our responsability to zeroize our copy of the unencrypted data - Array.Clear (toencrypt, 0, toencrypt.Length); - - XmlAttribute ema = message.CreateAttribute ("Algorithm"); - ema.InnerText = encryptedKey.SessionAlgorithmURI; - XmlElement em = message.CreateElement (XmlEncryption.Prefix, XmlEncryption.ElementNames.EncryptionMethod, XmlEncryption.NamespaceURI); - em.Attributes.Append (ema); - - XmlElement cv = message.CreateElement (XmlEncryption.Prefix, XmlEncryption.ElementNames.CipherValue, XmlEncryption.NamespaceURI); - byte[] data = new byte [sa.IV.Length + encrypted.Length]; - Buffer.BlockCopy (sa.IV, 0, data, 0, sa.IV.Length); - Buffer.BlockCopy (encrypted, 0, data, sa.IV.Length, encrypted.Length); - cv.InnerText = Convert.ToBase64String (data); - XmlElement cd = message.CreateElement (XmlEncryption.Prefix, XmlEncryption.ElementNames.CipherData, XmlEncryption.NamespaceURI); - cd.AppendChild (cv); - - XmlAttribute edid = message.CreateAttribute ("Id"); - edid.InnerText = "EncryptedContent-" + Guid.NewGuid ().ToString (); - XmlAttribute edt = message.CreateAttribute ("Type"); - edt.InnerText = XmlEncryption.TypeURI.Content; - - XmlElement ed = message.CreateElement (XmlEncryption.Prefix, XmlEncryption.ElementNames.EncryptedData, XmlEncryption.NamespaceURI); - ed.Attributes.Append (edid); - ed.Attributes.Append (edt); - ed.AppendChild (em); - ed.AppendChild (cd); - target.RemoveAll (); - target.AppendChild (ed); - // no sure why but encryption make this Id appear in WSE so... - XmlAttribute id = message.CreateAttribute (WSTimestamp.Prefix, WSTimestamp.AttributeNames.Id, WSTimestamp.NamespaceURI); - id.InnerText = "Id-" + Guid.NewGuid ().ToString (); - target.Attributes.Append (id); - - encryptedKey.ReferenceList.Add (edid.InnerText); - } - } - - [MonoTODO("incomplete - minimal implementation")] - public XmlElement GetXml (XmlDocument document) - { - if (document == null) - throw new ArgumentNullException ("document"); - - XmlAttribute ema = document.CreateAttribute (XmlEncryption.AttributeNames.Algorithm); - ema.InnerText = encryptedKey.SessionAlgorithmURI; - - XmlElement em = document.CreateElement (XmlEncryption.Prefix, XmlEncryption.ElementNames.EncryptionMethod, XmlEncryption.NamespaceURI); - em.Attributes.Append (ema); - - XmlAttribute edi = document.CreateAttribute (XmlEncryption.AttributeNames.Id); - XmlAttribute edt = document.CreateAttribute (XmlEncryption.AttributeNames.Type); - edt.InnerText = XmlEncryption.TypeURI.Content; - - XmlElement ed = document.CreateElement (XmlEncryption.Prefix, XmlEncryption.ElementNames.EncryptedData, XmlEncryption.NamespaceURI); - ed.Attributes.Append (edi); - ed.Attributes.Append (edt); - ed.AppendChild (em); - return ed; - } - - [MonoTODO] - public void LoadXml (XmlElement element) - { - if (element == null) - throw new ArgumentNullException ("element"); - if ((element.LocalName != XmlEncryption.ElementNames.EncryptedData) || (element.NamespaceURI != XmlEncryption.NamespaceURI)) - throw new ArgumentException ("invalid LocalName or NamespaceURI"); - - XmlAttribute xa = element.Attributes [XmlEncryption.AttributeNames.Type]; - if (xa != null) { - Type = xa.InnerText; - } - - target = element; - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/EncryptedKey.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/EncryptedKey.cs deleted file mode 100644 index b300151aacf..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/EncryptedKey.cs +++ /dev/null @@ -1,236 +0,0 @@ -// -// EncryptedKey.cs: Handles WS-Security EncryptedKey -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Security.Cryptography; -using System.Security.Cryptography.Xml; -using System.Xml; -#if !WSE1 -using Microsoft.Web.Services.Xml; -#endif - -namespace Microsoft.Web.Services.Security { - - public class EncryptedKey : IXmlElement { - - private DecryptionKey dk; - private EncryptionKey ek; - private ReferenceList list; - private string keyex; - private string session; - private SymmetricEncryptionKey key; - private byte[] decdata; - - internal EncryptedKey () - { - list = new ReferenceList (); - keyex = XmlEncryption.AlgorithmURI.RSA15; - session = XmlEncryption.AlgorithmURI.TripleDES; - } - -#if WSE1 - public EncryptedKey (AsymmetricEncryptionKey key) : this () -#else - [Obsolete ("since WSE2 TP")] - public EncryptedKey (EncryptionKey key) : this () -#endif - { - if (key == null) - throw new ArgumentNullException ("key"); - if ((key.KeyInfo == null) || (key.KeyInfo.Count < 1)) - throw new ArgumentException ("no KeyInfo"); - ek = key; - } - - public EncryptedKey (XmlElement element) : this () - { - LoadXml (element); - } - - public string EncryptionMethod { - get { return keyex; } - } - - public KeyInfo KeyInfo { - get { return ek.KeyInfo; } - } - - public ReferenceList ReferenceList { - get { return list; } - } - - public string SessionAlgorithmURI { - get { return session; } - set { - switch (value) { - case null: - throw new ArgumentNullException ("value"); - case XmlEncryption.AlgorithmURI.AES128: - case XmlEncryption.AlgorithmURI.AES192: - case XmlEncryption.AlgorithmURI.AES256: - case XmlEncryption.AlgorithmURI.TripleDES: - if (session != value) - key = null; - session = value; - break; - default: - throw new SecurityFault ("unsupported algorithm", null); - } - } - } - - // note: no default key size is assumed because they could change in the future - private SymmetricAlgorithm GetSymmetricAlgorithm (string algorithmURI) - { - SymmetricAlgorithm sa = null; - switch (algorithmURI) { - // Reference: http://www.w3.org/2001/04/xmlenc#aes128-cbc [REQUIRED] - case XmlEncryption.AlgorithmURI.AES128: - sa = Rijndael.Create (); - sa.KeySize = 128; - break; - // Reference: http://www.w3.org/2001/04/xmlenc#aes192-cbc [OPTIONAL] - case XmlEncryption.AlgorithmURI.AES192: - sa = Rijndael.Create (); - sa.KeySize = 192; - break; - // Reference: http://www.w3.org/2001/04/xmlenc#aes256-cbc [REQUIRED] - case XmlEncryption.AlgorithmURI.AES256: - sa = Rijndael.Create (); - sa.KeySize = 256; - break; - // Reference: http://www.w3.org/2001/04/xmlenc#tripledes-cbc [REQUIRED] - case XmlEncryption.AlgorithmURI.TripleDES: - sa = TripleDES.Create (); - sa.KeySize = 192; - break; - default: - return null; - } - // for decryption we must use the decrypted key (from the keyexchange) - if ((sa != null) && (decdata != null)) - sa.Key = decdata; - return sa; - } - - internal SymmetricEncryptionKey Key { - get { - if (key == null) { - key = new SymmetricEncryptionKey (GetSymmetricAlgorithm (session)); - } - return key; - } - } - - [MonoTODO("incomplete")] - public XmlElement GetXml (XmlDocument document) - { - if (document == null) - throw new ArgumentNullException ("document"); - - XmlAttribute ema = document.CreateAttribute (XmlEncryption.AttributeNames.Algorithm); - ema.InnerText = keyex; - XmlElement em = document.CreateElement (XmlEncryption.Prefix, XmlEncryption.ElementNames.EncryptionMethod, XmlEncryption.NamespaceURI); - em.Attributes.Append (ema); - - XmlElement ki = KeyInfo.GetXml (); - - AsymmetricKeyExchangeFormatter fmt = null; - AsymmetricEncryptionKey aek = (ek as AsymmetricEncryptionKey); - switch (keyex) { - case XmlEncryption.AlgorithmURI.RSA15: - fmt = new RSAPKCS1KeyExchangeFormatter (aek.Algorithm); - break; - case XmlEncryption.AlgorithmURI.RSAOAEP: - fmt = new RSAOAEPKeyExchangeFormatter (aek.Algorithm); - // TODO: parameters - break; - default: - throw new SecurityFault ("unknown key exchange algorithm", null); - } - byte[] enckey = fmt.CreateKeyExchange (Key.Algorithm.Key); - - XmlElement cv = document.CreateElement (XmlEncryption.Prefix, XmlEncryption.ElementNames.CipherValue, XmlEncryption.NamespaceURI); - cv.InnerText = Convert.ToBase64String (enckey); - XmlElement cd = document.CreateElement (XmlEncryption.Prefix, XmlEncryption.ElementNames.CipherData, XmlEncryption.NamespaceURI); - cd.AppendChild (cv); - - XmlElement rl = list.GetXml (document); - - XmlAttribute ekt = document.CreateAttribute (XmlEncryption.AttributeNames.Type); - ekt.InnerText = XmlEncryption.TypeURI.EncryptedKey; - XmlElement result = document.CreateElement (XmlEncryption.Prefix, XmlEncryption.ElementNames.EncryptedKey, XmlEncryption.NamespaceURI); - result.Attributes.Append (ekt); - result.AppendChild (em); - result.AppendChild (document.ImportNode (ki, true)); - result.AppendChild (cd); - result.AppendChild (rl); - return result; - } - - [MonoTODO("incomplete")] - public void LoadXml (XmlElement element) - { - if (element == null) - throw new ArgumentNullException ("element"); - if ((element.LocalName != XmlEncryption.ElementNames.EncryptedKey) || (element.NamespaceURI != XmlEncryption.NamespaceURI)) - throw new System.ArgumentException ("invalid LocalName or NamespaceURI"); - - XmlNodeList xnl = element.GetElementsByTagName (XmlEncryption.ElementNames.EncryptionMethod, XmlEncryption.NamespaceURI); - if ((xnl != null) && (xnl.Count > 0)) { - XmlAttribute ema = xnl [0].Attributes [XmlEncryption.AttributeNames.Algorithm]; - if (ema != null) - keyex = ema.InnerText; - } - - xnl = element.GetElementsByTagName (XmlSignature.ElementNames.KeyInfo, XmlSignature.NamespaceURI); - if ((xnl != null) && (xnl.Count > 0)) { - KeyInfo ki = new KeyInfo (); - ki.LoadXml ((XmlElement) xnl [0]); -#if WSE1 - DecryptionKeyProvider dkp = new DecryptionKeyProvider (); - dk = dkp.GetDecryptionKey (keyex, ki); -#else - // TODO -#endif - } - - byte[] encdata = null; - xnl = element.GetElementsByTagName (XmlEncryption.ElementNames.CipherData, XmlEncryption.NamespaceURI); - if ((xnl != null) && (xnl.Count > 0)) { - XmlElement cd = (XmlElement) xnl [0]; - foreach (XmlNode xn in cd.ChildNodes) { - if ((xn.LocalName == XmlEncryption.ElementNames.CipherValue) && (xn.NamespaceURI == XmlEncryption.NamespaceURI)) { - encdata = Convert.FromBase64String (xn.InnerText); - } - } - } - - xnl = element.GetElementsByTagName (XmlEncryption.ElementNames.ReferenceList, XmlEncryption.NamespaceURI); - if ((xnl != null) && (xnl.Count > 0)) { - list.LoadXml ((XmlElement) xnl [0]); - } - - AsymmetricDecryptionKey adk = (dk as AsymmetricDecryptionKey); - if ((adk != null) && (encdata != null)) { - AsymmetricKeyExchangeDeformatter def = null; - switch (keyex) { - case XmlEncryption.AlgorithmURI.RSA15: - def = new RSAPKCS1KeyExchangeDeformatter (adk.Algorithm); - decdata = def.DecryptKeyExchange (encdata); - break; - case XmlEncryption.AlgorithmURI.RSAOAEP: - // TODO - break; - } - } - // TODO - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/EncryptionKey.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/EncryptionKey.cs deleted file mode 100644 index 90fdc768378..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/EncryptionKey.cs +++ /dev/null @@ -1,36 +0,0 @@ -// -// EncryptionKey.cs: -// Abstract class for AsymmetricEncryptionKey and SymmetricEncryptionKey -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// -// Licensed under MIT X11 (see LICENSE) with this specific addition: -// -// “This source code may incorporate intellectual property owned by Microsoft -// Corporation. Our provision of this source code does not include any licenses -// or any other rights to you under any Microsoft intellectual property. If you -// would like a license from Microsoft (e.g. rebrand, redistribute), you need -// to contact Microsoft directly.” -// - -using System.Security.Cryptography.Xml; - -namespace Microsoft.Web.Services.Security { - - public abstract class EncryptionKey { - - private KeyInfo ki; - - public EncryptionKey () - { - ki = new KeyInfo (); - } - - public KeyInfo KeyInfo { - get { return ki; } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/IDecryptionKeyProvider.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/IDecryptionKeyProvider.cs deleted file mode 100644 index 1a93b5da1f1..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/IDecryptionKeyProvider.cs +++ /dev/null @@ -1,28 +0,0 @@ -// -// IDecryptionKeyProvider.cs: -// Defines IDecryptionKeyProvider interface -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// -// Licensed under MIT X11 (see LICENSE) with this specific addition: -// -// “This source code may incorporate intellectual property owned by Microsoft -// Corporation. Our provision of this source code does not include any licenses -// or any other rights to you under any Microsoft intellectual property. If you -// would like a license from Microsoft (e.g. rebrand, redistribute), you need -// to contact Microsoft directly.” -// - -using System.Security.Cryptography.Xml; - -namespace Microsoft.Web.Services.Security { - - public interface IDecryptionKeyProvider { - - DecryptionKey GetDecryptionKey (string algorithmUri, KeyInfo keyInfo); - - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/IMutableSecurityToken.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/IMutableSecurityToken.cs deleted file mode 100644 index ef706051cf5..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/IMutableSecurityToken.cs +++ /dev/null @@ -1,19 +0,0 @@ -// -// IMutableSecurityToken.cs - IMutableSecurityToken interface -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services.Security { - - public interface IMutableSecurityToken { - - SecurityToken Clone(); - - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/IPasswordProvider.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/IPasswordProvider.cs deleted file mode 100644 index 9f15e854111..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/IPasswordProvider.cs +++ /dev/null @@ -1,26 +0,0 @@ -// -// IPasswordProvider.cs: -// Defines IPasswordProvider interface -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// -// Licensed under MIT X11 (see LICENSE) with this specific addition: -// -// “This source code may incorporate intellectual property owned by Microsoft -// Corporation. Our provision of this source code does not include any licenses -// or any other rights to you under any Microsoft intellectual property. If you -// would like a license from Microsoft (e.g. rebrand, redistribute), you need -// to contact Microsoft directly.” -// - -namespace Microsoft.Web.Services.Security { - - public interface IPasswordProvider { - - string GetPassword (UsernameToken token); - - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/IReplayCache.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/IReplayCache.cs deleted file mode 100644 index 0d061e30d61..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/IReplayCache.cs +++ /dev/null @@ -1,18 +0,0 @@ -// -// IReplayCache.cs - ReplayCache interface -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services.Security { - - public interface IReplayCache { - - void ProcessMessage (SoapEnvelope envelope); - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/ISecurityElement.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/ISecurityElement.cs deleted file mode 100644 index db214059912..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/ISecurityElement.cs +++ /dev/null @@ -1,24 +0,0 @@ -// -// ISecurityElement.cs: -// Defines ISecurityElement interface -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// -// Licensed under MIT X11 (see LICENSE) with this specific addition: -// -// “This source code may incorporate intellectual property owned by Microsoft -// Corporation. Our provision of this source code does not include any licenses -// or any other rights to you under any Microsoft intellectual property. If you -// would like a license from Microsoft (e.g. rebrand, redistribute), you need -// to contact Microsoft directly.” -// - -namespace Microsoft.Web.Services.Security { - - // complete! - public interface ISecurityElement {} - -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/KeyIdentifier.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/KeyIdentifier.cs deleted file mode 100644 index 984cfc8f6e0..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/KeyIdentifier.cs +++ /dev/null @@ -1,149 +0,0 @@ -// -// KeyIdentifier.cs: Handles WS-Security KeyIdentifier -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Security.Cryptography.Xml; -using System.Xml; -using Microsoft.Web.Services; -using Microsoft.Web.Services.Security.X509; -#if !WSE1 -using Microsoft.Web.Services.Xml; -#endif - -namespace Microsoft.Web.Services.Security { - - public class KeyIdentifier : IXmlElement { - - private byte[] kivalue; - private XmlQualifiedName vtype; - static private char[] separator = { ':' }; - - public KeyIdentifier (byte[] identifier) - { - if (identifier == null) - throw new ArgumentNullException ("identifier"); - kivalue = (byte[]) identifier.Clone (); - } - - public KeyIdentifier (XmlElement element) - { - LoadXml (element); - } - - public KeyIdentifier (byte[] identifier, XmlQualifiedName valueType) - { - if (identifier == null) - throw new ArgumentNullException ("identifier"); - kivalue = (byte[]) identifier.Clone (); - vtype = valueType; - } - - public byte[] Value { - get { return (byte[]) kivalue.Clone (); } - set { - if (value == null) - throw new ArgumentNullException ("value"); - kivalue = value; - } - } - - public XmlQualifiedName ValueType { - get { return vtype; } - set { vtype = value; } - } - - public XmlElement GetXml (XmlDocument document) - { - if (document == null) - throw new ArgumentNullException ("document"); - - XmlElement ki = document.CreateElement (WSSecurity.Prefix, WSSecurity.ElementNames.KeyIdentifier, WSSecurity.NamespaceURI); - ki.InnerText = Convert.ToBase64String (kivalue); - if ((vtype != null) && (!vtype.IsEmpty)) { - string ns = ki.GetPrefixOfNamespace (vtype.Namespace); - if ((ns == null) || (ns == String.Empty)) { - ns = "vt"; - XmlAttribute nsa = document.CreateAttribute ("xmlns:vt"); - nsa.InnerText = vtype.Namespace; - ki.Attributes.Append (nsa); - } - XmlAttribute vt = document.CreateAttribute (WSSecurity.AttributeNames.ValueType); - vt.InnerText = String.Concat (ns, ":", vtype.Name); - ki.Attributes.Append (vt); - } - return ki; - } - - public void LoadXml (XmlElement element) - { - if (element == null) - throw new ArgumentNullException ("element"); - - if ((element.LocalName != WSSecurity.ElementNames.KeyIdentifier) || (element.NamespaceURI != WSSecurity.NamespaceURI)) - throw new ArgumentException ("invalid LocalName or NamespaceURI"); - - try { - kivalue = Convert.FromBase64String (element.InnerText); - } - catch { - kivalue = null; - } - - XmlAttribute vt = element.Attributes [WSSecurity.AttributeNames.ValueType]; - if (vt != null) { - string[] nsvt = vt.InnerText.Split (separator); - switch (nsvt.Length) { - case 2: - string ns = element.GetNamespaceOfPrefix (nsvt [0]); - vtype = new XmlQualifiedName (nsvt [1], ns); - break; - default: - throw new SecurityFormatException ("missing namespace"); - } - } - } - - internal X509Certificate Certificate { - get { - if ((vtype.Name == "X509v3") && (vtype.Namespace == WSSecurity.NamespaceURI)) { - // TODO - use microsoft.web.service config in .exe.config for store location - X509CertificateStore store = X509CertificateStore.LocalMachineStore (X509CertificateStore.MyStore); - if (store.OpenRead ()) { - X509CertificateCollection coll = store.FindCertificateByKeyIdentifier (kivalue); - if ((coll != null) && (coll.Count > 0)) { - return coll [0]; - } - store.Close (); - } - } - return null; - } - } - - internal DecryptionKey DecryptionKey { - get { - X509Certificate x509 = Certificate; - if (x509 != null) { - return new AsymmetricDecryptionKey (x509.Key); - } - return null; - } - } - - internal EncryptionKey EncryptionKey { - get { - X509Certificate x509 = Certificate; - if (x509 != null) { - return new AsymmetricEncryptionKey (x509.PublicKey); - } - return null; - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/Nonce.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/Nonce.cs deleted file mode 100644 index f9fafc21972..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/Nonce.cs +++ /dev/null @@ -1,89 +0,0 @@ -// -// Nonce.cs: Handles WS-Security Nonce -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Security.Cryptography; -using System.Xml; -using Microsoft.Web.Services; -#if !WSE1 -using Microsoft.Web.Services.Xml; -#endif - -namespace Microsoft.Web.Services.Security { - - // References: - // a. Web Services Security Addendum, Version 1.0, August 18, 2002 - // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnglobspec/html/ws-security.asp - // b. Understanding WS-Security - // http://msdn.microsoft.com/webservices/building/frameworkandstudio/default.aspx?pull=/library/en-us/dnwssecur/html/understw.asp - - public class Nonce : IXmlElement { - - private byte[] nonce; - -#if WSE1 - internal Nonce () : this (16) {} - internal Nonce (int size) -#else - //Compilation fix, spoulit please check the authenticity of this. - public Nonce () : this (16) {} - public Nonce (int size) -#endif - { - nonce = new byte [size]; // default is 16 see reference b. - if (size > 0) { - RandomNumberGenerator rng = RandomNumberGenerator.Create (); - rng.GetBytes (nonce); - } - } - -#if WSE1 - internal Nonce (XmlElement element) -#else - public Nonce (XmlElement element) -#endif - { - LoadXml (element); - } - - public string Value { - get { return Convert.ToBase64String (nonce); } - } - - public byte[] GetValueBytes () - { - return (byte[]) nonce.Clone (); - } - - public XmlElement GetXml (XmlDocument document) - { - if (document == null) - throw new ArgumentNullException ("document"); - // much cleaner than using StringBuilder! - XmlElement xel = document.CreateElement (WSSecurity.Prefix, WSSecurity.ElementNames.Nonce, WSSecurity.NamespaceURI); - xel.InnerText = Convert.ToBase64String (nonce); - return xel; - } - - public void LoadXml (XmlElement element) - { - if (element == null) - throw new ArgumentNullException ("element"); - if ((element.LocalName != WSSecurity.ElementNames.Nonce) || (element.NamespaceURI != WSSecurity.NamespaceURI)) - throw new ArgumentException ("invalid LocalName or NamespaceURI"); - - XmlAttribute xa = element.Attributes [WSSecurity.AttributeNames.EncodingType, WSSecurity.NamespaceURI]; - if ((xa == null) || (xa.Value == "Base64Binary")) { - nonce = Convert.FromBase64String (element.InnerText); - } - else - throw new NotSupportedException (xa.Value); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/OASIS.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/OASIS.cs deleted file mode 100644 index 64a4c3258a6..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/OASIS.cs +++ /dev/null @@ -1,33 +0,0 @@ -// -// OASIS.cs - OASIS -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services.Security { - - public class OASIS : SMSecurityBase { - - private string _namespace; - - public const string Prefix = "wsse"; - - public OASIS (string ns) - { - _namespace = ns; - } - - public override string NamespaceURIValue { - get { return _namespace; } - } - - public override string PrefixValue { - get { return Prefix; } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/PasswordOption.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/PasswordOption.cs deleted file mode 100644 index 1df577802b9..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/PasswordOption.cs +++ /dev/null @@ -1,20 +0,0 @@ -// -// PasswordOption.cs: Handles WS-Security PasswordOption -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services.Security { - - [Serializable] - public enum PasswordOption { - SendNone, - SendHashed, - SendPlainText - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/Reference.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/Reference.cs deleted file mode 100644 index b7ad7d74583..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/Reference.cs +++ /dev/null @@ -1,191 +0,0 @@ -// -// Reference.cs - Reference implementation for XML Signature -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.IO; -using System.Security.Cryptography; -using System.Xml; - -#if (WSE1 || WSE2) -using System.Security.Cryptography.Xml; - -namespace Microsoft.Web.Services.Security { -#else -namespace System.Security.Cryptography.Xml { -#endif - // http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/Overview.html#sec-Reference - public class Reference { - - private TransformChain chain; - private string digestMethod; - private byte[] digestValue; - private string id; - private string uri; - private string type; - private HashAlgorithm hash; - - public Reference () - { - chain = new TransformChain (); - digestMethod = XmlSignature.NamespaceURI + "sha1"; - } - - [MonoTODO()] - public Reference (Stream stream) : this () - { - } - - public Reference (string uri) : this () - { - this.uri = uri; - } - - // default to SHA1 - public string DigestMethod { - get { return digestMethod; } - set { digestMethod = value; } - } - - public byte[] DigestValue { - get { return digestValue; } - set { digestValue = value; } - } - - public string Id { - get { return id; } - set { id = value; } - } - - public TransformChain TransformChain { - get { return chain; } - } - - public string Type { - get { return type; } - set { type = value; } - } - - public string Uri { - get { return uri; } - set { uri = value; } - } - - public void AddTransform (Transform transform) - { - chain.Add (transform); - } - - public XmlElement GetXml () - { - if (digestMethod == null) - throw new CryptographicException ("DigestMethod"); - if (digestValue == null) - throw new NullReferenceException ("DigestValue"); - - XmlDocument document = new XmlDocument (); - XmlElement xel = document.CreateElement (XmlSignature.ElementNames.Reference, XmlSignature.NamespaceURI); - if (id != null) - xel.SetAttribute (XmlSignature.AttributeNames.Id, id); - if (uri != null) - xel.SetAttribute (XmlSignature.AttributeNames.URI, uri); - if (type != null) - xel.SetAttribute (XmlSignature.AttributeNames.Type, type); - - if (chain.Count > 0) { - XmlElement ts = document.CreateElement (XmlSignature.ElementNames.Transforms, XmlSignature.NamespaceURI); - foreach (Transform t in chain) { - XmlNode xn = t.GetXml (); - XmlNode newNode = document.ImportNode (xn, true); - ts.AppendChild (newNode); - } - xel.AppendChild (ts); - } - - XmlElement dm = document.CreateElement (XmlSignature.ElementNames.DigestMethod, XmlSignature.NamespaceURI); - dm.SetAttribute (XmlSignature.AttributeNames.Algorithm, digestMethod); - xel.AppendChild (dm); - - XmlElement dv = document.CreateElement (XmlSignature.ElementNames.DigestValue, XmlSignature.NamespaceURI); - dv.InnerText = Convert.ToBase64String (digestValue); - xel.AppendChild (dv); - - return xel; - } - - private string GetAttributeFromElement (XmlElement xel, string attribute, string element) - { - string result = null; - XmlNodeList xnl = xel.GetElementsByTagName (element); - if ((xnl != null) && (xnl.Count > 0)) { - XmlAttribute xa = xnl[0].Attributes [attribute]; - if (xa != null) - result = xa.InnerText; - } - return result; - } - - // note: we do NOT return null -on purpose- if attribute isn't found - private string GetAttribute (XmlElement xel, string attribute) - { - XmlAttribute xa = xel.Attributes [attribute]; - return ((xa != null) ? xa.InnerText : null); - } - - public void LoadXml (XmlElement value) - { - if (value == null) - throw new ArgumentNullException ("value"); - - if ((value.LocalName != XmlSignature.ElementNames.Reference) || (value.NamespaceURI != XmlSignature.NamespaceURI)) - throw new CryptographicException (); - - id = GetAttribute (value, XmlSignature.AttributeNames.Id); - uri = GetAttribute (value, XmlSignature.AttributeNames.URI); - type = GetAttribute (value, XmlSignature.AttributeNames.Type); - // Note: order is important for validations - XmlNodeList xnl = value.GetElementsByTagName (XmlSignature.ElementNames.Transform); - if ((xnl != null) && (xnl.Count > 0)) { - Transform t = null; - foreach (XmlNode xn in xnl) { - string a = GetAttribute ((XmlElement)xn, XmlSignature.AttributeNames.Algorithm); - switch (a) { - case "http://www.w3.org/2000/09/xmldsig#base64": - t = new XmlDsigBase64Transform (); - break; - case "http://www.w3.org/TR/2001/REC-xml-c14n-20010315": - t = new XmlDsigC14NTransform (); - break; - case "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments": - t = new XmlDsigC14NWithCommentsTransform (); - break; - case "http://www.w3.org/2000/09/xmldsig#enveloped-signature": - t = new XmlDsigEnvelopedSignatureTransform (); - break; - case "http://www.w3.org/TR/1999/REC-xpath-19991116": - t = new XmlDsigXPathTransform (); - break; - case "http://www.w3.org/TR/1999/REC-xslt-19991116": - t = new XmlDsigXsltTransform (); - break; - default: - throw new NotSupportedException (); - } - AddTransform (t); - } - } - // get DigestMethod - DigestMethod = GetAttributeFromElement (value, XmlSignature.AttributeNames.Algorithm, XmlSignature.ElementNames.DigestMethod); - // get DigestValue - xnl = value.GetElementsByTagName (XmlSignature.ElementNames.DigestValue); - if ((xnl != null) && (xnl.Count > 0)) { - DigestValue = Convert.FromBase64String (xnl[0].InnerText); - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/ReferenceList.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/ReferenceList.cs deleted file mode 100644 index 9d20ed88dbe..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/ReferenceList.cs +++ /dev/null @@ -1,93 +0,0 @@ -// -// ReferenceList.cs: Handles WS-Security ReferenceList -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Collections; -using System.Security.Cryptography.Xml; -using System.Xml; -using Microsoft.Web.Services; -#if !WSE1 -using Microsoft.Web.Services.Xml; -#endif - -namespace Microsoft.Web.Services.Security { - - public class ReferenceList : IXmlElement { - - private ArrayList list; - - public ReferenceList () - { - list = new ArrayList (); - } - - public ReferenceList (XmlElement element) : this () - { - LoadXml (element); - } - - public void Add (string reference) - { - if (reference == null) - throw new ArgumentNullException ("reference"); - if (reference [0] == '#') - list.Add (reference.Substring (1)); - else - list.Add (reference); - } - - public bool Contains (string reference) - { - if (reference == null) - throw new ArgumentNullException ("reference"); - if (reference [0] == '#') - return list.Contains (reference.Substring (1)); - else - return list.Contains (reference); - } - - public IEnumerator GetEnumerator() - { - return list.GetEnumerator (); - } - - public XmlElement GetXml (XmlDocument document) - { - if (document == null) - throw new ArgumentNullException ("document"); - - XmlElement rl = document.CreateElement (XmlEncryption.Prefix, XmlEncryption.ElementNames.ReferenceList, XmlEncryption.NamespaceURI); - foreach (string s in list) { - XmlElement dr = document.CreateElement (XmlEncryption.Prefix, XmlEncryption.ElementNames.DataReference, XmlEncryption.NamespaceURI); - XmlAttribute uri = document.CreateAttribute (XmlEncryption.AttributeNames.URI); - uri.InnerText = "#" + s; - dr.Attributes.Append (uri); - rl.AppendChild (dr); - } - return rl; - } - - public void LoadXml (XmlElement element) - { - if (element == null) - throw new ArgumentNullException ("element"); - if ((element.LocalName != XmlEncryption.ElementNames.ReferenceList) || (element.NamespaceURI != XmlEncryption.NamespaceURI)) - throw new System.ArgumentException ("invalid LocalName or NamespaceURI"); - - foreach (XmlNode xn in element.ChildNodes) { - // we just drop other elements - if ((xn.LocalName == XmlEncryption.ElementNames.DataReference) && (xn.NamespaceURI == XmlEncryption.NamespaceURI)) { - XmlAttribute uri = xn.Attributes [XmlEncryption.AttributeNames.URI]; - if (uri != null) - Add (uri.InnerText); - } - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/ReplayCacheManager.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/ReplayCacheManager.cs deleted file mode 100644 index 2cf650ebba8..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/ReplayCacheManager.cs +++ /dev/null @@ -1,21 +0,0 @@ -// -// ReplayCacheManager.cs - ReplayCache Manager -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services.Security { - - public class ReplayCacheManager { - - public ReplayCacheManager () {} - - [MonoTODO] - public static void ProcessMessage (SoapEnvelope envelope) {} - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SMSecurity.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SMSecurity.cs deleted file mode 100644 index 6aba15269b0..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SMSecurity.cs +++ /dev/null @@ -1,29 +0,0 @@ -// -// SMSecurity.cs - SMSecurity abstract class -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services.Security { - - public class SMSecurity : SMSecurityBase { - - public const string NamespaceURI = "http://schemas.xmlsoap.org/ws/2002/12/secext"; - public const string Prefix = "wsse"; - - public SMSecurity () {} - - public override string NamespaceURIValue { - get { return NamespaceURI; } - } - - public override string PrefixValue { - get { return Prefix; } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SMSecurityBase.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SMSecurityBase.cs deleted file mode 100644 index 5ba2f291e60..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SMSecurityBase.cs +++ /dev/null @@ -1,26 +0,0 @@ -// -// SMSecurityBase.cs - SMSecurityBase abstract class -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services.Security { - - public abstract class SMSecurityBase { - - protected SMSecurityBase () {} - - public abstract string NamespaceURIValue { - get; - } - - public abstract string PrefixValue { - get; - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SaML.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SaML.cs deleted file mode 100644 index abde170f925..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SaML.cs +++ /dev/null @@ -1,30 +0,0 @@ -// -// SaML.cs - Security Assertion Markup Language -// http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=security -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services.Security { - - public class SaML { - - public class ElementNames { - - public const string Assertion = "Assertion"; - public const string AssertionIDReference = "AssertionIDReference"; - - public ElementNames () {} - } - - public const string NamespaceURI = "urn:oasis:names:tc:SAML:1.0:assertion"; - public const string Prefix = "saml"; - - public SaML () {} - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/Security.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/Security.cs deleted file mode 100644 index 9f58898391e..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/Security.cs +++ /dev/null @@ -1,157 +0,0 @@ -// -// Security.cs: Handles WS-Security Security -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Web.Services.Protocols; -using System.Xml; -#if !WSE1 -using Microsoft.Web.Services.Xml; -#endif - -namespace Microsoft.Web.Services.Security { - - public class Security : SoapHeader, IXmlElement { - - private static string SoapActor = "actor"; // not Actor - no capital A - private static string SoapNamespaceURI = "http://www.w3.org/2001/12/soap-envelope"; - - private SecurityElementCollection elems; - private SecurityTokenCollection tokens; - - internal Security () - { - elems = new SecurityElementCollection (); - tokens = new SecurityTokenCollection (); - } - - public Security (string actor) : this () - { - if (actor == null) - throw new ArgumentNullException ("actor"); - Actor = actor; - } - - public Security (XmlElement element) : this () - { - LoadXml (element); - } - - public SecurityElementCollection Elements { - get { return elems; } - } - - public SecurityTokenCollection Tokens { - get { return tokens; } - } - - [MonoTODO("incomplete")] - public XmlElement GetXml (XmlDocument document) - { - if (document == null) - throw new ArgumentNullException ("document"); - - // much cleaner than using StringBuilder! - XmlElement xel = document.CreateElement (WSSecurity.Prefix, WSSecurity.ElementNames.Security, WSSecurity.NamespaceURI); -// xel.SetAttribute (SoapActor, SoapNamespaceURI, Actor); - XmlAttribute xa = document.CreateAttribute (Soap.Prefix, Soap.AttributeNames.MustUnderstand, Soap.NamespaceURI); - xa.InnerText = "1"; - xel.Attributes.Append (xa); - - foreach (SecurityToken st in tokens) { - xel.AppendChild (st.GetXml (document)); - } - - foreach (ISecurityElement se in elems) { - if (se is EncryptedData) { - EncryptedData ed = (se as EncryptedData); - ed.Encrypt (document); - xel.AppendChild (ed.EncryptedKey.GetXml (document)); - } - else if (se is Signature) { - // TODO - } - // TODO - other elements - } - - return xel; - } - - private XmlNode FindId (XmlNode node, string tag, string id) - { - if ((tag == null) || (node.LocalName == tag)) { - XmlAttribute xa = node.Attributes ["Id"]; - if ((xa != null) && (xa.InnerText == id)) - return node; - } - foreach (XmlNode xn in node.ChildNodes) { - XmlNode result = FindId (xn, tag, id); - if (result != null) - return result; - } - return null; - } - - private void LoadEncryptedKey (XmlElement xel) - { - EncryptedKey ek = new EncryptedKey (xel); - foreach (string s in ek.ReferenceList) { - // this won't works - probably not a "true" searchable id - // XmlElement edxel = xel.OwnerDocument.GetElementById (s); - XmlElement edxel = (XmlElement) FindId ((XmlNode)xel.OwnerDocument.DocumentElement, "EncryptedData", s); - EncryptedData ed = new EncryptedData (edxel, ek); - ed.Decrypt (); - } - } - - // base class doesn't have a LoadXml method - [MonoTODO("incomplete")] - public void LoadXml (XmlElement element) - { - if ((element.LocalName != WSSecurity.ElementNames.Security) || (element.NamespaceURI != WSSecurity.NamespaceURI)) - throw new System.ArgumentException ("invalid LocalName or NamespaceURI"); - - // get attributes - XmlAttribute xa = element.Attributes [SoapActor, SoapNamespaceURI]; - Actor = ((xa == null) ? null : xa.Value); - - Elements.Clear (); - Tokens.Clear (); - foreach (XmlNode xn in element.ChildNodes) { - XmlElement xel = (XmlElement) xn; - switch (xn.NamespaceURI) { - case WSSecurity.NamespaceURI: - switch (xn.LocalName) { - case WSSecurity.ElementNames.UsernameToken: - UsernameToken unt = new UsernameToken (xel); - tokens.Add (unt); - break; - case WSSecurity.ElementNames.BinarySecurityToken: - //FIXME BinarySecurityToken bst = new BinarySecurityToken (xel); - //FIXME tokens.Add (bst); - break; - } - break; - case XmlEncryption.NamespaceURI: - switch (xn.LocalName) { - case XmlEncryption.ElementNames.EncryptedKey: - LoadEncryptedKey (xel); - xel.ParentNode.RemoveChild (xel); - break; - } - break; - } - } - // did we process all security headers ? - if (!element.HasChildNodes) { - // yeah, remove ourself from the header - element.ParentNode.RemoveChild (element); - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityCollection.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityCollection.cs deleted file mode 100644 index cabb0246896..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityCollection.cs +++ /dev/null @@ -1,112 +0,0 @@ -// -// SecurityCollection.cs: Handles WS-Security SecurityCollection -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// -// Licensed under MIT X11 (see LICENSE) with this specific addition: -// -// “This source code may incorporate intellectual property owned by Microsoft -// Corporation. Our provision of this source code does not include any licenses -// or any other rights to you under any Microsoft intellectual property. If you -// would like a license from Microsoft (e.g. rebrand, redistribute), you need -// to contact Microsoft directly.” -// - -using System; -using System.Collections; - -namespace Microsoft.Web.Services.Security { - - public class SecurityCollection : ICollection, IEnumerable { - - private ArrayList list; - - public SecurityCollection () - { - list = new ArrayList (); - } - - public int Count { - get { return list.Count; } - } - - public bool IsSynchronized { - get { return list.IsSynchronized; } - } - - public Security this [Uri actor] { - get { - if (actor == null) - throw new ArgumentNullException ("actor"); - return null; - } - } - - public Security this [string actor] { - get { - if (actor == null) - throw new ArgumentNullException ("actor"); - return null; - } - } - - public object SyncRoot { - get { return list.SyncRoot; } - } - - public void Add (Security security) - { - // note: doc says it not ArgumentNullException - if (security == null) - throw new ArgumentException ("security"); - if (list.Contains (security)) - throw new ArgumentException ("duplicate"); - list.Add (security); - } - - public void Clear () - { - list.Clear (); - } - - public bool Contains (string actor) - { - if (actor == null) - throw new ArgumentNullException ("actor"); - return false; - } - - public bool Contains (Uri actor) - { - if (actor == null) - throw new ArgumentNullException ("actor"); - return false; - } - - public void CopyTo (Array array, int index) - { - if (array == null) - throw new ArgumentNullException ("array"); - } - - public IEnumerator GetEnumerator () - { - return list.GetEnumerator (); - } - - public void Remove (string actor) - { - if (actor == null) - throw new ArgumentNullException ("actor"); - } - - public void Remove (Uri actor) - { - if (actor == null) - throw new ArgumentNullException ("actor"); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityElementCollection.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityElementCollection.cs deleted file mode 100644 index f05f70dd87f..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityElementCollection.cs +++ /dev/null @@ -1,77 +0,0 @@ -// -// SecurityElementCollection.cs: Handles WS-Security SecurityElementCollection -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// -// Licensed under MIT X11 (see LICENSE) with this specific addition: -// -// “This source code may incorporate intellectual property owned by Microsoft -// Corporation. Our provision of this source code does not include any licenses -// or any other rights to you under any Microsoft intellectual property. If you -// would like a license from Microsoft (e.g. rebrand, redistribute), you need -// to contact Microsoft directly.” -// - -using System; -using System.Collections; - -namespace Microsoft.Web.Services.Security { - - public class SecurityElementCollection : ICollection, IEnumerable { - - private ArrayList list; - - public SecurityElementCollection () - { - list = new ArrayList (); - } - - public int Count { - get { return list.Count; } - } - - public bool IsSynchronized { - get { return list.IsSynchronized; } - } - - public ISecurityElement this [int index] { - get { return (ISecurityElement) list [index]; } - } - - public object SyncRoot { - get { return list.SyncRoot; } - } - - public void Add (ISecurityElement element) - { - list.Add (element); - } - - public void Clear () - { - list.Clear (); - } - - public void CopyTo (Array array, int index) - { - if (array == null) - throw new ArgumentNullException ("array"); - list.CopyTo (array, index); - } - - public IEnumerator GetEnumerator () - { - return list.GetEnumerator (); - } - - public void Remove (ISecurityElement element) - { - if (element == null) - throw new ArgumentNullException ("element"); - list.Remove (element); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityFault.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityFault.cs deleted file mode 100644 index 852a895927a..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityFault.cs +++ /dev/null @@ -1,29 +0,0 @@ -// -// SecurityFault.cs: Undocument exception when a security fault happens -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// -// Licensed under MIT X11 (see LICENSE) with this specific addition: -// -// “This source code may incorporate intellectual property owned by Microsoft -// Corporation. Our provision of this source code does not include any licenses -// or any other rights to you under any Microsoft intellectual property. If you -// would like a license from Microsoft (e.g. rebrand, redistribute), you need -// to contact Microsoft directly.” -// - -using System; -using System.Web.Services.Protocols; -using System.Xml; - -namespace Microsoft.Web.Services.Security { - - internal class SecurityFault : SoapHeaderException { - - public SecurityFault (string message, XmlQualifiedName code) : base (message, code) {} - - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityFormatException.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityFormatException.cs deleted file mode 100644 index 772870cd56d..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityFormatException.cs +++ /dev/null @@ -1,30 +0,0 @@ -// -// SecurityFormatException.cs: -// Implements SecurityFormatException Exception -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// -// Licensed under MIT X11 (see LICENSE) with this specific addition: -// -// “This source code may incorporate intellectual property owned by Microsoft -// Corporation. Our provision of this source code does not include any licenses -// or any other rights to you under any Microsoft intellectual property. If you -// would like a license from Microsoft (e.g. rebrand, redistribute), you need -// to contact Microsoft directly.” -// - -using System; -using System.Web.Services.Protocols; - -namespace Microsoft.Web.Services.Security { - - [Serializable] - public class SecurityFormatException : SoapHeaderException { - - public SecurityFormatException (string message) : base (message, null) {} - - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityInputFilter.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityInputFilter.cs deleted file mode 100644 index f8394bdef43..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityInputFilter.cs +++ /dev/null @@ -1,34 +0,0 @@ -// -// SecurityInputFilter.cs: Security SOAP Input Filter -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Xml; - -namespace Microsoft.Web.Services.Security { - - public class SecurityInputFilter : SoapInputFilter { - - public SecurityInputFilter () {} - - [MonoTODO ("incomplete")] - public override void ProcessMessage (SoapEnvelope envelope) - { - if (envelope == null) - throw new ArgumentNullException ("envelope"); - - XmlNodeList xnl = envelope.Header.GetElementsByTagName (WSSecurity.ElementNames.Security, WSSecurity.NamespaceURI); - if ((xnl != null) && (xnl.Count > 0)) { - XmlElement security = (XmlElement) xnl [0]; - envelope.Context.Security.LoadXml (security); - - // TODO - read ExtendedSecurity - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityOutputFilter.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityOutputFilter.cs deleted file mode 100644 index 99b6aeeaaeb..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityOutputFilter.cs +++ /dev/null @@ -1,39 +0,0 @@ -// -// SecurityOutputFilter.cs: Security SOAP Output Filter -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Xml; -#if WSE2 -using Microsoft.Web.Services.Xml; -#endif - -namespace Microsoft.Web.Services.Security { - - public class SecurityOutputFilter : SoapOutputFilter { - - public SecurityOutputFilter () {} - - public override void ProcessMessage (SoapEnvelope envelope) - { - if (envelope == null) - throw new ArgumentNullException ("envelope"); - - if ((envelope.Context.Security.Tokens.Count > 0) || (envelope.Context.Security.Elements.Count > 0)) { - XmlElement security = envelope.Context.Security.GetXml (envelope); - envelope.Header.AppendChild (security); - } - - if (envelope.Context.ExtendedSecurity.Count > 0) { - foreach (Security s in envelope.Context.ExtendedSecurity) { - envelope.Header.AppendChild (s.GetXml (envelope)); - } - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityToken.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityToken.cs deleted file mode 100644 index 3a35d29393d..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityToken.cs +++ /dev/null @@ -1,75 +0,0 @@ -// -// SecurityToken.cs: Handles WS-Security SecurityToken -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Security.Cryptography.Xml; -using System.Xml; -using Microsoft.Web.Services; -#if !WSE1 -using System.Security.Principal; -using Microsoft.Web.Services.Xml; -#endif - -namespace Microsoft.Web.Services.Security { - - public abstract class SecurityToken : IXmlElement { - - private string id; -#if !WSE1 - private IPrincipal principal; -#endif - public SecurityToken () - { - // generate Id like WSDK - id = "SecurityToken-" + Guid.NewGuid ().ToString (); - } - - public SecurityToken (XmlElement element) - { - LoadXml (element); - } - - public abstract AuthenticationKey AuthenticationKey {get;} - - public abstract DecryptionKey DecryptionKey {get;} - - public abstract EncryptionKey EncryptionKey {get;} - - public string Id { - get { return id; } - set { id = value; } - } - - public abstract SignatureKey SignatureKey {get;} - - public abstract bool SupportsDataEncryption {get;} - - public abstract bool SupportsDigitalSignature {get;} - - public abstract XmlElement GetXml (XmlDocument document); - - public abstract void LoadXml (XmlElement element); -#if WSE1 - public abstract void Verify (); -#else - public abstract bool Equals (SecurityToken token); - - public abstract override int GetHashCode (); - - public abstract bool IsCurrent {get;} - - public virtual IPrincipal Principal { - get { return principal; } - set { principal = value; } - } - -// public virtual TokenType TokenType {get;} -#endif - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityTokenCache.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityTokenCache.cs deleted file mode 100644 index 2604b0ec286..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityTokenCache.cs +++ /dev/null @@ -1,98 +0,0 @@ -// -// SecurityTokenCache.cs - SecurityToken Cache -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Collections; - -namespace Microsoft.Web.Services.Security { - - public class SecurityTokenCache : ICollection { - - [MonoTODO] - public static SecurityTokenCache GlobalCache { - get { return null; } - } - - [MonoTODO] - public static SecurityTokenCache Synchronized (SecurityTokenCache cache) - { - return null; - } - - - [MonoTODO] - public SecurityTokenCache () {} - - [MonoTODO] - public virtual int Count { - get { return 0; } - } - - [MonoTODO] - public virtual bool IsSynchronized { - get { return false; } - } - - [MonoTODO] - public virtual SecurityToken this [string identifier] { - get { return null; } - } - - [MonoTODO] - public virtual object SyncRoot { - get { return null; } - } - - [MonoTODO] - public event EventHandler Changed; - - - [MonoTODO] - protected virtual void Add (string identifier, SecurityToken token) {} - - [MonoTODO] - protected void CacheChanged () {} - - [MonoTODO] - protected virtual bool Contains (string identifier) - { - return false; - } - - [MonoTODO] - protected virtual void Remove (string identifier) {} - - [MonoTODO] - public virtual void Add (SecurityToken token) {} - - [MonoTODO] - public void AddRange (ICollection collection) {} - - [MonoTODO] - public virtual void Clear () {} - - [MonoTODO] - public virtual bool Contains (SecurityToken token) - { - return false; - } - - [MonoTODO] - public virtual void CopyTo (Array array, int index) {} - - [MonoTODO] - public virtual IEnumerator GetEnumerator () - { - return null; - } - - [MonoTODO] - public virtual void Remove (SecurityToken token) {} - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityTokenCollection.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityTokenCollection.cs deleted file mode 100644 index 99193e82537..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityTokenCollection.cs +++ /dev/null @@ -1,94 +0,0 @@ -// -// SecurityTokenCollection.cs: Handles WS-Security SecurityTokenCollection -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// -// Licensed under MIT X11 (see LICENSE) with this specific addition: -// -// “This source code may incorporate intellectual property owned by Microsoft -// Corporation. Our provision of this source code does not include any licenses -// or any other rights to you under any Microsoft intellectual property. If you -// would like a license from Microsoft (e.g. rebrand, redistribute), you need -// to contact Microsoft directly.” -// - -using System; -using System.Collections; - -namespace Microsoft.Web.Services.Security { - - public class SecurityTokenCollection : ICollection, IEnumerable { - - private ArrayList list; - - public SecurityTokenCollection () - { - list = new ArrayList (); - } - - public int Count { - get { return list.Count; } - } - - public bool IsSynchronized { - get { return list.IsSynchronized; } - } - - // TODO - public SecurityToken this [string refid] { - get { return null; } - } - - public object SyncRoot { - get { return list.SyncRoot; } - } - - public int Add (SecurityToken token) - { - return list.Add (token); - } - - public void AddRange (ICollection collection) - { - IEnumerator e = collection.GetEnumerator (); - while (e.MoveNext ()) { - if (e.Current is SecurityToken) - list.Add (e.Current as SecurityToken); - else - throw new ArgumentException (e.Current.ToString ()); - } - } - - public void Clear () - { - list.Clear (); - } - - public bool Contains (SecurityToken token) - { - return list.Contains (token); - } - - public void CopyTo (Array array, int index) - { - if (array == null) - throw new ArgumentNullException ("array"); - list.CopyTo (array, index); - } - - public IEnumerator GetEnumerator () - { - return list.GetEnumerator (); - } - - public void Remove (SecurityToken token) - { - if (token == null) - throw new ArgumentNullException ("token"); - list.Remove (token); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityTokenReference.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityTokenReference.cs deleted file mode 100644 index f5032a84020..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityTokenReference.cs +++ /dev/null @@ -1,90 +0,0 @@ -// -// SecurityTokenReference.cs: Handles WS-Security SecurityTokenReference -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Security.Cryptography.Xml; -using System.Xml; -using Microsoft.Web.Services; -#if !WSE1 -using Microsoft.Web.Services.Xml; -#endif - -namespace Microsoft.Web.Services.Security { - - public class SecurityTokenReference : KeyInfoClause, IXmlElement { -// TODO WSE2 public class SecurityTokenReference : SecurityTokenReferenceType - - private KeyIdentifier kid; - private string reference; - - public SecurityTokenReference () : base () {} - - public SecurityTokenReference (XmlElement element) : base () - { - LoadXml (element); - } - - public KeyIdentifier KeyIdentifier { - get { return kid; } - set { kid = value; } - } - - public string Reference { - get { return reference; } - set { reference = value; } - } - - // note: old format used by S.S.C.Xml - public override XmlElement GetXml () - { - return GetXml (new XmlDocument ()); - } - - public XmlElement GetXml (XmlDocument document) - { - if (document == null) - throw new ArgumentNullException ("document"); - - XmlElement str = document.CreateElement (WSSecurity.Prefix, WSSecurity.ElementNames.SecurityTokenReference, WSSecurity.NamespaceURI); - if (kid != null) - str.AppendChild (kid.GetXml (document)); - if (reference != null) { - XmlAttribute uri = document.CreateAttribute (WSSecurity.AttributeNames.Uri); - uri.InnerText = "#" + reference; - XmlElement r = document.CreateElement (WSSecurity.Prefix, WSSecurity.ElementNames.Reference, WSSecurity.NamespaceURI); - r.Attributes.Append (uri); - str.AppendChild (r); - } - return str; - } - - public override void LoadXml (XmlElement element) - { - if (element == null) - throw new ArgumentNullException ("element"); - if ((element.LocalName != WSSecurity.ElementNames.SecurityTokenReference) || (element.NamespaceURI != WSSecurity.NamespaceURI)) - throw new System.ArgumentException ("invalid LocalName or NamespaceURI"); - - XmlNodeList xnl = element.GetElementsByTagName (WSSecurity.ElementNames.KeyIdentifier, WSSecurity.NamespaceURI); - if ((xnl != null) && (xnl.Count == 1)) { - kid = new KeyIdentifier ((xnl [0] as XmlElement)); - } - - xnl = element.GetElementsByTagName (WSSecurity.ElementNames.Reference, WSSecurity.NamespaceURI); - if ((xnl != null) && (xnl.Count == 1)) { - XmlAttribute uri = xnl [0].Attributes [WSSecurity.AttributeNames.Uri]; - if (uri != null) { - reference = uri.InnerText; - if (reference [0] == '#') - reference = reference.Substring (1); - } - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityTokenReferenceType.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityTokenReferenceType.cs deleted file mode 100644 index 5f0cdba1963..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityTokenReferenceType.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -// SecurityTokenReferenceType.cs - SecurityTokenReferenceType -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Collections; -using System.Security.Cryptography.Xml; -using System.Xml; -using Microsoft.Web.Services.Xml; - -namespace Microsoft.Web.Services.Security { - - public abstract class SecurityTokenReferenceType : KeyInfoClause, IXmlElement { - - [MonoTODO] - public SecurityTokenReferenceType () {} - - [MonoTODO] - public SecurityTokenReferenceType (KeyIdentifier identifier) {} - - [MonoTODO] - public SecurityTokenReferenceType (SecurityToken token) {} - - [MonoTODO] - public SecurityTokenReferenceType (XmlElement element) {} - - [MonoTODO] - public IList AnyAttributes { - get { return null; } - } - - [MonoTODO] - public IList AnyElements { - get { return null; } - } - - [MonoTODO] - public KeyIdentifier KeyIdentifier { - get { return null; } - set { ; } - } - - [MonoTODO] - public string Reference { - get { return null; } - set { ; } - } - - [MonoTODO] - protected void GetChildXml (XmlDocument document, XmlElement element) {} - - [MonoTODO] - protected void LoadChildXml (XmlElement element) {} - - [MonoTODO] - public override XmlElement GetXml () - { - XmlDocument document = new XmlDocument (); - return GetXml (document); - } - - [MonoTODO] - public virtual XmlElement GetXml (XmlDocument document) - { - return null; - } - - [MonoTODO] - public override void LoadXml (XmlElement element) {} - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/Signature.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/Signature.cs deleted file mode 100644 index b46a4661a22..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/Signature.cs +++ /dev/null @@ -1,61 +0,0 @@ -// -// Signature.cs: Handles WS-Security Signature -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Xml; - -namespace Microsoft.Web.Services.Security { - - public sealed class Signature : SignedXml, ISecurityElement { - - private SecurityToken token; - private SignatureOptions options; - - public Signature (SecurityToken token) - { - if (token == null) - throw new ArgumentNullException ("token"); - if (!token.SupportsDigitalSignature) - throw new ArgumentException ("!SupportsDigitalSignature"); - this.token = token; - } - - public SecurityToken SecurityToken { - get { return token; } - } - - public SignatureOptions SignatureOptions { - get { return options; } - set { options = value; } - } - - [MonoTODO] - public override bool CheckSignature () - { - // note: strangely this is the only (of 3) CheckSignature methods overriden !?! - return base.CheckSignature (); - } - - [MonoTODO] - public override XmlElement GetIdElement (XmlDocument document, string idValue) - { - return base.GetIdElement (document, idValue); - } - - [MonoTODO] - public void LoadXml (Security container, XmlElement value) - { - if (container == null) - throw new ArgumentNullException ("container"); - // TODO - if (value == null) - throw new SecurityFault ("value == null", null); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignatureKey.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignatureKey.cs deleted file mode 100644 index 89ff8277e86..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignatureKey.cs +++ /dev/null @@ -1,51 +0,0 @@ -// -// SignatureKey.cs: Handles WS-Security SignatureKey -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// -// Licensed under MIT X11 (see LICENSE) with this specific addition: -// -// “This source code may incorporate intellectual property owned by Microsoft -// Corporation. Our provision of this source code does not include any licenses -// or any other rights to you under any Microsoft intellectual property. If you -// would like a license from Microsoft (e.g. rebrand, redistribute), you need -// to contact Microsoft directly.” -// - -using System.Security.Cryptography; -// temp -using System.Security.Cryptography.Xml; - -namespace Microsoft.Web.Services.Security { - - public class SignatureKey { - - private AsymmetricAlgorithm asymKey; - private SymmetricAlgorithm symKey; - - public SignatureKey (AsymmetricAlgorithm key) - { - asymKey = key; - } - - public SignatureKey (SymmetricAlgorithm key) - { - symKey = key; - } - - public virtual void ComputeSignature (SignedXml signedXml) - { - if (asymKey != null) { - signedXml.SigningKey = asymKey; - signedXml.ComputeSignature (); - } - else { - HMACSHA1 hmac = new HMACSHA1 (symKey.Key); - signedXml.ComputeSignature (hmac); - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignatureOptions.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignatureOptions.cs deleted file mode 100644 index d0ba1f84d7b..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignatureOptions.cs +++ /dev/null @@ -1,30 +0,0 @@ -// -// SignatureOptions.cs: Signature options enumeration -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services.Security { - - [Flags] - [Serializable] - public enum SignatureOptions { - IncludeNone = 0, - IncludePath = 15, -#if WSE1 - IncludePathAction = 1, - IncludePathFrom = 2, - IncludePathId = 4, - IncludePathTo = 8, -#endif - IncludeSoapBody = 16, - IncludeTimestamp = 96, - IncludeTimestampCreated = 32, - IncludeTimestampExpires = 64, - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignedInfo.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignedInfo.cs deleted file mode 100644 index b3e21d8e6de..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignedInfo.cs +++ /dev/null @@ -1,174 +0,0 @@ -// -// SignedInfo.cs - SignedInfo implementation for XML Signature -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Collections; -using System.Xml; - -#if (WSE1 || WSE2) -using System.Security.Cryptography; -using System.Security.Cryptography.Xml; - -namespace Microsoft.Web.Services.Security { -#else -namespace System.Security.Cryptography.Xml { -#endif - public class SignedInfo : ICollection, IEnumerable { - - private ArrayList references; - private string c14nMethod; - private string id; - private string signatureMethod; - private string signatureLength; - - public SignedInfo() - { - references = new ArrayList (); - c14nMethod = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"; - } - - public string CanonicalizationMethod { - get { return c14nMethod; } - set { c14nMethod = value; } - } - - // documented as not supported (and throwing exception) - public int Count { - get { throw new NotSupportedException (); } - } - - public string Id { - get { return id; } - set { id = value; } - } - - // documented as not supported (and throwing exception) - public bool IsReadOnly { - get { throw new NotSupportedException (); } - } - - // documented as not supported (and throwing exception) - public bool IsSynchronized { - get { throw new NotSupportedException (); } - } - - public ArrayList References { - get { return references; } - } - - public string SignatureLength { - get { return signatureLength; } - set { signatureLength = value; } - } - - public string SignatureMethod { - get { return signatureMethod; } - set { signatureMethod = value; } - } - - // documented as not supported (and throwing exception) - public object SyncRoot { - get { throw new NotSupportedException (); } - } - - public void AddReference (Reference reference) - { - references.Add (reference); - } - - // documented as not supported (and throwing exception) - public void CopyTo (Array array, int index) - { - throw new NotSupportedException (); - } - - public IEnumerator GetEnumerator () - { - return references.GetEnumerator (); - } - - public XmlElement GetXml() - { - if (signatureMethod == null) - throw new CryptographicException ("SignatureMethod"); - if (references.Count == 0) - throw new CryptographicException ("References empty"); - - XmlDocument document = new XmlDocument (); - XmlElement xel = document.CreateElement (XmlSignature.ElementNames.SignedInfo, XmlSignature.NamespaceURI); - if (id != null) - xel.SetAttribute (XmlSignature.AttributeNames.Id, id); - - if (c14nMethod != null) { - XmlElement c14n = document.CreateElement (XmlSignature.ElementNames.CanonicalizationMethod, XmlSignature.NamespaceURI); - c14n.SetAttribute (XmlSignature.AttributeNames.Algorithm, c14nMethod); - xel.AppendChild (c14n); - } - if (signatureMethod != null) { - XmlElement sm = document.CreateElement (XmlSignature.ElementNames.SignatureMethod, XmlSignature.NamespaceURI); - sm.SetAttribute (XmlSignature.AttributeNames.Algorithm, signatureMethod); - if (signatureLength != null) { - XmlElement hmac = document.CreateElement (XmlSignature.ElementNames.HMACOutputLength, XmlSignature.NamespaceURI); - hmac.InnerText = signatureLength; - sm.AppendChild (hmac); - } - xel.AppendChild (sm); - } - - // we add References afterward so we don't end up with extraneous - // xmlns="..." in each reference elements. - foreach (Reference r in references) { - XmlNode xn = r.GetXml (); - XmlNode newNode = document.ImportNode (xn, true); - xel.AppendChild (newNode); - } - - return xel; - } - - private string GetAttributeFromElement (XmlElement xel, string attribute, string element) - { - string result = null; - XmlNodeList xnl = xel.GetElementsByTagName (element); - if ((xnl != null) && (xnl.Count > 0)) { - XmlAttribute xa = xnl[0].Attributes [attribute]; - if (xa != null) - result = xa.InnerText; - } - return result; - } - - private string GetAttribute (XmlElement xel, string attribute) - { - XmlAttribute xa = xel.Attributes [attribute]; - return ((xa != null) ? xa.InnerText : null); - } - - [MonoTODO("signatureLength for HMAC")] - public void LoadXml (XmlElement value) - { - if (value == null) - throw new ArgumentNullException ("value"); - - if ((value.LocalName != XmlSignature.ElementNames.SignedInfo) || (value.NamespaceURI != XmlSignature.NamespaceURI)) - throw new CryptographicException (); - - id = GetAttribute (value, XmlSignature.AttributeNames.Id); - c14nMethod = GetAttributeFromElement (value, XmlSignature.AttributeNames.Algorithm, XmlSignature.ElementNames.CanonicalizationMethod); - signatureMethod = GetAttributeFromElement (value, XmlSignature.AttributeNames.Algorithm, XmlSignature.ElementNames.SignatureMethod); - // TODO signatureLength for HMAC - XmlNodeList xnl = value.GetElementsByTagName (XmlSignature.ElementNames.Reference); - foreach (XmlNode xn in xnl) { - Reference r = new Reference (); - r.LoadXml ((XmlElement) xn); - AddReference (r); - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignedXml.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignedXml.cs deleted file mode 100644 index 8f42768fc12..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignedXml.cs +++ /dev/null @@ -1,394 +0,0 @@ -// -// SignedXml.cs - SignedXml implementation for XML Signature -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Collections; -using System.IO; -using System.Runtime.InteropServices; -using System.Security.Cryptography; -using System.Xml; - -using SSCX = System.Security.Cryptography.Xml; - -#if WSE2 -using Microsoft.Web.Services.Xml; -#endif -#if (WSE1 || WSE2) -using Microsoft.Web.Services.Security; - -namespace Microsoft.Web.Services.Security { - - public class SignedXml : IXmlElement { -#else -using System.Security.Cryptography.Xml; - -namespace System.Security.Cryptography.Xml { - - public class SignedXml { -#endif - -#if (WSE1 || WSE2) - private SignedXmlSignature signature; - - public SignedXml () - { - signature = new SignedXmlSignature (); - signature.SignedInfo = new SignedInfo (); - } -#else - private Signature signature; - - public SignedXml () - { - signature = new Signature (); - signature.SignedInfo = new SignedInfo (); - } -#endif - private AsymmetricAlgorithm key; - private string keyName; - private XmlDocument envdoc; - - public SignedXml (XmlDocument document) : this () - { - envdoc = document; - } - - public SignedXml (XmlElement elem) : this () - { - if (elem == null) - throw new ArgumentNullException ("elem"); - } - - public const string XmlDsigCanonicalizationUrl = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"; - public const string XmlDsigCanonicalizationWithCommentsUrl = XmlDsigCanonicalizationUrl + "#WithComments"; - public const string XmlDsigNamespaceUrl = "http://www.w3.org/2000/09/xmldsig#"; - public const string XmlDsigDSAUrl = XmlDsigNamespaceUrl + "dsa-sha1"; - public const string XmlDsigHMACSHA1Url = XmlDsigNamespaceUrl + "hmac-sha1"; - public const string XmlDsigMinimalCanonicalizationUrl = XmlDsigNamespaceUrl + "minimal"; - public const string XmlDsigRSASHA1Url = XmlDsigNamespaceUrl + "rsa-sha1"; - public const string XmlDsigSHA1Url = XmlDsigNamespaceUrl + "sha1"; - - public SSCX.KeyInfo KeyInfo { - get { return signature.KeyInfo; } - set { signature.KeyInfo = value; } - } - -#if (WSE1 || WSE2) - public SignedXmlSignature Signature { - get { return signature; } - } -#else - public Signature Signature { - get { return signature; } - } -#endif - public string SignatureLength { - get { return signature.SignedInfo.SignatureLength; } - } - - public string SignatureMethod { - get { return signature.SignedInfo.SignatureMethod; } - } - - public byte[] SignatureValue { - get { return signature.SignatureValue; } - } - - public SignedInfo SignedInfo { - get { return signature.SignedInfo; } - } - - public AsymmetricAlgorithm SigningKey { - get { return key; } - set { key = value; } - } - - public string SigningKeyName { - get { return keyName; } - set { keyName = value; } - } - - public void AddObject (SSCX.DataObject dataObject) - { - signature.AddObject (dataObject); - } - - public void AddReference (Reference reference) - { - signature.SignedInfo.AddReference (reference); - } - - private Stream ApplyTransform (SSCX.Transform t, XmlDocument doc) - { - t.LoadInput (doc); - if (t is SSCX.XmlDsigEnvelopedSignatureTransform) { - XmlDocument d = (XmlDocument) t.GetOutput (); - MemoryStream ms = new MemoryStream (); - d.Save (ms); - return ms; - } - else - return (Stream) t.GetOutput (); - } - - private Stream ApplyTransform (SSCX.Transform t, Stream s) - { - try { - t.LoadInput (s); - s = (Stream) t.GetOutput (); - } - catch (Exception e) { - string temp = e.ToString (); // stop debugger - } - return s; - } - - [MonoTODO("incomplete")] - private byte[] GetReferenceHash (Reference r) - { - XmlDocument doc = new XmlDocument (); - doc.PreserveWhitespace = true; - if (r.Uri == "") - doc = envdoc; - else { - foreach (SSCX.DataObject obj in signature.ObjectList) { - if ("#" + obj.Id == r.Uri) { - doc.LoadXml (obj.GetXml ().OuterXml); - break; - } - } - } - - Stream s = null; - if (r.TransformChain.Count > 0) { - foreach (SSCX.Transform t in r.TransformChain) { - if (s == null) - s = ApplyTransform (t, doc); - else - s = ApplyTransform (t, s); - } - } - else - s = ApplyTransform (new SSCX.XmlDsigC14NTransform (), doc); - - // TODO: We should reuse the same hash object (when possible) - HashAlgorithm hash = (HashAlgorithm) CryptoConfig.CreateFromName (r.DigestMethod); - return hash.ComputeHash (s); - } - - private void DigestReferences () - { - // we must tell each reference which hash algorithm to use - // before asking for the SignedInfo XML ! - foreach (Reference r in signature.SignedInfo.References) { - // assume SHA-1 if nothing is specified - if (r.DigestMethod == null) - r.DigestMethod = XmlDsigSHA1Url; - r.DigestValue = GetReferenceHash (r); - } - } - - private Stream SignedInfoTransformed () - { - SSCX.Transform t = (SSCX.Transform) CryptoConfig.CreateFromName (signature.SignedInfo.CanonicalizationMethod); - if (t == null) - return null; - - XmlDocument doc = new XmlDocument (); - doc.LoadXml (signature.SignedInfo.GetXml ().OuterXml); - return ApplyTransform (t, doc); - } - - private byte[] Hash (string hashAlgorithm) - { - HashAlgorithm hash = HashAlgorithm.Create (hashAlgorithm); - // get the hash of the C14N SignedInfo element - return hash.ComputeHash (SignedInfoTransformed ()); - } - - public virtual bool CheckSignature () - { - // CryptographicException - if (key == null) - key = GetPublicKey (); - return CheckSignature (key); - } - - private bool CheckReferenceIntegrity () - { - // check digest (hash) for every reference - foreach (Reference r in signature.SignedInfo.References) { - // stop at first broken reference - if (! Compare (r.DigestValue, GetReferenceHash (r))) - return false; - } - return true; - } - - public bool CheckSignature (AsymmetricAlgorithm key) - { - if (key == null) - throw new ArgumentNullException ("key"); - - // Part 1: Are all references digest valid ? - bool result = CheckReferenceIntegrity (); - if (result) { - // Part 2: Is the signature (over SignedInfo) valid ? - SignatureDescription sd = (SignatureDescription) CryptoConfig.CreateFromName (signature.SignedInfo.SignatureMethod); - - byte[] hash = Hash (sd.DigestAlgorithm); - AsymmetricSignatureDeformatter verifier = (AsymmetricSignatureDeformatter) CryptoConfig.CreateFromName (sd.DeformatterAlgorithm); - - if (verifier != null) { - verifier.SetHashAlgorithm (sd.DigestAlgorithm); - result = verifier.VerifySignature (hash, signature.SignatureValue); - } - else - result = false; - } - - return result; - } - - private bool Compare (byte[] expected, byte[] actual) - { - bool result = ((expected != null) && (actual != null)); - if (result) { - int l = expected.Length; - result = (l == actual.Length); - if (result) { - for (int i=0; i < l; i++) { - if (expected[i] != actual[i]) - return false; - } - } - } - return result; - } - - public bool CheckSignature (KeyedHashAlgorithm macAlg) - { - if (macAlg == null) - throw new ArgumentNullException ("macAlg"); - - // Part 1: Are all references digest valid ? - bool result = CheckReferenceIntegrity (); - if (result) { - // Part 2: Is the signature (over SignedInfo) valid ? - byte[] actual = macAlg.ComputeHash (SignedInfoTransformed ()); - result = Compare (signature.SignatureValue, actual); - } - return result; - } - - public bool CheckSignatureReturningKey (out AsymmetricAlgorithm signingKey) - { - // here's the key used for verifying the signature - if (key == null) - key = GetPublicKey (); - signingKey = key; - // we'll find the key if we haven't already - return CheckSignature (key); - } - - public void ComputeSignature () - { - if (key != null) { - // required before hashing - signature.SignedInfo.SignatureMethod = key.SignatureAlgorithm; - DigestReferences (); - - SignatureDescription sd = (SignatureDescription) CryptoConfig.CreateFromName (signature.SignedInfo.SignatureMethod); - - // the hard part - C14Ning the KeyInfo - byte[] hash = Hash (sd.DigestAlgorithm); - AsymmetricSignatureFormatter signer = null; - - // in need for a CryptoConfig factory - if (key is DSA) - signer = new DSASignatureFormatter (key); - else if (key is RSA) - signer = new RSAPKCS1SignatureFormatter (key); - - if (signer != null) { - signer.SetHashAlgorithm ("SHA1"); - signature.SignatureValue = signer.CreateSignature (hash); - } - } - } - - public void ComputeSignature (KeyedHashAlgorithm macAlg) - { - if (macAlg == null) - throw new ArgumentNullException ("macAlg"); - - if (macAlg is HMACSHA1) { - DigestReferences (); - - signature.SignedInfo.SignatureMethod = XmlDsigHMACSHA1Url; - signature.SignatureValue = macAlg.ComputeHash (SignedInfoTransformed ()); - } - else - throw new CryptographicException ("unsupported algorithm"); - } - - // is that all ? - public virtual XmlElement GetIdElement (XmlDocument document, string idValue) - { - return document.GetElementById (idValue); - } - - protected virtual AsymmetricAlgorithm GetPublicKey () - { - AsymmetricAlgorithm key = null; - if (signature.KeyInfo != null) { - foreach (SSCX.KeyInfoClause kic in signature.KeyInfo) { - if (kic is SSCX.DSAKeyValue) - key = DSA.Create (); - else if (kic is SSCX.RSAKeyValue) - key = RSA.Create (); - - if (key != null) { - key.FromXmlString (kic.GetXml ().InnerXml); - break; - } - } - } - return key; - } - - public XmlElement GetXml () - { - return signature.GetXml (); - } - - public void LoadXml (XmlElement value) - { - signature.LoadXml (value); - } - -#if (WSE1 || WSE2) - [MonoTODO] - public virtual XmlElement GetXml (XmlDocument document) - { - return null; - } -#endif - -#if ! NET_1_0 - private XmlResolver xmlResolver; - - [MonoTODO("property not (yet) used in class")] - [ComVisible(false)] - XmlResolver Resolver { - set { xmlResolver = value; } - } -#endif - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignedXmlSignature.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignedXmlSignature.cs deleted file mode 100644 index 5eb379a13a8..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignedXmlSignature.cs +++ /dev/null @@ -1,160 +0,0 @@ -// -// For System.Security.Cryptography.Xml -// Signature.cs - Signature implementation for XML Signature -// For Microsoft.Web.Services.Security -// SignedXmlSignature.cs -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Collections; -using System.Security.Cryptography; -using System.Xml; - -#if (WSE1 || WSE2) -using System.Security.Cryptography.Xml; - -namespace Microsoft.Web.Services.Security { - - public class SignedXmlSignature { - - public SignedXmlSignature () -#else -namespace System.Security.Cryptography.Xml { - - public class Signature { - - public Signature () -#endif - { - list = new ArrayList (); - } - - private ArrayList list; - private SignedInfo info; - private KeyInfo key; - private string id; - private byte[] signature; - - public string Id { - get { return id; } - set { id = value; } - } - - public KeyInfo KeyInfo { - get { return key; } - set { key = value; } - } - - public IList ObjectList { - get { return list; } - set { list = ArrayList.Adapter (value); } - } - - public byte[] SignatureValue { - get { return signature; } - set { signature = value; } - } - - public SignedInfo SignedInfo { - get { return info; } - set { info = value; } - } - - public void AddObject (DataObject dataObject) - { - list.Add (dataObject); - } - - public XmlElement GetXml () - { - if (info == null) - throw new CryptographicException ("SignedInfo"); - if (signature == null) - throw new CryptographicException ("SignatureValue"); - - XmlDocument document = new XmlDocument (); - XmlElement xel = document.CreateElement (XmlSignature.ElementNames.Signature, XmlSignature.NamespaceURI); - if (id != null) - xel.SetAttribute (XmlSignature.AttributeNames.Id, id); - - XmlNode xn = info.GetXml (); - XmlNode newNode = document.ImportNode (xn, true); - xel.AppendChild (newNode); - - if (signature != null) { - XmlElement sv = document.CreateElement (XmlSignature.ElementNames.SignatureValue, XmlSignature.NamespaceURI); - sv.InnerText = Convert.ToBase64String (signature); - xel.AppendChild (sv); - } - - if (key != null) { - xn = key.GetXml (); - newNode = document.ImportNode (xn, true); - xel.AppendChild (newNode); - } - - if (list.Count > 0) { - foreach (DataObject obj in list) { - xn = obj.GetXml (); - newNode = document.ImportNode (xn, true); - xel.AppendChild (newNode); - } - } - - return xel; - } - - private string GetAttribute (XmlElement xel, string attribute) - { - XmlAttribute xa = xel.Attributes [attribute]; - return ((xa != null) ? xa.InnerText : null); - } - - public void LoadXml (XmlElement value) - { - if (value == null) - throw new ArgumentNullException ("value"); - - if ((value.LocalName == XmlSignature.ElementNames.Signature) && (value.NamespaceURI == XmlSignature.NamespaceURI)) { - id = GetAttribute (value, XmlSignature.AttributeNames.Id); - - XmlNodeList xnl = value.GetElementsByTagName (XmlSignature.ElementNames.SignedInfo); - if ((xnl != null) && (xnl.Count == 1)) { - info = new SignedInfo (); - info.LoadXml ((XmlElement) xnl[0]); - } - - xnl = value.GetElementsByTagName (XmlSignature.ElementNames.SignatureValue); - if ((xnl != null) && (xnl.Count == 1)) { - signature = Convert.FromBase64String (xnl[0].InnerText); - } - - xnl = value.GetElementsByTagName (XmlSignature.ElementNames.KeyInfo); - if ((xnl != null) && (xnl.Count == 1)) { - key = new KeyInfo (); - key.LoadXml ((XmlElement) xnl[0]); - } - - xnl = value.GetElementsByTagName (XmlSignature.ElementNames.Object); - if ((xnl != null) && (xnl.Count > 0)) { - foreach (XmlNode xn in xnl) { - DataObject obj = new DataObject (); - obj.LoadXml ((XmlElement) xn); - AddObject (obj); - } - } - } - - // if invalid - if (info == null) - throw new CryptographicException ("SignedInfo"); - if (signature == null) - throw new CryptographicException ("SignatureValue"); - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SymmetricDecryptionKey.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SymmetricDecryptionKey.cs deleted file mode 100644 index a4d08bde272..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SymmetricDecryptionKey.cs +++ /dev/null @@ -1,52 +0,0 @@ -// -// SymmetricDecryptionKey.cs: Handles WS-Security SymmetricDecryptionKey -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// -// Licensed under MIT X11 (see LICENSE) with this specific addition: -// -// “This source code may incorporate intellectual property owned by Microsoft -// Corporation. Our provision of this source code does not include any licenses -// or any other rights to you under any Microsoft intellectual property. If you -// would like a license from Microsoft (e.g. rebrand, redistribute), you need -// to contact Microsoft directly.” -// - -using System; -using System.Security.Cryptography; -using System.Web.Services.Protocols; - -namespace Microsoft.Web.Services.Security { - - public sealed class SymmetricDecryptionKey : DecryptionKey { - - private SymmetricAlgorithm algo; - private byte[] key; - - private bool IsSupported (SymmetricAlgorithm algo) - { - return ((algo is Rijndael) || (algo is TripleDES)); - } - - public SymmetricDecryptionKey (SymmetricAlgorithm key) - { - if (!IsSupported (key)) - throw new SecurityFault ("Unsupported algorithm", null); - algo = key; - } - - public SymmetricDecryptionKey (SymmetricAlgorithm key, byte[] keyValue) - { - if (!IsSupported (key)) - throw new SecurityFault ("Unsupported algorithm", null); - if (keyValue == null) - throw new ArgumentNullException ("KeyValue"); - - algo = key; - this.key = keyValue; - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SymmetricEncryptionKey.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SymmetricEncryptionKey.cs deleted file mode 100644 index 7188acf9fbe..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SymmetricEncryptionKey.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -// SymmetricEncryptionKey.cs: Handles WS-Security SymmetricEncryptionKey -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Security.Cryptography; -using System.Web.Services.Protocols; - -namespace Microsoft.Web.Services.Security { - - public class SymmetricEncryptionKey : EncryptionKey { - - private SymmetricAlgorithm algo; - - public SymmetricEncryptionKey () - { - // uses TripleDESCryptoServiceProvider - not default (Rjindael) - algo = SymmetricAlgorithm.Create ("TripleDES"); - } - - public SymmetricEncryptionKey (SymmetricAlgorithm key) - { - if (key == null) - throw new NullReferenceException ("algo"); - algo = key; - } - - public SymmetricEncryptionKey (SymmetricAlgorithm key, byte[] keyValue) - { - algo = key; - algo.Key = keyValue; - } - - internal SymmetricAlgorithm Algorithm { - get { return algo; } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SynchronizedSecurityTokenCache.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SynchronizedSecurityTokenCache.cs deleted file mode 100644 index 3a70967d89e..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SynchronizedSecurityTokenCache.cs +++ /dev/null @@ -1,63 +0,0 @@ -// -// SynchronizedSecurityTokenCache.cs - Synchronized access to SecurityTokenCache -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Collections; - -namespace Microsoft.Web.Services.Security { - - public class SynchronizedSecurityTokenCache : SecurityTokenCache { - - public SynchronizedSecurityTokenCache (SecurityTokenCache wrapped) {} - - [MonoTODO] - public override int Count { - get { return 0; } - } - - [MonoTODO] - public override bool IsSynchronized { - get { return false; } - } - - [MonoTODO] - public override SecurityToken this [string identifier] { - get { return null; } - } - - [MonoTODO] - public override object SyncRoot { - get { return null; } - } - - [MonoTODO] - public override void Add (SecurityToken token) {} - - [MonoTODO] - public override void Clear () {} - - [MonoTODO] - public override bool Contains (SecurityToken token) - { - return false; - } - - [MonoTODO] - public override void CopyTo (Array array, int index) {} - - [MonoTODO] - public override IEnumerator GetEnumerator () - { - return null; - } - - [MonoTODO] - public override void Remove (SecurityToken token) {} - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/TransformChain.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/TransformChain.cs deleted file mode 100644 index 95a0eb07b52..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/TransformChain.cs +++ /dev/null @@ -1,46 +0,0 @@ -// -// TransformChain.cs - TransformChain implementation for XML Signature -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System.Collections; - -#if (WSE1 || WSE2) -using System.Security.Cryptography.Xml; - -namespace Microsoft.Web.Services.Security { -#else -namespace System.Security.Cryptography.Xml { -#endif - public class TransformChain { - - private ArrayList chain; - - public TransformChain() - { - chain = new ArrayList (); - } - - public int Count { - get { return chain.Count; } - } - - public Transform this [int index] { - get { return (Transform) chain [index]; } - } - - public void Add (Transform transform) - { - chain.Add (transform); - } - - public IEnumerator GetEnumerator () - { - return chain.GetEnumerator (); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/UsernameToken.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/UsernameToken.cs deleted file mode 100644 index 8bb9adcac69..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/UsernameToken.cs +++ /dev/null @@ -1,319 +0,0 @@ -// -// UsernameToken.cs: Handles WS-Security UsernameToken -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using Microsoft.Web.Services.Timestamp; - -using System; -using System.Configuration; -using System.Security.Cryptography; -using System.Text; -using System.Web.Services.Protocols; -using System.Xml; - -#if WSE2 -using System.Collections; -#endif - -namespace Microsoft.Web.Services.Security { - - // References: - // a. Section 4.1 - // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnglobspec/html/ws-security.asp - // b. Web Services Security Addendum, Version 1.0, August 18, 2002 - // http://msdn.microsoft.com/library/en-us/dnglobspec/html/ws-security-addendum.asp - // c. WS-Trust, Section 7 - // http://www-106.ibm.com/developerworks/library/ws-trust/ - -#if WSE1 - public sealed class UsernameToken : SecurityToken { -#else - public class UsernameToken : SecurityToken, IMutableSecurityToken { -#endif - static private IPasswordProvider provider; - - private string username; - private string password; - private string digest; - private PasswordOption option; - private DateTime created; - private Nonce nonce; - - static UsernameToken () - { - provider = null; - } - - public UsernameToken (XmlElement element) : base (element) - { - // base will call the LoadXml (element) - } - - public UsernameToken (string username, string password) - : this (username, password, PasswordOption.SendNone) {} - - public UsernameToken (string username, string password, PasswordOption passwordOption) - { - if ((username == null) || (username == "")) - throw new ArgumentNullException ("username"); - if ((password == null) || (password == "")) - throw new ArgumentNullException ("password"); - - this.username = username; - this.password = password; - option = passwordOption; - } - - [MonoTODO ("where is the key derivation described ?")] - public override AuthenticationKey AuthenticationKey { - get { - if (nonce == null) { - // LAMESPEC: undocumented exception - throw new InvalidOperationException ("AuthenticationKey"); - } - return null; - } - } - - public DateTime Created { - get { return created; } - } - - public override DecryptionKey DecryptionKey { - get { throw new NotSupportedException ("DecryptionKey"); } - } - - public override EncryptionKey EncryptionKey { - get { throw new NotSupportedException ("EncryptionKey"); } - } - - public byte[] Nonce { - get { - if (nonce == null) - return null; - return nonce.GetValueBytes (); - } - } - - public string Password { - get { return password; } - } - - public PasswordOption PasswordOption { - get { - if (password == null) - throw new ArgumentException ("no password"); - return option; - } - set { - if (password == null) - throw new ArgumentException ("no password"); - option = value; - } - } - - [MonoTODO ("where is the key derivation described ?")] - public override SignatureKey SignatureKey { - get { - if (password == null) - throw new InvalidOperationException ("no password"); - // TODO: where is the key derivation described ? - return null; - } - } - - public override bool SupportsDataEncryption { - get { return false; } - } - - public override bool SupportsDigitalSignature { - get { return true; } - } - - public string Username { - get { return username; } - } - - // Reference B, Section 6 - // Password_digest = SHA1 ( nonce + created + password ) - private string HashPassword (string password) - { - byte[] n = nonce.GetValueBytes (); - byte[] c = Encoding.UTF8.GetBytes (created.ToString (WSTimestamp.TimeFormat)); - byte[] p = Encoding.UTF8.GetBytes (password); - byte[] toBeDigested = new byte [n.Length + c.Length + p.Length]; - Array.Copy (n, 0, toBeDigested, 0, n.Length); - Array.Copy (c, 0, toBeDigested, n.Length, c.Length); - Array.Copy (p, 0, toBeDigested, (n.Length + c.Length), p.Length); - // protect password - Array.Clear (p, 0, p.Length); - SHA1 hash = SHA1.Create (); - byte[] digest = hash.ComputeHash (toBeDigested); - // protect password - Array.Clear (toBeDigested, 0, toBeDigested.Length); - return Convert.ToBase64String (digest); - } - - public override XmlElement GetXml (XmlDocument document) - { - if (document == null) - throw new ArgumentNullException ("document"); - - // much cleaner than using StringBuilder! - XmlElement xel = document.CreateElement (WSSecurity.Prefix, WSSecurity.ElementNames.UsernameToken, WSSecurity.NamespaceURI); - xel.SetAttribute ("xmlns:" + WSTimestamp.Prefix, WSTimestamp.NamespaceURI); - xel.SetAttribute (WSTimestamp.AttributeNames.Id, WSTimestamp.NamespaceURI, Id); - - XmlElement xelUsername = document.CreateElement (WSSecurity.Prefix, WSSecurity.ElementNames.Username, WSSecurity.NamespaceURI); - xelUsername.InnerText = username; - xel.AppendChild (xelUsername); - - // Nonce and Created are required for hashing the password - if (nonce == null) - nonce = new Nonce (); - // get creation time when serializing - created = DateTime.UtcNow; - - if (option != PasswordOption.SendNone) { - XmlElement xelPassword = document.CreateElement (WSSecurity.Prefix, WSSecurity.ElementNames.Password, WSSecurity.NamespaceURI); - switch (option) { - case PasswordOption.SendHashed: - // no WSSecurity.NamespaceURI because it would add a "wsse" before "Type" - xelPassword.SetAttribute (WSSecurity.AttributeNames.Type, WSSecurity.Prefix + ":PasswordDigest"); - xelPassword.InnerText = HashPassword (password); - break; - case PasswordOption.SendPlainText: - // no WSSecurity.NamespaceURI because it would add a "wsse" before "Type" - xelPassword.SetAttribute (WSSecurity.AttributeNames.Type, WSSecurity.Prefix + ":PasswordText"); - xelPassword.InnerText = password; - break; - } - xel.AppendChild (xelPassword); - } - xel.AppendChild (nonce.GetXml (document)); - XmlElement xelCreated = document.CreateElement (WSTimestamp.Prefix, WSTimestamp.ElementNames.Created, WSTimestamp.NamespaceURI); - xelCreated.InnerText = created.ToString (WSTimestamp.TimeFormat); - xel.AppendChild (xelCreated); - return xel; - } - - public override void LoadXml (XmlElement element) - { - if (element == null) - throw new ArgumentNullException ("element"); - - if ((element.LocalName != WSSecurity.ElementNames.UsernameToken) || (element.NamespaceURI != WSSecurity.NamespaceURI)) - throw new System.ArgumentException ("invalid LocalName or NamespaceURI"); - - // retrieve Id - XmlAttribute xaId = element.Attributes [WSTimestamp.AttributeNames.Id, WSTimestamp.NamespaceURI]; - if (xaId != null) { - Id = xaId.InnerText; - } - // retreive Username - XmlNodeList xnl = element.GetElementsByTagName (WSSecurity.ElementNames.Username, WSSecurity.NamespaceURI); - if ((xnl != null) && (xnl.Count > 0)) { - username = xnl [0].InnerText; - } - // retreive Password (if present), PasswordDigest (if present) or none and set PasswordOption - xnl = element.GetElementsByTagName (WSSecurity.ElementNames.Password, WSSecurity.NamespaceURI); - if ((xnl != null) && (xnl.Count > 0)) { - XmlAttribute pwdType = xnl [0].Attributes [WSSecurity.AttributeNames.Type]; - if (pwdType != null) { - string s = pwdType.InnerText; - if (s.EndsWith (":PasswordDigest")) { - option = PasswordOption.SendHashed; - digest = xnl [0].InnerText; - } - else if (s.EndsWith (":PasswordText")) { - option = PasswordOption.SendPlainText; - password = xnl [0].InnerText; - } - else - throw new Exception ("TODO"); - } - } - else - option = PasswordOption.SendNone; - // retreive Nonce - xnl = element.GetElementsByTagName (WSSecurity.ElementNames.Nonce, WSSecurity.NamespaceURI); - if ((xnl != null) && (xnl.Count > 0)) { - XmlElement xel = (XmlElement) xnl [0]; - if (nonce == null) - nonce = new Nonce (xel); - else - nonce.LoadXml (xel); - } - // retreive Created - xnl = element.GetElementsByTagName (WSTimestamp.ElementNames.Created, WSTimestamp.NamespaceURI); - if ((xnl != null) && (xnl.Count > 0)) { - created = DateTime.ParseExact (xnl [0].InnerText, WSTimestamp.TimeFormat, null); - } - - if (provider == null) - throw new ConfigurationException (Locale.GetText ("No PasswordProvider configured")); - - string providerPassword = provider.GetPassword (this); - switch (option) { - case PasswordOption.SendNone: - break; - case PasswordOption.SendHashed: - if (digest != HashPassword (providerPassword)) - throw new SecurityFault (Locale.GetText ("bad password"), null); - break; - case PasswordOption.SendPlainText: - if (providerPassword != password) - throw new SecurityFault (Locale.GetText ("bad password"), null); - break; - } - } - -#if WSE1 - public override void Verify () {} -#else - public IList AnyElements { - get { return null; } - } - - public SecurityToken Clone () - { - return new UsernameToken (username, password, option); - } - - [MonoTODO ("need to compare results with WSE2")] - public override int GetHashCode () - { - return username.GetHashCode (); - } - - [MonoTODO ("need to compare results with WSE2")] - public override bool Equals (SecurityToken token) - { - if (token is UsernameToken) { - UsernameToken t = token as UsernameToken; - if ((t.Username == username) && (t.PasswordOption == option)) { - // 1st case - we have a textual password (SendPlainText) - if (password != null) - return (t.Password == password); - // we may not have the actual password if we're created - // with the UsernameToken(XmlElement) constructor. - // TODO: compare hashed password - // however we can't compare two UsernameToken coming - // both from UsernameToken(XmlElement) constructor - return false; - } - } - return false; - } - - public override bool IsCurrent { - get { return false; } - } -#endif - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/WSEReplayCache.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/WSEReplayCache.cs deleted file mode 100644 index 36f7d62af7a..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/WSEReplayCache.cs +++ /dev/null @@ -1,22 +0,0 @@ -// -// WSEReplayCache.cs - WSE IReplayCache default implementation -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using Microsoft.Web.Services; - -namespace Microsoft.Web.Services.Security { - - public class WSEReplayCache : IReplayCache { - - public WSEReplayCache () {} - - [MonoTODO] - public void ProcessMessage (SoapEnvelope envelope) {} - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/WSSecurity.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/WSSecurity.cs deleted file mode 100644 index f2093836833..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/WSSecurity.cs +++ /dev/null @@ -1,58 +0,0 @@ -// -// WSSecurity.cs: Handles WS-Security WSSecurity -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// -// Licensed under MIT X11 (see LICENSE) with this specific addition: -// -// “This source code may incorporate intellectual property owned by Microsoft -// Corporation. Our provision of this source code does not include any licenses -// or any other rights to you under any Microsoft intellectual property. If you -// would like a license from Microsoft (e.g. rebrand, redistribute), you need -// to contact Microsoft directly.” -// - -using System; - -namespace Microsoft.Web.Services.Security { - - public sealed class WSSecurity { - - // LAMESPEC AttributeNames aren't documented - public class AttributeNames { - - public const string EncodingType = "EncodingType"; - public const string IdentifierType = "IdentifierType"; - public const string TokenType = "TokenType"; - public const string Type = "Type"; - public const string Uri = "URI"; - public const string ValueType = "ValueType"; - - public AttributeNames () {} - } - - // LAMESPEC ElementNames aren't documented - public class ElementNames { - - public const string BinarySecurityToken = "BinarySecurityToken"; - public const string KeyIdentifier = "KeyIdentifier"; - public const string Nonce = "Nonce"; - public const string Password = "Password"; - public const string Reference = "Reference"; - public const string Security = "Security"; - public const string SecurityTokenReference = "SecurityTokenReference"; - public const string Username = "Username"; - public const string UsernameToken = "UsernameToken"; - - public ElementNames () {} - } - - public const string NamespaceURI = "http://schemas.xmlsoap.org/ws/2002/07/secext"; - public const string Prefix = "wsse"; - - public WSSecurity () {} - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/X509SecurityToken.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/X509SecurityToken.cs deleted file mode 100644 index 38304b37a02..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/X509SecurityToken.cs +++ /dev/null @@ -1,159 +0,0 @@ -// -// X509SecurityToken.cs: Handles WS-Security X509SecurityToken -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Web.Services.Protocols; -using System.Xml; -using Microsoft.Web.Services.Security.X509; - -namespace Microsoft.Web.Services.Security { - - public sealed class X509SecurityToken : BinarySecurityToken { - - private const string vname = "X509v3"; - private X509Certificate x509; - private EncryptionKey ek; - - public X509SecurityToken (X509Certificate certificate) - : base (new XmlQualifiedName (vname, WSSecurity.NamespaceURI)) - { - if (certificate == null) - throw new ArgumentNullException ("certificate"); - x509 = certificate; - } - - public X509SecurityToken (XmlElement element) : base (element) - { - // ancestor will call LoadXml (element) - } - - public override AuthenticationKey AuthenticationKey { - get { - if (x509 == null) - throw new InvalidOperationException ("null certificate"); - if (!x509.SupportsDigitalSignature) - throw new InvalidOperationException ("not SupportsDigitalSignature"); - return new AuthenticationKey (x509.PublicKey); - } - } - - public X509Certificate Certificate { - get { return x509; } - set { -// LAMESPEC if (value == null) -// throw new ArgumentNullException ("value"); -// Note: this (probable bug) means we have to check for null everytime we use a certificate - x509 = value; - } - } - - public override DecryptionKey DecryptionKey { - get { - if (x509 == null) - throw new InvalidOperationException ("null certificate"); - return new AsymmetricDecryptionKey (x509.Key); - } - } - - public override EncryptionKey EncryptionKey { - get { - if (x509 == null) - throw new InvalidOperationException ("null certificate"); - if (ek == null) { - SecurityTokenReference str = new SecurityTokenReference (); - str.KeyIdentifier = new KeyIdentifier (x509.GetKeyIdentifier (), valueType); - XmlQualifiedName xqn = new XmlQualifiedName ("X509v3", WSSecurity.NamespaceURI); - ek = new AsymmetricEncryptionKey (x509.PublicKey); - ek.KeyInfo.AddClause (str); - } - return ek; - } - } - - public override byte[] RawData { - get { - if (x509 == null) - return null; - return x509.GetRawCertData(); - } - set { - if (value == null) - throw new ArgumentNullException ("value"); - x509 = new X509Certificate (value); - } - } - - public override SignatureKey SignatureKey { - get { - if (x509 == null) - throw new InvalidOperationException ("null certificate"); - if (!x509.SupportsDigitalSignature) - throw new InvalidOperationException ("not SupportsDigitalSignature"); - return new SignatureKey (x509.Key); - } - } - - public override bool SupportsDataEncryption { - get { - if (x509 == null) - throw new InvalidOperationException ("null certificate"); - return x509.SupportsDataEncryption; - } - } - - public override bool SupportsDigitalSignature { - get { - if (x509 == null) - throw new InvalidOperationException ("null certificate"); - return x509.SupportsDigitalSignature; - } - } - - public override XmlQualifiedName ValueType { - get { return valueType; } - set { - if ((value.Name != vname) || (value.Namespace != WSSecurity.NamespaceURI)) - throw new SecurityFormatException ("Invalid Qualified Name"); - valueType = value; - } - } - -#if WSE1 - public override void Verify () - { - if (x509 == null) - throw new SecurityFault ("null certificate", null); - if (!x509.IsCurrent) - throw new SecurityFault ("certificate not current", null); - // more ??? - // it's assumed valid if no exception is thrown - } -#else - [MonoTODO ("need to compare results with WSE2")] - public override int GetHashCode () - { - return x509.GetHashCode (); - } - - [MonoTODO ("need to compare results with WSE2")] - public override bool Equals (SecurityToken token) - { - X509SecurityToken x = (token as X509SecurityToken); - if (x != null) { - return (x.Certificate.Equals (x509)); - } - return false; - } - - public override bool IsCurrent { - get { return x509.IsCurrent; } - } -#endif - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/XmlDsigExcC14NTransform.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/XmlDsigExcC14NTransform.cs deleted file mode 100644 index 0637bd95551..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/XmlDsigExcC14NTransform.cs +++ /dev/null @@ -1,125 +0,0 @@ -// -// XmlDsigExcC14NTransform.cs: -// Handles WS-Security XmlDsigExcC14NTransform -// -// Author: -// Sebastien Pouliot -// Aleksey Sanin (aleksey@aleksey.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// (C) 2003 Aleksey Sanin (aleksey@aleksey.com) -// (C) 2004 Novell (http://www.novell.com) -// - -using System; -using System.IO; -using System.Security.Cryptography.Xml; -using System.Xml; - -using Mono.Xml; - -namespace Microsoft.Web.Services.Security { - - public class XmlDsigExcC14NTransform : Transform { - - public const string XmlDsigExcC14NTransformUrl = "http://www.w3.org/2001/10/xml-exc-c14n#"; - public const string XmlDsigExcC14NWithCommentsTransformUrl = "http://www.w3.org/2001/10/xml-exc-c14n#WithComments"; - - private Type[] input; - private Type[] output; - private XmlCanonicalizer canonicalizer; - private Stream s; - private string prefixList; - private bool comments; - - public XmlDsigExcC14NTransform () : this (false) - { - } - - public XmlDsigExcC14NTransform (bool includeComments) - { - comments = includeComments; - canonicalizer = new XmlCanonicalizer (includeComments, true); - } - - public XmlDsigExcC14NTransform (string inclusiveNamespacesPrefixList) - : this (false, inclusiveNamespacesPrefixList) - { - } - - public XmlDsigExcC14NTransform (bool includeComments, string inclusiveNamespacesPrefixList) - : this (includeComments) - { - prefixList = inclusiveNamespacesPrefixList; - } - - public string InclusiveNamespacesPrefixList { - get { return prefixList; } - set { prefixList = value; } - } - - public override Type[] InputTypes { - get { - if (input == null) { - lock (this) { - // this way the result is cached if called multiple time - input = new Type [3]; - input[0] = typeof (System.IO.Stream); - input[1] = typeof (System.Xml.XmlDocument); - input[2] = typeof (System.Xml.XmlNodeList); - } - } - return input; - } - } - - public override Type[] OutputTypes { - get { - if (output == null) { - lock (this) { - // this way the result is cached if called multiple time - output = new Type [1]; - output[0] = typeof (System.IO.Stream); - } - } - return output; - } - } - protected override XmlNodeList GetInnerXml () - { - return null; // THIS IS DOCUMENTED AS SUCH - } - - public override object GetOutput () - { - return (object) s; - } - - public override object GetOutput (Type type) - { - if (type != typeof (Stream)) - throw new ArgumentException ("type"); - return GetOutput (); - } - - public override void LoadInnerXml (XmlNodeList nodeList) - { - // documented as not changing the state of the transform - } - - public override void LoadInput (object obj) - { - if (obj is Stream) { - s = (obj as Stream); - XmlDocument doc = new XmlDocument (); - doc.PreserveWhitespace = true; // REALLY IMPORTANT - doc.Load (obj as Stream); - s = canonicalizer.Canonicalize (doc); - } else if (obj is XmlDocument) - s = canonicalizer.Canonicalize ((obj as XmlDocument)); - else if (obj is XmlNodeList) - s = canonicalizer.Canonicalize ((obj as XmlNodeList)); - // note: there is no default are other types won't throw an exception - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/XmlDsigExcC14NWithCommentsTransform.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/XmlDsigExcC14NWithCommentsTransform.cs deleted file mode 100644 index 923a592bc47..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/XmlDsigExcC14NWithCommentsTransform.cs +++ /dev/null @@ -1,30 +0,0 @@ -// -// XmlDsigExcC14NWithCommentsTransform.cs: -// Handles WS-Security XmlDsigExcC14NWithCommentsTransform -// -// Author: -// Sebastien Pouliot -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// (C) 2004 Novell (http://www.novell.com) -// - -using System; -using System.Security.Cryptography.Xml; -using System.Xml; - -namespace Microsoft.Web.Services.Security { - - public class XmlDsigExcC14NWithCommentsTransform : XmlDsigExcC14NTransform { - - public XmlDsigExcC14NWithCommentsTransform () - : base (true) - { - } - - public XmlDsigExcC14NWithCommentsTransform (string inclusiveNamespacesPrefixList) - : base (true, inclusiveNamespacesPrefixList) - { - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/XmlEncryption.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/XmlEncryption.cs deleted file mode 100644 index c2219562e0f..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/XmlEncryption.cs +++ /dev/null @@ -1,87 +0,0 @@ -// -// XmlEncryption.cs: Handles WS-Security XmlEncryption -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// -// Licensed under MIT X11 (see LICENSE) with this specific addition: -// -// “This source code may incorporate intellectual property owned by Microsoft -// Corporation. Our provision of this source code does not include any licenses -// or any other rights to you under any Microsoft intellectual property. If you -// would like a license from Microsoft (e.g. rebrand, redistribute), you need -// to contact Microsoft directly.” -// - -using System; - -namespace Microsoft.Web.Services.Security { - - public sealed class XmlEncryption { - - public sealed class AlgorithmURI { - - public const string AES128 = "http://www.w3.org/2001/04/xmlenc#aes128-cbc"; - public const string AES128KeyWrap = "http://www.w3.org/2001/04/xmlenc#kw-aes128"; - public const string AES192 = "http://www.w3.org/2001/04/xmlenc#aes192-cbc"; - public const string AES192KeyWrap = "http://www.w3.org/2001/04/xmlenc#kw-aes192"; - public const string AES256 = "http://www.w3.org/2001/04/xmlenc#aes256-cbc"; - public const string AES256KeyWrap = "http://www.w3.org/2001/04/xmlenc#kw-aes256"; - public const string DES = "http://www.w3.org/2001/04/xmlenc#des-cbc"; - public const string RSA15 = "http://www.w3.org/2001/04/xmlenc#rsa-1_5"; - public const string RSAOAEP = "http://www.w3.org/2001/04/xmlenc#rsa-aoep-mgf1pl"; - public const string SHA1 = "http://www.w3.org/2000/09/xmldsig#sha1"; - public const string SHA256 = "http://www.w3.org/2001/04/xmlenc#sha256"; - public const string SHA512 = "http://www.w3.org/2001/04/xmlenc#sha512"; - public const string TripleDES = "http://www.w3.org/2001/04/xmlenc#tripledes-cbc"; - public const string TripleDESKeyWrap = "http://www.w3.org/2001/04/xmlenc#kw-tripledes"; - - public AlgorithmURI () {} - } - - public sealed class AttributeNames { - - public const string Algorithm = "Algorithm"; - //LAMESPEC public const string EncodingType = "EncodingType"; - public const string Id = "Id"; - //LAMESPEC public const string IdentifierType = "IdentifierType"; - //LAMESPEC public const string TokenType = "TokenType"; - public const string Type = "Type"; - //LAMESPEC public const string Uri = "Uri"; - public const string URI = "URI"; - //LAMESPEC public const string ValueType = "ValueType"; - - public AttributeNames () {} - } - - // LAMESPEC ElementNames aren't documented - public sealed class ElementNames { - - public const string CipherData = "CipherData"; - public const string CipherValue = "CipherValue"; - public const string DataReference = "DataReference"; - public const string EncryptedData = "EncryptedData"; - public const string EncryptedKey = "EncryptedKey"; - public const string EncryptionMethod = "EncryptionMethod"; - public const string ReferenceList = "ReferenceList"; - - public ElementNames () {} - } - - public sealed class TypeURI { - - public const string Content = "http://www.w3.org/2001/04/xmlenc#Content"; - public const string Element = "http://www.w3.org/2001/04/xmlenc#Element"; - public const string EncryptedKey = "http://www.w3.org/2001/04/xmlenc#EncryptedKey"; - - public TypeURI () {} - } - - public const string NamespaceURI = "http://www.w3.org/2001/04/xmlenc#"; - public const string Prefix = "xenc"; - - public XmlEncryption () {} - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/XmlSignature.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/XmlSignature.cs deleted file mode 100644 index 479000d8c47..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/XmlSignature.cs +++ /dev/null @@ -1,69 +0,0 @@ -// -// XmlSignature.cs: Handles WS-Security XmlSignature -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services.Security { - - public sealed class XmlSignature { - - public class ElementNames { - - // LAMESPEC: public const string BinarySecurityToken = ""; - // LAMESPEC: public const string CipherData = ""; - // LAMESPEC: public const string CipherValue = ""; - // LAMESPEC: public const string DataReference = ""; - // LAMESPEC: public const string EncryptedData = ""; - // LAMESPEC: public const string EncryptedKey = ""; - // LAMESPEC: public const string EncryptionMethod = ""; - // LAMESPEC: public const string KeyIdentifier = ""; - public const string KeyInfo = "KeyInfo"; - public const string KeyName = "KeyName"; - // LAMESPEC: public const string Nonce = ""; - // LAMESPEC: public const string Password = ""; - // LAMESPEC: public const string Reference = ""; - // LAMESPEC: public const string ReferenceList = ""; - // LAMESPEC: public const string Security = ""; - // LAMESPEC: public const string SecurityTokenReference = ""; - public const string Signature = "Signature"; - // LAMESPEC: public const string Username = ""; - // LAMESPEC: public const string UsernameToken = ""; - - // to be compatible with Mono implementation of System.Security - internal const string CanonicalizationMethod = "CanonicalizationMethod"; - internal const string HMACOutputLength = "HMACOutputLength"; - internal const string Reference = "Reference"; - internal const string SignatureMethod = "SignatureMethod"; - internal const string SignedInfo = "SignedInfo"; - internal const string Transform = "Transform"; - internal const string Transforms = "Transforms"; - internal const string DigestMethod = "DigestMethod"; - internal const string DigestValue = "DigestValue"; - internal const string SignatureValue = "SignatureValue"; - internal const string Object = "Object"; - - public ElementNames () {} - } - - internal class AttributeNames { - - internal const string Algorithm = "Algorithm"; - internal const string Id = "Id"; - internal const string URI = "URI"; - internal const string Type = "Type"; - - public AttributeNames () {} - } - - public const string NamespaceURI = "http://www.w3.org/2000/09/xmldsig#"; - public const string Prefix = "ds"; - - public XmlSignature () {} - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/Xmltok.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/Xmltok.cs deleted file mode 100644 index 36bf70d05fb..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/Xmltok.cs +++ /dev/null @@ -1,22 +0,0 @@ -// -// Xmltok.cs - WS-Security Profile for XML-based Tokens -// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnglobspec/html/ws-security-xml-tokens.asp -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services.Security { - - public class Xmltok { - - public const string NamespaceURI = "http://schemas.xmlsoap.org/ws/2002/08/xmltok"; - public const string Prefix = "tok"; - - public Xmltok () {} - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/XrML.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/XrML.cs deleted file mode 100644 index b1028ec7935..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/XrML.cs +++ /dev/null @@ -1,35 +0,0 @@ -// -// XrML.cs - eXtensible rights Markup Language (http://www.xrml.org/) -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services.Security { - - public class XrML { - - public class AttributeNames { - - public const string RefType = "RefType"; - - public AttributeNames () {} - } - - public class ElementNames { - - public const string License = "license"; - - public ElementNames () {} - } - - public const string NamespaceURI = "urn:oasis:names:tc:WSS:1.0:bindings:WSS-XrML-binding"; - public const string Prefix = "xrml"; - - public XrML () {} - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/ChangeLog b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/ChangeLog deleted file mode 100644 index b9347fe0244..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/ChangeLog +++ /dev/null @@ -1,11 +0,0 @@ -2003-10-22 Todd Berman - - * TimestampOutputFilter.cs: WSE2 Runtime fix - -2003-10-05 Sebastien Pouliot - - * TimestampFormatException.cs: Use Locale.GetText and removed I18N todo. - -2003-09-04 Sebastien Pouliot - - * TimestampFormatException.cs: Added missing strings and #if for WSE2. diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/Received.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/Received.cs deleted file mode 100644 index d9afd2b9097..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/Received.cs +++ /dev/null @@ -1,126 +0,0 @@ -// -// Received.cs: -// Handles WS-Security "Utility" Timestamp Received -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// -// Licensed under MIT X11 (see LICENSE) with this specific addition: -// -// “This source code may incorporate intellectual property owned by Microsoft -// Corporation. Our provision of this source code does not include any licenses -// or any other rights to you under any Microsoft intellectual property. If you -// would like a license from Microsoft (e.g. rebrand, redistribute), you need -// to contact Microsoft directly.” -// - -using System; -using System.Xml; -using Microsoft.Web.Services; -#if !WSE1 -using Microsoft.Web.Services.Xml; -#endif - -namespace Microsoft.Web.Services.Timestamp { - - public class Received : IXmlElement { - - private string id; - private string idNS; - private Uri actor; - private long delay; - private DateTime received; - - public Received (Uri actor) - { - if (actor == null) - throw new ArgumentNullException ("actor"); - this.actor = actor; - received = DateTime.UtcNow; - } - - public Received (XmlElement element) - { - LoadXml (element); - } - - public Uri Actor { - get { return actor; } - set { - if (value == null) - throw new ArgumentNullException ("actor"); - actor = value; - } - } - - public long Delay { - get { return delay; } - set { - if (delay < 0) - throw new ArgumentException ("negative delay"); - delay = value; - } - } - - public DateTime Value { - get { return received; } - set { received = value; } - } - - public XmlElement GetXml (XmlDocument document) - { - if (document == null) - throw new System.ArgumentNullException ("document"); - - // much cleaner than using StringBuilder! - XmlElement xel = document.CreateElement (WSTimestamp.Prefix, WSTimestamp.ElementNames.Received, WSTimestamp.NamespaceURI); - // xel.SetAttribute (WSTimestamp.AttributeNames.Actor, actor.AbsoluteUri); - if (delay > 0) - xel.SetAttribute (WSTimestamp.AttributeNames.Delay, delay.ToString ()); - // FIXME: commented for WSE compatibility - // if (id != null) - // xel.SetAttribute (WSTimestamp.AttributeNames.Id, idNS, id); - xel.InnerText = received.ToString (WSTimestamp.TimeFormat); - return xel; - } - - public void LoadXml (XmlElement element) - { - if (element == null) - throw new System.ArgumentNullException ("element"); - - if ((element.LocalName != WSTimestamp.ElementNames.Received) || (element.NamespaceURI != WSTimestamp.NamespaceURI)) - throw new System.ArgumentException ("invalid LocalName or NamespaceURI"); - - XmlAttribute xa = element.Attributes [WSTimestamp.AttributeNames.Id, WSTimestamp.NamespaceURI]; - id = ((xa == null) ? null : xa.Value); - idNS = ((xa == null) ? null : xa.NamespaceURI); - - xa = element.Attributes [WSTimestamp.AttributeNames.Actor]; - if (xa == null) - throw new TimestampFormatException (TimestampFormatException.MissingActorAttributeInReceivedElement); - string actorAttribute = xa.InnerText; - if (actorAttribute == null) - throw new TimestampFormatException (TimestampFormatException.MissingActorAttributeInReceivedElement); - actor = new Uri (actorAttribute); - - xa = element.Attributes [WSTimestamp.AttributeNames.Delay]; - if (xa != null) { - string delayAttribute = xa.InnerText; - if (delayAttribute.StartsWith ("+")) - throw new TimestampFormatException (TimestampFormatException.DelayAttributeWithPlusSign); - try { - delay = Convert.ToInt64 (delayAttribute); - } - catch { - throw new TimestampFormatException (TimestampFormatException.BadDelayAttribute); - } - } - - received = DateTime.ParseExact (element.InnerText, WSTimestamp.TimeFormat, null); - received = received.ToUniversalTime (); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/ReceivedCollection.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/ReceivedCollection.cs deleted file mode 100644 index f4a824d8d30..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/ReceivedCollection.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -// ReceivedCollection.cs: -// Handles a collection of Received objects -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// -// Licensed under MIT X11 (see LICENSE) with this specific addition: -// -// “This source code may incorporate intellectual property owned by Microsoft -// Corporation. Our provision of this source code does not include any licenses -// or any other rights to you under any Microsoft intellectual property. If you -// would like a license from Microsoft (e.g. rebrand, redistribute), you need -// to contact Microsoft directly.” -// - -using System; -using System.Collections; - -namespace Microsoft.Web.Services.Timestamp { - - public class ReceivedCollection : ICollection, IEnumerable { - - private ArrayList list; - - public ReceivedCollection() - { - list = new ArrayList (); - } - - public int Count { - get { return list.Count; } - } - - public bool IsSynchronized { - get { return list.IsSynchronized; } - } - - public Received this [int index] { - get { return (Received) list [index]; } - } - - public object SyncRoot { - get { return list.SyncRoot; } - } - - public void Add (Received received) - { - if (received == null) - throw new System.ArgumentNullException ("received"); - list.Add (received); - } - - public bool Contains (Received received) - { - return list.Contains (received); - } - - public void CopyTo (Array array, int index) - { - list.CopyTo (array, index); - } - - public IEnumerator GetEnumerator () - { - return list.GetEnumerator (); - } - - public void Remove (Received received) - { - list.Remove (received); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/Timestamp.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/Timestamp.cs deleted file mode 100644 index c0fc34637dc..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/Timestamp.cs +++ /dev/null @@ -1,185 +0,0 @@ -// -// Timestamp.cs: Handles WS-Security "Utility" Timestamp -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// -// Licensed under MIT X11 (see LICENSE) with this specific addition: -// -// “This source code may incorporate intellectual property owned by Microsoft -// Corporation. Our provision of this source code does not include any licenses -// or any other rights to you under any Microsoft intellectual property. If you -// would like a license from Microsoft (e.g. rebrand, redistribute), you need -// to contact Microsoft directly.” -// - -using System; -using System.Web.Services.Protocols; -using System.Xml; -using Microsoft.Web.Services; -#if !WSE1 -using Microsoft.Web.Services.Xml; -#endif - -namespace Microsoft.Web.Services.Timestamp { - - // References - // a. Web Services Security Addendum, Version 1.0, August 18, 2002 - // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnglobspec/html/ws-security.asp - - public class Timestamp : SoapHeader, IXmlElement { - - private string id; - private string idNS; - private DateTime created; - private string createdId; - private string createdIdNS; - private DateTime expired; - private string expiredId; - private string expiredIdNS; - private ReceivedCollection rcoll; - private long timeToLive; - - public Timestamp () - { - created = DateTime.MinValue; - expired = DateTime.MaxValue; - timeToLive = 300000; // 5 minutes - rcoll = new ReceivedCollection (); - } - - // we must be able to fix both creation and expiration - internal void SetTimestamp (DateTime c) - { - created = c; - expired = created.AddMilliseconds (timeToLive); - } - - public new string Actor { - get { return base.Actor; } - } - - public DateTime Created { - get { return created; } - } - - public DateTime Expires { - get { return expired; } - } - - public ReceivedCollection Receivers { - get { return rcoll; } - } - - public long Ttl { - get { return timeToLive; } - set { - if (value < 0) - throw new System.ArgumentException ("value"); - if (value == 0) - expired = DateTime.MaxValue; - timeToLive = value; - } - } - - // syntactically correct - // no checks are done on the dates themselves ! - public void CheckValid () - { - if (created == DateTime.MinValue) - throw new TimestampFormatException (TimestampFormatException.MissingCreatedElement); - } - - public XmlElement GetXml (XmlDocument document) - { - if (document == null) - throw new System.ArgumentNullException ("document"); - - // much cleaner than using StringBuilder! - XmlElement xel = document.CreateElement (WSTimestamp.Prefix, WSTimestamp.ElementNames.Timestamp, WSTimestamp.NamespaceURI); - // FIXME: commented for WSE preview compatibility - // if (id != null) - // xel.SetAttribute (WSTimestamp.AttributeNames.Id, idNS, id); - - if (created != DateTime.MinValue) { - XmlElement xelCreated = document.CreateElement (WSTimestamp.Prefix, WSTimestamp.ElementNames.Created, WSTimestamp.NamespaceURI); - xelCreated.InnerText = created.ToString (WSTimestamp.TimeFormat); - if (createdId != null) - xelCreated.SetAttribute (WSTimestamp.AttributeNames.Id, createdIdNS, createdId); - xel.AppendChild (xelCreated); - } - if (expired != DateTime.MaxValue) { - XmlElement xelExpires = document.CreateElement (WSTimestamp.Prefix, WSTimestamp.ElementNames.Expires, WSTimestamp.NamespaceURI); - xelExpires.InnerText = expired.ToString (WSTimestamp.TimeFormat); - if (expiredId != null) - xelExpires.SetAttribute (WSTimestamp.AttributeNames.Id, expiredIdNS, expiredId); - xel.AppendChild (xelExpires); - } - for (int i=0; i < rcoll.Count ; i++) - { - XmlElement received = rcoll[i].GetXml (document); - xel.AppendChild (received); - } - return xel; - } - - public void LoadXml (XmlElement element) - { - if (element == null) - throw new System.ArgumentNullException ("element"); - - if ((element.LocalName != WSTimestamp.ElementNames.Timestamp) || (element.NamespaceURI != WSTimestamp.NamespaceURI)) - throw new System.ArgumentException ("invalid LocalName or NamespaceURI"); - - XmlAttribute xa = element.Attributes [WSTimestamp.AttributeNames.Id, WSTimestamp.NamespaceURI]; - id = ((xa == null) ? null : xa.Value); - idNS = ((xa == null) ? null : xa.NamespaceURI); - - XmlNodeList xnl = element.GetElementsByTagName (WSTimestamp.ElementNames.Created, WSTimestamp.NamespaceURI); - if (xnl != null) { - switch (xnl.Count) { - case 0: -// throw new TimestampFormatException (TimestampFormatException.MissingCreatedElement); - break; - case 1: - created = DateTime.ParseExact (xnl[0].InnerText, WSTimestamp.TimeFormat, null); - created = created.ToUniversalTime (); - xa = xnl[0].Attributes [WSTimestamp.AttributeNames.Id, WSTimestamp.NamespaceURI]; - createdId = ((xa == null) ? null : xa.Value); - createdIdNS = ((xa == null) ? null : xa.NamespaceURI); - break; - default: - throw new TimestampFormatException (TimestampFormatException.DuplicateCreatedElement); - } - } - - xnl = element.GetElementsByTagName (WSTimestamp.ElementNames.Expires, WSTimestamp.NamespaceURI); - if (xnl != null) { - switch (xnl.Count) { - case 0: -// throw new TimestampFormatException (TimestampFormatException.MissingCreatedElement); - break; - case 1: - expired = DateTime.ParseExact (xnl[0].InnerText, WSTimestamp.TimeFormat, null); - expired = expired.ToUniversalTime (); - xa = xnl[0].Attributes [WSTimestamp.AttributeNames.Id, WSTimestamp.NamespaceURI]; - expiredId = ((xa == null) ? null : xa.Value); - expiredIdNS = ((xa == null) ? null : xa.NamespaceURI); - break; - default: - throw new TimestampFormatException (TimestampFormatException.DuplicateCreatedElement); - } - } - - xnl = element.GetElementsByTagName (WSTimestamp.ElementNames.Received, WSTimestamp.NamespaceURI); - if (xnl != null) { - for (int i=0; i < xnl.Count; i++) { - Received r = new Received ((XmlElement)xnl [i]); - rcoll.Add (r); - } - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/TimestampFault.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/TimestampFault.cs deleted file mode 100644 index c60612b6857..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/TimestampFault.cs +++ /dev/null @@ -1,28 +0,0 @@ -// -// TimestampFault.cs: Undocument exception when message expires -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// -// Licensed under MIT X11 (see LICENSE) with this specific addition: -// -// “This source code may incorporate intellectual property owned by Microsoft -// Corporation. Our provision of this source code does not include any licenses -// or any other rights to you under any Microsoft intellectual property. If you -// would like a license from Microsoft (e.g. rebrand, redistribute), you need -// to contact Microsoft directly.” -// - -using System; -using System.Web.Services.Protocols; -using System.Xml; - -namespace Microsoft.Web.Services.Timestamp { - - internal class TimestampFault : SoapHeaderException { - - public TimestampFault (string message, XmlQualifiedName code) : base (message, code) {} - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/TimestampFormatException.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/TimestampFormatException.cs deleted file mode 100644 index 5207acec8f7..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/TimestampFormatException.cs +++ /dev/null @@ -1,46 +0,0 @@ -// -// Microsoft.Web.Services.Timestamp.TimestampFormatException.cs -// -// Authors: -// Daniel Kornhauser -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) Ximian, Inc. 2003. -// Portions (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Web.Services.Protocols; -using System.Xml; - -namespace Microsoft.Web.Services.Timestamp { - - [Serializable] - public class TimestampFormatException : SoapHeaderException { - public static readonly string BadDelayAttribute = Locale.GetText ("Bad Delay Attribute"); - public static readonly string DelayAttributeWithPlusSign = Locale.GetText ("Delay Attribute With Plus Sign"); - public static readonly string DuplicateCreatedElement = Locale.GetText ("Duplicate Created Element"); - public static readonly string DuplicateExpiresElement = Locale.GetText ("Duplicate Expires Element"); - public static readonly string MissingActorAttributeInReceivedElement = Locale.GetText ("Missing Actor Attribute In Received Element"); - public static readonly string MissingCreatedElement = Locale.GetText ("Missing Created Element"); - public static readonly string MoreThanOneTimestampHeaders = Locale.GetText ("More Than One Timestamp Headers"); -#if WSE2 - public static readonly string BadActorAttribute = Locale.GetText ("Bad Actor Attribute"); - public static readonly string BadCreatedElement = Locale.GetText ("Bad Created Element"); - public static readonly string BadExpiresElement = Locale.GetText ("Bad Expires Element"); - public static readonly string BadNamespaceForActor = Locale.GetText ("Bad Namespace For Actor"); - public static readonly string BadNamespaceForMustUnderstand = Locale.GetText ("Bad Namespace For MustUnderstand"); - public static readonly string BadReceivedElement = Locale.GetText ("Bad Received Element"); - public static readonly string BadTimestampActorAttribute = Locale.GetText ("BadTimestamp Actor Attribute"); - public static readonly string DuplicateActorAttribute = Locale.GetText ("Duplicate Actor Attribute"); - public static readonly string DuplicateDelayAttribute = Locale.GetText ("Duplicate Delay Attribute"); -#endif - public TimestampFormatException (string message) - : base (message, XmlQualifiedName.Empty) {} - -#if WSE2 - public TimestampFormatException (string message, Exception ex) - : base (message, XmlQualifiedName.Empty, ex) {} -#endif - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/TimestampInputFilter.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/TimestampInputFilter.cs deleted file mode 100644 index 35ce0c5eed4..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/TimestampInputFilter.cs +++ /dev/null @@ -1,48 +0,0 @@ -// -// TimestampInputFilter.cs: Timestamp SOAP Input Filter -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// -// Licensed under MIT X11 (see LICENSE) with this specific addition: -// -// “This source code may incorporate intellectual property owned by Microsoft -// Corporation. Our provision of this source code does not include any licenses -// or any other rights to you under any Microsoft intellectual property. If you -// would like a license from Microsoft (e.g. rebrand, redistribute), you need -// to contact Microsoft directly.” -// - -using System; -using System.Xml; - -namespace Microsoft.Web.Services.Timestamp { - - // Reference: - // 1. Inside the Web Services Enhancements Pipeline - // http://msdn.microsoft.com/library/en-us/dnwebsrv/html/insidewsepipe.asp - - public class TimestampInputFilter : SoapInputFilter { - - public TimestampInputFilter () {} - - public override void ProcessMessage (SoapEnvelope envelope) - { - if (envelope == null) - throw new ArgumentNullException ("envelope"); - - if (envelope.Header != null) { - XmlNodeList xnl = envelope.Header.GetElementsByTagName (WSTimestamp.ElementNames.Timestamp, WSTimestamp.NamespaceURI); - if ((xnl != null) && (xnl.Count > 0)) { - XmlElement xel = (XmlElement) xnl [0]; - envelope.Context.Timestamp.LoadXml (xel); - if (envelope.Context.Timestamp.Expires < DateTime.UtcNow) - throw new TimestampFault ("Message Expired", null); - envelope.Header.RemoveChild (xel); - } - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/TimestampOutputFilter.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/TimestampOutputFilter.cs deleted file mode 100644 index 590c4d87d90..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/TimestampOutputFilter.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -// TimestampOutputFilter.cs: Timestamp SOAP Output Filter -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// -// Licensed under MIT X11 (see LICENSE) with this specific addition: -// -// “This source code may incorporate intellectual property owned by Microsoft -// Corporation. Our provision of this source code does not include any licenses -// or any other rights to you under any Microsoft intellectual property. If you -// would like a license from Microsoft (e.g. rebrand, redistribute), you need -// to contact Microsoft directly.” -// - -using System; -using System.Xml; - -namespace Microsoft.Web.Services.Timestamp { - - public class TimestampOutputFilter : SoapOutputFilter { - - public TimestampOutputFilter () {} - - public override void ProcessMessage (SoapEnvelope envelope) - { - if (envelope == null) - throw new ArgumentNullException ("envelope"); - - // internal method - envelope.Context.Timestamp.SetTimestamp (DateTime.UtcNow); - XmlElement xel = envelope.Context.Timestamp.GetXml (envelope); - if (envelope.Header == null) { - XmlElement header = envelope.CreateHeader (); - envelope.Envelope.PrependChild (xel); - } - envelope.Header.AppendChild (xel); - } - - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/WSTimestamp.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/WSTimestamp.cs deleted file mode 100644 index 3fae0e7c6cb..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/WSTimestamp.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -// WSTimestamp.cs: WSTimestamp definitions -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// -// Licensed under MIT X11 (see LICENSE) with this specific addition: -// -// “This source code may incorporate intellectual property owned by Microsoft -// Corporation. Our provision of this source code does not include any licenses -// or any other rights to you under any Microsoft intellectual property. If you -// would like a license from Microsoft (e.g. rebrand, redistribute), you need -// to contact Microsoft directly.” -// - -using System; - -namespace Microsoft.Web.Services.Timestamp { - - public class WSTimestamp { - - public class AttributeNames { - - public const string Actor = "Actor"; - public const string Delay = "Delay"; - public const string Id = "Id"; - public const string ValueType = "ValueType"; - - public AttributeNames () {} - } - - public class ElementNames { - - public const string Created = "Created"; - public const string Expires = "Expires"; - public const string Received = "Received"; - public const string Timestamp = "Timestamp"; - - public ElementNames () {} - } - - public const string NamespaceURI = "http://schemas.xmlsoap.org/ws/2002/07/utility"; - public const string Prefix = "wsu"; - public const string TimeFormat = "yyyy-MM-ddTHH:mm:ssZ"; - - public WSTimestamp () {} - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Xml/ChangeLog b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Xml/ChangeLog deleted file mode 100644 index 715e543e04f..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Xml/ChangeLog +++ /dev/null @@ -1,17 +0,0 @@ -2003-10-12 Todd Berman - - * QualifiedName.cs (FromString): fix from nunit tests - -2003-10-08 Todd Berman - - * QualifiedName.cs: Initial implementation of FromString. - -2003-10-07 Todd Berman - - * OpenElementElement.cs: implemented - * OpenElement.cs: implemented - -2003-10-05 Todd Berman - - * QualifiedName.cs: implemented. - * ChangeLog: added. diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Xml/IXmlElement.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Xml/IXmlElement.cs deleted file mode 100644 index 811071d2490..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Xml/IXmlElement.cs +++ /dev/null @@ -1,20 +0,0 @@ -// -// IXmlElement.cs: Interface IXmlElement -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System.Xml; - -namespace Microsoft.Web.Services.Xml { - - public interface IXmlElement { - - XmlElement GetXml (XmlDocument document); - - void LoadXml (XmlElement element); - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Xml/OpenAttributeElement.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Xml/OpenAttributeElement.cs deleted file mode 100644 index 1924924c6f6..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Xml/OpenAttributeElement.cs +++ /dev/null @@ -1,55 +0,0 @@ -// -// Microsoft.Web.Services.Xml.OpenAttributeElement.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Xml; -using System.Collections; - -namespace Microsoft.Web.Services.Xml -{ - - public abstract class OpenAttributeElement - { - - private ArrayList _any; - - public OpenAttributeElement () - { - _any = new ArrayList (); - } - - public void GetXmlAny (XmlDocument document, XmlElement element) - { - if(document == null) { - throw new ArgumentNullException ("document"); - } - if(element == null) { - throw new ArgumentNullException ("element"); - } - - foreach(XmlAttribute attrib in AnyAttributes) { - element.Attributes.Append((XmlAttribute)document.ImportNode(attrib, true)); - } - } - - public void LoadXmlAny (XmlElement element) - { - if(element == null) { - throw new ArgumentNullException ("element"); - } - foreach(XmlAttribute attrib in element.Attributes) { - AnyAttributes.Add(attrib); - } - } - - public IList AnyAttributes { - get { return _any; } - } - - } - -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Xml/OpenElement.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Xml/OpenElement.cs deleted file mode 100644 index d2781971b01..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Xml/OpenElement.cs +++ /dev/null @@ -1,68 +0,0 @@ -// -// Microsoft.Web.Services.Xml.OpenElement.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Xml; -using System.Collections; - -namespace Microsoft.Web.Services.Xml -{ - - public abstract class OpenElement - { - private ArrayList _anyAttribute; - private ArrayList _anyElement; - - public OpenElement () - { - _anyAttribute = new ArrayList (); - _anyElement = new ArrayList (); - } - - protected virtual void GetXmlAny (XmlDocument document, XmlElement element) - { - if(document == null) { - throw new ArgumentNullException ("document"); - } - if(element == null) { - throw new ArgumentNullException ("element"); - } - - foreach(XmlAttribute attrib in AnyAttributes) { - element.Attributes.Append ((XmlAttribute) document.ImportNode (attrib, true)); - } - - foreach(XmlElement elem in AnyElements) { - element.AppendChild (document.ImportNode (elem, true)); - } - } - - protected virtual void LoadXmlAny (XmlElement element) - { - if(element == null) { - throw new ArgumentNullException ("element"); - } - - foreach(XmlAttribute attrib in element.Attributes) { - AnyAttributes.Add (attrib); - } - - foreach(XmlElement elem in element.ChildNodes) { - AnyElements.Add (elem); - } - } - - public IList AnyAttributes { - get { return _anyAttribute; } - } - - public IList AnyElements { - get { return _anyElement; } - } - } - -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Xml/OpenElementElement.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Xml/OpenElementElement.cs deleted file mode 100644 index 1c18791b877..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Xml/OpenElementElement.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// Microsoft.Web.Services.Xml.OpenElementElement.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Xml; -using System.Collections; - -namespace Microsoft.Web.Services.Xml -{ - public abstract class OpenElementElement - { - private ArrayList _any; - - public OpenElementElement () - { - _any = new ArrayList (); - } - - public void GetXmlAny (XmlDocument document, XmlElement element) - { - if(document == null) { - throw new ArgumentNullException ("document"); - } - if(element == null) { - throw new ArgumentNullException ("element"); - } - - foreach(XmlElement elem in AnyElements) { - element.AppendChild(document.ImportNode(elem, true)); - } - - } - - public void LoadXmlAny (XmlElement element) - { - if(element == null) { - throw new ArgumentNullException ("element"); - } - - foreach(XmlElement elem in element.ChildNodes) { - AnyElements.Add (elem); - } - } - - public ArrayList AnyElements { - get { return _any; } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Xml/QualifiedName.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Xml/QualifiedName.cs deleted file mode 100644 index acc1f5c5d21..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Xml/QualifiedName.cs +++ /dev/null @@ -1,90 +0,0 @@ -// -// Microsoft.Web.Services.Xml.QualifiedName.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Xml; - -namespace Microsoft.Web.Services.Xml -{ - public class QualifiedName : XmlQualifiedName - { - - private string _prefix; - - public QualifiedName (string prefix, string name, string namespaceURI) : base (name, namespaceURI) - { - if(prefix == null) { - throw new ArgumentNullException ("prefix"); - } - _prefix = prefix; - } - - public static QualifiedName FromString (string value, XmlNode node) - { - if(node == null) { - throw new ArgumentNullException ("node"); - } - - if(value.IndexOf(':') > 0) { - string[] strings = value.Split(':'); - - if(strings.Length != 2 || strings[0].Length == 0 || strings[1].Length == 0) { - throw new FormatException ("xml_ImproperQName"); - } - - string nspace = node.GetNamespaceOfPrefix (strings[0]); - - if(nspace == null) { - throw new FormatException ("xml_CouldNotResolveNSPrefix"); - } - - if(nspace.Length == 0) { - throw new FormatException ("xml_CouldNotResolveNSPrefix"); - } - - return new QualifiedName (strings[0], strings[1], nspace); - } - - throw new FormatException ("xml_ImproperQName"); - } - - public XmlAttribute GetNamespaceDecl (XmlDocument document) - { - if(document == null) { - throw new ArgumentNullException ("document"); - } - XmlAttribute attrib = document.CreateAttribute("xmlns", - _prefix, - "http://www.w3.org/2000/xmlns"); - - attrib.Value = Namespace; - return attrib; - } - - public void GetQualifiedName (XmlDocument document, XmlElement element) - { - if(document == null) { - throw new ArgumentNullException ("document"); - } - if(element == null) { - throw new ArgumentNullException ("element"); - } - element.InnerText = Value; - if(Namespace != element.NamespaceURI) { - element.Attributes.Append(GetNamespaceDecl(document)); - } - } - - public string Prefix { - get { return _prefix; } - } - - public string Value { - get { return _prefix + ":" + Name; } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.dll.2.sources b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.dll.2.sources deleted file mode 100644 index 04cc926a6cc..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.dll.2.sources +++ /dev/null @@ -1,148 +0,0 @@ -Assembly/AssemblyInfo.cs -../../build/common/Locale.cs -Mono.Xml/XmlCanonicalizer.cs -Microsoft.Web.Services/AsyncResult.cs -Microsoft.Web.Services/ChainStream.cs -Microsoft.Web.Services/UriList.cs -Microsoft.Web.Services/SoapFormatException.cs -../../build/common/MonoTODOAttribute.cs -Microsoft.Web.Services/WebServicesExtension.cs -Microsoft.Web.Services/WebServicesClientProtocol.cs -Microsoft.Web.Services/SoapWebResponse.cs -Microsoft.Web.Services/SoapWebRequest.cs -Microsoft.Web.Services/SoapOutputFilter.cs -Microsoft.Web.Services/SoapOutputFilterCollection.cs -Microsoft.Web.Services/SoapInputFilter.cs -Microsoft.Web.Services/SoapInputFilterCollection.cs -Microsoft.Web.Services/SoapFault.cs -Microsoft.Web.Services/SoapEnvelope.cs -Microsoft.Web.Services/Soap.cs -Microsoft.Web.Services/SoapContext.cs -Microsoft.Web.Services/Pipeline.cs -Microsoft.Web.Services/HttpSoapContext.cs -Microsoft.Web.Services.Configuration/ConfigurationBase.cs -Microsoft.Web.Services.Configuration/FilterConfiguration.cs -Microsoft.Web.Services.Configuration/WebServicesConfiguration.cs -Microsoft.Web.Services.Diagnostics/TraceFilter.cs -Microsoft.Web.Services.Diagnostics/TraceInputFilter.cs -Microsoft.Web.Services.Diagnostics/TraceOutputFilter.cs -Microsoft.Web.Services.Timestamp/TimestampFormatException.cs -Microsoft.Web.Services.Timestamp/WSTimestamp.cs -Microsoft.Web.Services.Timestamp/TimestampOutputFilter.cs -Microsoft.Web.Services.Timestamp/TimestampInputFilter.cs -Microsoft.Web.Services.Timestamp/TimestampFault.cs -Microsoft.Web.Services.Timestamp/Timestamp.cs -Microsoft.Web.Services.Timestamp/Received.cs -Microsoft.Web.Services.Timestamp/ReceivedCollection.cs -Microsoft.Web.Services.Referral/Referral.cs -Microsoft.Web.Services.Referral/ReferralCollection.cs -Microsoft.Web.Services.Referral/ReferralException.cs -Microsoft.Web.Services.Referral/For.cs -Microsoft.Web.Services.Referral/If.cs -Microsoft.Web.Services.Referral/Desc.cs -Microsoft.Web.Services.Referral/ReferralInputfilter.cs -Microsoft.Web.Services.Referral/ReferralOutputFilter.cs -Microsoft.Web.Services.Policy/PolicyEnforcementException.cs -Microsoft.Web.Services.Messaging/MessagingConfiguration.cs -Microsoft.Web.Services.Messaging/ISoapFormatter.cs -Microsoft.Web.Services.Messaging/ISoapTransport.cs -Microsoft.Web.Services.Messaging/SoapChannel.cs -Microsoft.Web.Services.Messaging/SoapChannelCollection.cs -Microsoft.Web.Services.Messaging/SoapDimeFormatter.cs -Microsoft.Web.Services.Messaging/SoapPlainFormatter.cs -Microsoft.Web.Services.Messaging/SoapPort.cs -Microsoft.Web.Services.Messaging/SoapReceiver.cs -Microsoft.Web.Services.Messaging/SoapReceivers.cs -Microsoft.Web.Services.Messaging/SoapSender.cs -Microsoft.Web.Services.Messaging/SoapTcpChannel.cs -Microsoft.Web.Services.Messaging/SoapTcpListener.cs -Microsoft.Web.Services.Messaging/SoapTcpTransport.cs -Microsoft.Web.Services.Messaging/SoapTransport.cs -Microsoft.Web.Services.Dime/DimeAttachment.cs -Microsoft.Web.Services.Dime/DimeAttachmentCollection.cs -Microsoft.Web.Services.Dime/DimeReader.cs -Microsoft.Web.Services.Dime/DimeRecord.cs -Microsoft.Web.Services.Dime/DimeFormatException.cs -Microsoft.Web.Services.Dime/TypeFormatEnum.cs -Microsoft.Web.Services.Addressing/Action.cs -Microsoft.Web.Services.Addressing/Address.cs -Microsoft.Web.Services.Addressing/AddressList.cs -Microsoft.Web.Services.Addressing/AddressingFormatException.cs -Microsoft.Web.Services.Addressing/AddressingHeaders.cs -Microsoft.Web.Services.Addressing/AttributedQName.cs -Microsoft.Web.Services.Addressing/AttributedUri.cs -Microsoft.Web.Services.Addressing/AttributedUriString.cs -Microsoft.Web.Services.Addressing/EndpointReference.cs -Microsoft.Web.Services.Addressing/EndpointReferenceType.cs -Microsoft.Web.Services.Addressing/FaultTo.cs -Microsoft.Web.Services.Addressing/From.cs -Microsoft.Web.Services.Addressing/MessageID.cs -Microsoft.Web.Services.Addressing/PortType.cs -Microsoft.Web.Services.Addressing/Recipient.cs -Microsoft.Web.Services.Addressing/ReferenceProperties.cs -Microsoft.Web.Services.Addressing/RelatesTo.cs -Microsoft.Web.Services.Addressing/ReplyTo.cs -Microsoft.Web.Services.Addressing/ServiceName.cs -Microsoft.Web.Services.Addressing/To.cs -Microsoft.Web.Services.Routing/Found.cs -Microsoft.Web.Services.Routing/Path.cs -Microsoft.Web.Services.Routing/RoutingFormatException.cs -Microsoft.Web.Services.Routing/RoutingFault.cs -Microsoft.Web.Services.Routing/Via.cs -Microsoft.Web.Services.Routing/ViaCollection.cs -Microsoft.Web.Services.Routing/RoutingInputfilter.cs -Microsoft.Web.Services.Routing/RoutingOutputFilter.cs -Microsoft.Web.Services.Security/AsymmetricDecryptionKey.cs -Microsoft.Web.Services.Security/AsymmetricEncryptionKey.cs -Microsoft.Web.Services.Security/AuthenticationKey.cs -Microsoft.Web.Services.Security/BinarySecurityToken.cs -Microsoft.Web.Services.Security/DecryptionKey.cs -Microsoft.Web.Services.Security/DecryptionKeyProvider.cs -Microsoft.Web.Services.Security/EncryptedData.cs -Microsoft.Web.Services.Security/EncryptedKey.cs -Microsoft.Web.Services.Security/EncryptionKey.cs -Microsoft.Web.Services.Security/IDecryptionKeyProvider.cs -Microsoft.Web.Services.Security/IMutableSecurityToken.cs -Microsoft.Web.Services.Security/IPasswordProvider.cs -Microsoft.Web.Services.Security/ISecurityElement.cs -Microsoft.Web.Services.Security/KeyIdentifier.cs -Microsoft.Web.Services.Security/Nonce.cs -Microsoft.Web.Services.Security/PasswordOption.cs -Microsoft.Web.Services.Security/Reference.cs -Microsoft.Web.Services.Security/ReferenceList.cs -Microsoft.Web.Services.Security/Security.cs -Microsoft.Web.Services.Security/SecurityCollection.cs -Microsoft.Web.Services.Security/SecurityElementCollection.cs -Microsoft.Web.Services.Security/SecurityFormatException.cs -Microsoft.Web.Services.Security/SecurityInputFilter.cs -Microsoft.Web.Services.Security/SecurityOutputFilter.cs -Microsoft.Web.Services.Security/SecurityToken.cs -Microsoft.Web.Services.Security/SecurityTokenCollection.cs -Microsoft.Web.Services.Security/SecurityTokenReference.cs -Microsoft.Web.Services.Security/Signature.cs -Microsoft.Web.Services.Security/SignatureKey.cs -Microsoft.Web.Services.Security/SignatureOptions.cs -Microsoft.Web.Services.Security/SignedInfo.cs -Microsoft.Web.Services.Security/SignedXml.cs -Microsoft.Web.Services.Security/SignedXmlSignature.cs -Microsoft.Web.Services.Security/SymmetricDecryptionKey.cs -Microsoft.Web.Services.Security/SymmetricEncryptionKey.cs -Microsoft.Web.Services.Security/SecurityFault.cs -Microsoft.Web.Services.Security/TransformChain.cs -Microsoft.Web.Services.Security/UsernameToken.cs -Microsoft.Web.Services.Security/WSSecurity.cs -Microsoft.Web.Services.Security/X509SecurityToken.cs -Microsoft.Web.Services.Security/XmlDsigExcC14NTransform.cs -Microsoft.Web.Services.Security/XmlDsigExcC14NWithCommentsTransform.cs -Microsoft.Web.Services.Security/XmlEncryption.cs -Microsoft.Web.Services.Security/XmlSignature.cs -Microsoft.Web.Services.Security.X509/ICertificateStore.cs -Microsoft.Web.Services.Security.X509/MemoryCertificateStore.cs -Microsoft.Web.Services.Security.X509/X509Certificate.cs -Microsoft.Web.Services.Security.X509/X509CertificateCollection.cs -Microsoft.Web.Services.Security.X509/X509CertificateStore.cs -Microsoft.Web.Services.Xml/IXmlElement.cs -Microsoft.Web.Services.Xml/OpenAttributeElement.cs -Microsoft.Web.Services.Xml/OpenElement.cs -Microsoft.Web.Services.Xml/OpenElementElement.cs -Microsoft.Web.Services.Xml/QualifiedName.cs diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.dll.sources b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.dll.sources deleted file mode 100644 index 0404b3bcc07..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.dll.sources +++ /dev/null @@ -1,106 +0,0 @@ -Assembly/AssemblyInfo.cs -../../build/common/Locale.cs -Mono.Xml/XmlCanonicalizer.cs -Microsoft.Web.Services/ChainStream.cs -Microsoft.Web.Services/UriList.cs -Microsoft.Web.Services/SoapFormatException.cs -../../build/common/MonoTODOAttribute.cs -Microsoft.Web.Services/WebServicesExtension.cs -Microsoft.Web.Services/WebServicesClientProtocol.cs -Microsoft.Web.Services/SoapWebResponse.cs -Microsoft.Web.Services/SoapWebRequest.cs -Microsoft.Web.Services/SoapOutputFilter.cs -Microsoft.Web.Services/SoapOutputFilterCollection.cs -Microsoft.Web.Services/SoapInputFilter.cs -Microsoft.Web.Services/SoapInputFilterCollection.cs -Microsoft.Web.Services/SoapFault.cs -Microsoft.Web.Services/SoapEnvelope.cs -Microsoft.Web.Services/Soap.cs -Microsoft.Web.Services/SoapContext.cs -Microsoft.Web.Services/Pipeline.cs -Microsoft.Web.Services/HttpSoapContext.cs -Microsoft.Web.Services/IXmlElement.cs -Microsoft.Web.Services.Configuration/ConfigurationBase.cs -Microsoft.Web.Services.Configuration/FilterConfiguration.cs -Microsoft.Web.Services.Configuration/WebServicesConfiguration.cs -Microsoft.Web.Services.Diagnostics/TraceFilter.cs -Microsoft.Web.Services.Diagnostics/TraceInputFilter.cs -Microsoft.Web.Services.Diagnostics/TraceOutputFilter.cs -Microsoft.Web.Services.Timestamp/TimestampFormatException.cs -Microsoft.Web.Services.Timestamp/WSTimestamp.cs -Microsoft.Web.Services.Timestamp/TimestampOutputFilter.cs -Microsoft.Web.Services.Timestamp/TimestampInputFilter.cs -Microsoft.Web.Services.Timestamp/TimestampFault.cs -Microsoft.Web.Services.Timestamp/Timestamp.cs -Microsoft.Web.Services.Timestamp/Received.cs -Microsoft.Web.Services.Timestamp/ReceivedCollection.cs -Microsoft.Web.Services.Referral/Referral.cs -Microsoft.Web.Services.Referral/ReferralCollection.cs -Microsoft.Web.Services.Referral/ReferralException.cs -Microsoft.Web.Services.Referral/For.cs -Microsoft.Web.Services.Referral/If.cs -Microsoft.Web.Services.Referral/Desc.cs -Microsoft.Web.Services.Referral/ReferralInputfilter.cs -Microsoft.Web.Services.Referral/ReferralOutputFilter.cs -Microsoft.Web.Services.Dime/DimeAttachment.cs -Microsoft.Web.Services.Dime/DimeAttachmentCollection.cs -Microsoft.Web.Services.Dime/DimeReader.cs -Microsoft.Web.Services.Dime/DimeRecord.cs -Microsoft.Web.Services.Dime/DimeFormatException.cs -Microsoft.Web.Services.Dime/TypeFormatEnum.cs -Microsoft.Web.Services.Routing/Found.cs -Microsoft.Web.Services.Routing/Path.cs -Microsoft.Web.Services.Routing/RoutingFault.cs -Microsoft.Web.Services.Routing/RoutingFormatException.cs -Microsoft.Web.Services.Routing/Via.cs -Microsoft.Web.Services.Routing/ViaCollection.cs -Microsoft.Web.Services.Routing/RoutingInputfilter.cs -Microsoft.Web.Services.Routing/RoutingOutputFilter.cs -Microsoft.Web.Services.Security/AsymmetricDecryptionKey.cs -Microsoft.Web.Services.Security/AsymmetricEncryptionKey.cs -Microsoft.Web.Services.Security/AuthenticationKey.cs -Microsoft.Web.Services.Security/BinarySecurityToken.cs -Microsoft.Web.Services.Security/DecryptionKey.cs -Microsoft.Web.Services.Security/DecryptionKeyProvider.cs -Microsoft.Web.Services.Security/EncryptedData.cs -Microsoft.Web.Services.Security/EncryptedKey.cs -Microsoft.Web.Services.Security/EncryptionKey.cs -Microsoft.Web.Services.Security/IDecryptionKeyProvider.cs -Microsoft.Web.Services.Security/IPasswordProvider.cs -Microsoft.Web.Services.Security/ISecurityElement.cs -Microsoft.Web.Services.Security/KeyIdentifier.cs -Microsoft.Web.Services.Security/Nonce.cs -Microsoft.Web.Services.Security/PasswordOption.cs -Microsoft.Web.Services.Security/Reference.cs -Microsoft.Web.Services.Security/ReferenceList.cs -Microsoft.Web.Services.Security/Security.cs -Microsoft.Web.Services.Security/SecurityCollection.cs -Microsoft.Web.Services.Security/SecurityElementCollection.cs -Microsoft.Web.Services.Security/SecurityFormatException.cs -Microsoft.Web.Services.Security/SecurityInputFilter.cs -Microsoft.Web.Services.Security/SecurityOutputFilter.cs -Microsoft.Web.Services.Security/SecurityToken.cs -Microsoft.Web.Services.Security/SecurityTokenCollection.cs -Microsoft.Web.Services.Security/SecurityTokenReference.cs -Microsoft.Web.Services.Security/Signature.cs -Microsoft.Web.Services.Security/SignatureKey.cs -Microsoft.Web.Services.Security/SignatureOptions.cs -Microsoft.Web.Services.Security/SignedInfo.cs -Microsoft.Web.Services.Security/SignedXml.cs -Microsoft.Web.Services.Security/SignedXmlSignature.cs -Microsoft.Web.Services.Security/SymmetricDecryptionKey.cs -Microsoft.Web.Services.Security/SymmetricEncryptionKey.cs -Microsoft.Web.Services.Security/SecurityFault.cs -Microsoft.Web.Services.Security/TransformChain.cs -Microsoft.Web.Services.Security/UsernameToken.cs -Microsoft.Web.Services.Security/WSSecurity.cs -Microsoft.Web.Services.Security/X509SecurityToken.cs -Microsoft.Web.Services.Security/XmlDsigExcC14NTransform.cs -Microsoft.Web.Services.Security/XmlDsigExcC14NWithCommentsTransform.cs -Microsoft.Web.Services.Security/XmlEncryption.cs -Microsoft.Web.Services.Security/XmlSignature.cs -Microsoft.Web.Services.Security.X509/ICertificateStore.cs -Microsoft.Web.Services.Security.X509/MemoryCertificateStore.cs -Microsoft.Web.Services.Security.X509/X509Certificate.cs -Microsoft.Web.Services.Security.X509/X509CertificateCollection.cs -Microsoft.Web.Services.Security.X509/X509CertificateStore.cs diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/AsyncResult.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/AsyncResult.cs deleted file mode 100644 index e8f52473fc9..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/AsyncResult.cs +++ /dev/null @@ -1,120 +0,0 @@ -// -// Microsoft.Web.Services.AsyncResult.cs -// -// Author: Todd Berman -// -// (C) 2003 Todd Berman - -using System; -using System.Threading; - -namespace Microsoft.Web.Services -{ - public class AsyncResult : IAsyncResult - { - private AsyncCallback _callback; - private bool _completed; - private bool _completedSync; - private bool _endCalled; - private ManualResetEvent _event; - private Exception _exception; - private object _state; - - protected AsyncResult (object s) : this (null, s) - { - } - - protected AsyncResult (AsyncCallback call, object s) : base () - { - _callback = call; - _state = s; - } - - protected AsyncResult () : this (null, null) - { - } - - protected void Complete (bool csync, Exception e) - { - _completed = true; - _completedSync = csync; - _exception = e; - - if(_event != null) { - _event.Set (); - } - try { - if(_callback != null) { - _callback (this); - } - } catch (Exception) { - ThreadPool.QueueUserWorkItem (new WaitCallback (ThrowException), this); - } - } - - protected void Complete (bool csync) - { - this.Complete (csync, null); - } - - public static void End (IAsyncResult result) - { - if(result == null) { - throw new ArgumentNullException ("result"); - } - AsyncResult mws_result = (AsyncResult) result; - - if(mws_result == null) { - throw new ArgumentException ("Invalid result"); - } - - if(mws_result._endCalled == true) { - throw new InvalidOperationException ("Async Operation already finished"); - } - - mws_result._endCalled = true; - - if(mws_result._completed == true) { - mws_result.AsyncWaitHandle.WaitOne (); - } - - if(mws_result._exception != null) { - throw mws_result._exception; - } - } - - private void ThrowException (object o) - { - Exception e = (Exception) o; - throw e; - } - - public object AsyncState { - get { return _state; } - } - - public WaitHandle AsyncWaitHandle { - get { - if(_event == null) { - bool complete = _completed; - - lock (this) { - _event = new ManualResetEvent (_completed); - } - if(complete == true || _completed == false) { - _event.Set (); - } - } - return _event; - } - } - - public bool CompletedSynchronously { - get { return _completedSync; } - } - - public bool IsCompleted { - get { return _completed; } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/ChainStream.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/ChainStream.cs deleted file mode 100644 index e0a5c16a626..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/ChainStream.cs +++ /dev/null @@ -1,44 +0,0 @@ -// -// ChainStream.cs: Chained stream to catch WebRequest's streams -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.IO; - -namespace Microsoft.Web.Services { - - internal class ChainStream : MemoryStream { - - private Stream original; - private SoapEnvelope envelope; - private Pipeline pipeline; - - public ChainStream (Stream s, SoapEnvelope env, Pipeline pipeline) : base () - { - original = s; - envelope = env; - this.pipeline = pipeline; - } - - public override void Close () - { - try { - // transfer MemoryStream into SoapEnvelope - base.Position = 0; - envelope.Load (this); - // update the envelope then write into the original stream - pipeline.ProcessOutputMessage (envelope); - envelope.Save (original); - } - finally { - base.Close (); - original.Close (); - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/ChangeLog b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/ChangeLog deleted file mode 100644 index f47b98f0993..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/ChangeLog +++ /dev/null @@ -1,52 +0,0 @@ -2003-10-26 Sebastien Pouliot - - * SoapWebResponse.cs: Fixed the wrong context (re-used request). - * WebServicesClientProtocol.cs: Fixed null pipeline in requests. - -2003-10-25 Sebastien Pouliot - - * SoapContext.cs: Now construct the SecurityCollection for - ExtendedSecurity when null. - -2003-10-25 Todd Berman - - * AsyncResult.cs: csc fixes - * SoapContext.cs: csc fixes - -2003-10-22 Todd Berman - - * SoapContext.cs: Added Addressing objects, SetActor, SetTo, - Processed, SetIsInbound and SetProcessed. - * SoapEnvelope.cs: Added Encoding, Processed and SetProcessed and - fixed up Save (string) - * AsyncResult.cs: Basic Implementation for WSE2 (not for WSE1 yet). - -2003-10-05 Sebastien Pouliot - - * SoapWebRequest.cs: Now returns a SoapWebResponse for GetResponse. Added - [MonoTODO] to the async methods. - * SoapWebResponse.cs: Added Pipeline support for output. - * WebServicesExtension.cs: Added [MonoTODO] to reflect reality - -2003-10-04 Sebastien Pouliot - - * SoapContext.cs: Oops - nuked tberman changes :( reapplied - -2003-10-04 Sebastien Pouliot - - * ChainStream.cs: New. Allows to chain the WebRequest.GetRequestStream - so we can modify its content before sending it. - * Pipeline.cs: Fixed stupid error in ProcessOutputMessage (x++ -> x--) - * SoapContext.cs: Implemented CopyTo(SoapContext) - * SoapEnvelope.cs: New internal constructor for SoapContext - * SoapInputFilterCollection.cs: Fixed Clone() and added an internal - constructor. - * SoapOutputFilterCollection.cs: Fixed Clone() and added an internal - constructor. - * SoapWebRequest.cs: Completed TODO. - * WebServicesClientProtocol.cs: Fixed InvalidCast in GetWebResponse. But - how do we set the ResponseSoapContext ? - -2003-09-06 Sebastien Pouliot - - * Pipeline.cs: Uncommented Microsoft.Web.Services.Configuration; diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/HttpSoapContext.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/HttpSoapContext.cs deleted file mode 100644 index bf9f6ced529..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/HttpSoapContext.cs +++ /dev/null @@ -1,29 +0,0 @@ -// -// HttpSoapContext.cs: Http Soap Contexts -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services { - - public sealed class HttpSoapContext { - - // must have an internal one or a public one will be created (winchurn) - internal HttpSoapContext () {} - - [MonoTODO("ASP.NET related")] - public static SoapContext RequestContext { - get { return null; } - } - - [MonoTODO("ASP.NET related")] - public static SoapContext ResponseContext { - get { return null; } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/IXmlElement.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/IXmlElement.cs deleted file mode 100644 index 6d2d46a1d3f..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/IXmlElement.cs +++ /dev/null @@ -1,20 +0,0 @@ -// -// IXmlElement.cs: Interface IXmlElement -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System.Xml; - -namespace Microsoft.Web.Services { - - public interface IXmlElement { - - XmlElement GetXml (XmlDocument document); - - void LoadXml (XmlElement element); - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/Pipeline.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/Pipeline.cs deleted file mode 100644 index 759cecd81ee..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/Pipeline.cs +++ /dev/null @@ -1,71 +0,0 @@ -// -// Pipeline.cs: Soap Filter Pipeline -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using Microsoft.Web.Services.Configuration; - -namespace Microsoft.Web.Services { - - // Reference: - // 1. Inside the Web Services Enhancements Pipeline - // http://msdn.microsoft.com/library/en-us/dnwebsrv/html/insidewsepipe.asp - - public class Pipeline { - - private SoapInputFilterCollection input; - private SoapOutputFilterCollection output; - - public Pipeline() - { - // set to defaults - input = (SoapInputFilterCollection) WebServicesConfiguration.FilterConfiguration.InputFilters.Clone (); - output = (SoapOutputFilterCollection) WebServicesConfiguration.FilterConfiguration.OutputFilters.Clone (); - } - - public Pipeline (Pipeline pipeline) - { - if (pipeline == null) - throw new ArgumentNullException ("pipeline"); - input = (SoapInputFilterCollection) pipeline.InputFilters.Clone (); - output = (SoapOutputFilterCollection) pipeline.OutputFilters.Clone (); - } - - public Pipeline (SoapInputFilterCollection inputFilters, SoapOutputFilterCollection outputFilters) - { - if (inputFilters == null) - throw new ArgumentNullException ("inputFilters"); - if (outputFilters == null) - throw new ArgumentNullException ("outputFilters"); - input = (SoapInputFilterCollection) inputFilters.Clone (); - output = (SoapOutputFilterCollection) outputFilters.Clone (); - } - - public SoapInputFilterCollection InputFilters { - get { return input; } - } - - public SoapOutputFilterCollection OutputFilters { - get { return output; } - } - - public void ProcessInputMessage (SoapEnvelope envelope) - { - // in normal order - for (int x=0; x < input.Count; x++) - input [x].ProcessMessage (envelope); - } - - public void ProcessOutputMessage (SoapEnvelope envelope) - { - // in reverse order - see reference [1] - for (int x=output.Count - 1; x >= 0; x--) - output [x].ProcessMessage (envelope); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/Soap.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/Soap.cs deleted file mode 100644 index b653ab4cbe5..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/Soap.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -// Soap.cs: SOAP definitions for WSE -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services { - - public class Soap { - - public class AttributeNames { - - public const string Actor = "actor"; - public const string MustUnderstand = "mustUnderstand"; - - public AttributeNames() {} - } - - public class ElementNames { - public const string Body = "Body"; - public const string Envelope = "Envelope"; - public const string Fault = "Fault"; - public const string FaultActor = "faultactor"; - public const string FaultCode = "faultcode"; - public const string FaultDetail = "detail"; - public const string FaultString = "faultstring"; - public const string Header = "Header"; - public const string Message = "Message"; - public const string StackTrace = "StackTrace"; - - public ElementNames () {} - } - - public const string ActorNext = "http://schemas.xmlsoap.org/soap/actor/next"; - public static readonly Uri ActorNextURI = new Uri (ActorNext); - - public const string DimeContentType = "application/dime"; - public const string FaultNamespaceURI = "http://schemas.microsoft.com/wsdk/2002/10/"; - public const string NamespaceURI = "http://schemas.xmlsoap.org/soap/envelope/"; - public const string Prefix = "soap"; - public const string SoapContentType = "text/xml"; - - public Soap() {} - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapContext.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapContext.cs deleted file mode 100644 index d974a551cdb..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapContext.cs +++ /dev/null @@ -1,284 +0,0 @@ -// -// SoapContext.cs: SOAP Context -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using Microsoft.Web.Services.Dime; -using Microsoft.Web.Services.Referral; -using Microsoft.Web.Services.Routing; -using Microsoft.Web.Services.Security; -using Microsoft.Web.Services.Timestamp; -#if !WSE1 -using Microsoft.Web.Services.Addressing; -using Microsoft.Web.Services.Messaging; -#endif - -using System; -using System.Collections; - -namespace Microsoft.Web.Services { - - public sealed class SoapContext { - - private SoapEnvelope envelope; -#if WSE1 - private Uri actor; - private Microsoft.Web.Services.Timestamp.Timestamp timestamp; -#else - private Uri actor = new Uri ("http://" + System.Net.Dns.GetHostName ()); - private Microsoft.Web.Services.Timestamp.Timestamp timestamp = new Microsoft.Web.Services.Timestamp.Timestamp (); -#endif - private Microsoft.Web.Services.Security.Security security; - private Hashtable table; - private DimeAttachmentCollection attachments; - private string contentType; - private SecurityCollection extendedSecurity; - private ReferralCollection referrals; -#if !WSE1 - private AddressingHeaders addressingHeaders; - private SoapChannel _channel; - private bool _processed = false; - private bool _isInbound = false; -#endif - internal SoapContext () : this (null) - { - } - - internal SoapContext (SoapEnvelope env) - { - timestamp = new Microsoft.Web.Services.Timestamp.Timestamp (); -#if WSE1 - table = new Hashtable (); - - envelope = env; -#else //WSE2 - addressingHeaders = new AddressingHeaders (env); - - envelope = env; -#endif - } -#if !WSE1 - public Action Action { - get { return addressingHeaders.Action; } - set { addressingHeaders.Action = value; } - } - - public ReplyTo ReplyTo { - get { return addressingHeaders.ReplyTo; } - set { addressingHeaders.ReplyTo = value; } - } - - public To To { - get { return addressingHeaders.To; } - } - - public AddressingHeaders Addressing { - get { return addressingHeaders; } - set { addressingHeaders = value; } - } - - public FaultTo FaultTo { - get { return addressingHeaders.FaultTo; } - set { addressingHeaders.FaultTo = value; } - } - - public From From { - get { return addressingHeaders.From; } - set { addressingHeaders.From = value; } - } - - public MessageID MessageID { - get { return addressingHeaders.MessageID; } - set { addressingHeaders.MessageID = value; } - } - - public Recipient Recipient { - get { return addressingHeaders.Recipient; } - set { addressingHeaders.Recipient = value; } - } - - public RelatesTo RelatesTo { - get { return addressingHeaders.RelatesTo; } - set { addressingHeaders.RelatesTo = value; } - } - - public SoapChannel Channel { - get { return _channel; } - set { _channel = value; } - } - - public bool Processed { - get { return _processed; } - } - - public void SetProcessed (bool to) { - _processed = to; - } - - public void SetTo (Uri uri) { - addressingHeaders.To = uri; - } - - public void SetTo (To to) { - addressingHeaders.To = to; - } - - public void SetActor (Uri act) - { - actor = act; - } - - public void SetIsInbound (bool to) - { - _isInbound = to; - } -#endif - public Uri Actor { - get { return actor; } - } - - public DimeAttachmentCollection Attachments { - get { - if (attachments == null) - attachments = new DimeAttachmentCollection (); - return attachments; - } - } - - public string ContentType { - get { return contentType; } - } - - public SoapEnvelope Envelope { - get { return envelope; } - } - - public SecurityCollection ExtendedSecurity { - get { - if (extendedSecurity == null) - extendedSecurity = new SecurityCollection (); - return extendedSecurity; - } - } - - public object this [string key] { - get { return table [key]; } - set { - if (key == null) - throw new ArgumentNullException ("key"); - table [key] = value; - } - } - - public Path Path { - get { return null; } - set {;} - } - - public ReferralCollection Referrals { - get { return referrals; } - } - - public Microsoft.Web.Services.Security.Security Security { - get { - if (security == null) { - if (actor != null) - security = new Microsoft.Web.Services.Security.Security (actor.ToString ()); - else - security = new Microsoft.Web.Services.Security.Security (); - } - return security; - } - } - - public Microsoft.Web.Services.Timestamp.Timestamp Timestamp { - get { return timestamp; } - } - - internal bool IsReserved (string key) - { - switch (key) { - case "Actor": - case "Attachments": - case "ContentType": - case "Envelope": - case "ExtendedSecurity": - case "IsInbound": - case "IsIntermediary": - case "Referrals": - case "Path": - case "Security": - case "Timestamp": - case "WebRequest": - case "WebResponse": - return true; - default: - return false; - } - } - - public void Add (string key, object value) - { - if (key == null) - throw new ArgumentNullException ("key"); - if (IsReserved (key)) - throw new ArgumentException ("reserved key"); - table.Add (key, value); - } - - public void Clear () - { - foreach (DictionaryEntry entry in table) { - string key = (string) entry.Key; - // remove all except reserved names - if (!IsReserved (key)) - table.Remove (key); - } - } - - public bool Contains (string key) - { - if (key == null) - throw new ArgumentNullException ("key"); - return table.Contains (key); - } - - public void CopyTo (SoapContext context) - { - if (context == null) - throw new ArgumentNullException ("context"); - context.actor = this.actor; - foreach (DimeAttachment da in Attachments) { - context.Attachments.Add (da); - } - context.contentType = contentType; - context.envelope = envelope; - context.extendedSecurity = ExtendedSecurity; - context.Path = Path; - context.referrals = Referrals; - context.security = security; - context.timestamp = timestamp; - foreach (DictionaryEntry de in table) { - context.table.Add (de.Key, de.Value); - } - } - - public IDictionaryEnumerator GetEnumerator () - { - return table.GetEnumerator (); - } - - public void Remove (string key) - { - if (key == null) - throw new ArgumentNullException ("key"); - if (IsReserved (key)) - throw new ArgumentException ("reserved key"); - table.Remove (key); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapEnvelope.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapEnvelope.cs deleted file mode 100644 index a2fb5d3e864..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapEnvelope.cs +++ /dev/null @@ -1,165 +0,0 @@ -// -// SoapEnvelope.cs: Soap Envelope -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.IO; -using System.Xml; -using System.Text; - -namespace Microsoft.Web.Services { - - public class SoapEnvelope : XmlDocument { - - private SoapContext context; - private XmlElement envelope; - private XmlElement body; - private XmlElement header; -#if WSE2 - private Encoding _encoding; - private bool _processed = false; -#endif - - public SoapEnvelope () - { - envelope = CreateElement (Soap.Prefix, Soap.ElementNames.Envelope, Soap.NamespaceURI); - AppendChild (envelope); - } - - internal SoapEnvelope (SoapContext context) : this () - { - this.context = context; - } - -#if WSE2 - public Encoding Encoding { - get { - if(_encoding == null) { - return new UTF8Encoding (false); - } - return _encoding; - } - set { - _encoding = value; - if(_encoding is UTF8Encoding) { - _encoding = new UTF8Encoding (false); - } - } - } - - public bool Processed { - get { return _processed; } - } - - - //Potential LAMESPEC: Why not a property?!? - public void SetProcessed (bool to) - { - _processed = to; - } -#endif - - public XmlElement Body { - get { - if (body == null) { - XmlNodeList xnl = GetElementsByTagName (Soap.ElementNames.Body, Soap.NamespaceURI); - body = (XmlElement)xnl[0]; - } - return body; - } - } - - public SoapContext Context { - get { - if (context == null) - context = new SoapContext (this); - return context; - } - } - - public XmlElement Envelope { - get { return envelope; } - } - - public XmlElement Header { - get { - if (header == null) { - XmlNodeList xnl = GetElementsByTagName (Soap.ElementNames.Header, Soap.NamespaceURI); - header = (XmlElement)xnl[0]; - } - return header; - } - } - - public XmlElement CreateBody () - { - if (body == null) { - body = CreateElement (Soap.Prefix, Soap.ElementNames.Body, Soap.NamespaceURI); - DocumentElement.AppendChild (body); - } - return body; - } - - public XmlElement CreateHeader () - { - if (header == null) { - header = CreateElement (Soap.Prefix, Soap.ElementNames.Header, Soap.NamespaceURI); - // be sure Header comes before the Body - DocumentElement.PrependChild (header); - } - return header; - } - - private void InvalidateCache () - { - envelope = DocumentElement; - header = null; - body = null; - } - - public override void Load (Stream stream) - { - base.Load (stream); - InvalidateCache (); - } - - public override void Load (string filename) - { - base.Load (filename); - InvalidateCache (); - } - - public override void Load (TextReader txtReader) - { - base.Load (txtReader); - InvalidateCache (); - } - - public override void Load (XmlReader xmlReader) - { - base.Load (xmlReader); - InvalidateCache (); - } - - [MonoTODO("why?")] - public override void Save (Stream stream) - { - base.Save (stream); - } - - [MonoTODO("why?")] - public override void Save (string str) - { -#if WSE2 - base.Save (new XmlTextWriter (str, Encoding)); -#else - base.Save (str); -#endif - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapFault.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapFault.cs deleted file mode 100644 index 387cdc9319c..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapFault.cs +++ /dev/null @@ -1,23 +0,0 @@ -// -// SoapFault.cs: Implements SoapFault -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services { - - [Serializable] - public class SoapFault { - - public const string InvalidSoapMessage = "Invalid Soap Message"; - public const string InvalidXmlMessage = "Invalid Xml Message"; - public const string ServerUnavailable = "Server Unavailable"; - - public SoapFault () {} - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapFormatException.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapFormatException.cs deleted file mode 100644 index 3fa037b099b..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapFormatException.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Microsoft.Web.Services.SoapFormatException.cs -// -// Author: Daniel Kornhauser -// -// (C) Ximian, Inc. 2003. - -using System; -using System.Web.Services.Protocols; -using System.Xml; - -namespace Microsoft.Web.Services { - - [Serializable] - public class SoapFormatException : SoapHeaderException - { - public SoapFormatException () - : base (String.Empty, XmlQualifiedName.Empty) - { - } - - public SoapFormatException (string message) - : base (message, XmlQualifiedName.Empty) - { - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapInputFilter.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapInputFilter.cs deleted file mode 100644 index caffff6ccce..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapInputFilter.cs +++ /dev/null @@ -1,39 +0,0 @@ -// -// SoapIntputFilter.cs: SOAP Input Filter -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Xml; - -namespace Microsoft.Web.Services { - - public abstract class SoapInputFilter { - - public SoapInputFilter () {} - - [MonoTODO("always return true - for now")] - protected virtual bool CanProcessHeader (XmlElement header, SoapContext context) - { - if (header == null) - throw new ArgumentNullException ("header"); - if (context == null) - throw new ArgumentNullException ("context"); - // The header can be processed if any of the following conditions are true: - // 1. Actor is equal to ActorNext. - if (context.Actor.AbsoluteUri == Soap.ActorNext) - return true; - // 2. Actor matches this node. - // 3. Actor is empty and the IsIntermediary property of context is false. - //if ((context.Actor == null) && (context.IsIntermediary)) - return true; - //return false; - } - - public abstract void ProcessMessage (SoapEnvelope envelope); - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapInputFilterCollection.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapInputFilterCollection.cs deleted file mode 100644 index 24000d7d32f..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapInputFilterCollection.cs +++ /dev/null @@ -1,115 +0,0 @@ -// -// SoapInputFilterCollection.cs: Soap Input Filter Collection -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Collections; - -namespace Microsoft.Web.Services { - - public class SoapInputFilterCollection : CollectionBase, ICloneable { - - public SoapInputFilterCollection () {} - - internal SoapInputFilterCollection (ArrayList list) - { - InnerList.AddRange (list); - } - - public SoapInputFilter this [int index] { - get { return (SoapInputFilter) InnerList [index]; } - } - - public int Add (SoapInputFilter filter) - { - if (filter == null) - throw new ArgumentNullException ("filter"); - return InnerList.Add (filter); - } - - public void AddRange (ICollection filters) - { - // can't use list.AddRange because we must check every items - // in the collection - foreach (object o in filters) { - if (! (o is SoapInputFilter)) - throw new ArgumentException ("not SoapInputFilter"); - // we'll get the ArgumentNullException in Add - InnerList.Add (o as SoapInputFilter); - } - } - - // LAMESPEC: Shallow (implemented) or deep clone (todo) - public object Clone () - { - return new SoapInputFilterCollection ((ArrayList) InnerList.Clone ()); - } - - public bool Contains (SoapInputFilter filter) - { - if (filter == null) - throw new ArgumentNullException ("filter"); - return InnerList.Contains (filter); - } - - public bool Contains (Type filterType) - { - foreach (object o in InnerList) { - if (o.GetType () == filterType) - return true; - } - return false; - } - - public int IndexOf (SoapInputFilter filter) - { - if (filter == null) - throw new ArgumentNullException ("filter"); - return InnerList.IndexOf (filter); - } - - public int IndexOf (Type filterType) - { - if (filterType == null) - throw new ArgumentNullException ("filterType"); - int i = 0; - foreach (object o in InnerList) { - if (o.GetType () == filterType) - return i; - i++; - } - return -1; - } - - public void Insert (int index, SoapInputFilter filter) - { - if (filter == null) - throw new ArgumentNullException ("filter"); - InnerList.Insert (index, filter); - } - - public void Remove (SoapInputFilter filter) - { - if (filter == null) - throw new ArgumentNullException ("filter"); - InnerList.Remove (filter); - } - - public void Remove (Type filterType) - { - if (filterType == null) - throw new ArgumentNullException ("filterType"); - int i = 0; - foreach (object o in InnerList) { - if (o.GetType () == filterType) - InnerList.RemoveAt (i); - i++; - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapOutputFilter.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapOutputFilter.cs deleted file mode 100644 index af2dcf0447a..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapOutputFilter.cs +++ /dev/null @@ -1,20 +0,0 @@ -// -// SoapOutputFilter.cs: SOAP Output Filter -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services { - - public abstract class SoapOutputFilter { - - public SoapOutputFilter () {} - - public abstract void ProcessMessage (SoapEnvelope envelope); - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapOutputFilterCollection.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapOutputFilterCollection.cs deleted file mode 100644 index cf7c7faca61..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapOutputFilterCollection.cs +++ /dev/null @@ -1,116 +0,0 @@ -// -// SoapInputFilterCollection.cs: Soap Input Filter Collection -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using Microsoft.Web.Services; -using System; -using System.Collections; - -namespace Microsoft.Web.Services { - - public class SoapOutputFilterCollection : CollectionBase, ICloneable { - - public SoapOutputFilterCollection () {} - - internal SoapOutputFilterCollection (ArrayList list) - { - InnerList.AddRange (list); - } - - public SoapOutputFilter this [int index] { - get { return (SoapOutputFilter) InnerList [index]; } - } - - public int Add (SoapOutputFilter filter) - { - if (filter == null) - throw new ArgumentNullException ("filter"); - return InnerList.Add (filter); - } - - public void AddRange (ICollection filters) - { - // can't use list.AddRange because we must check every items - // in the collection - foreach (object o in filters) { - if (! (o is SoapOutputFilter)) - throw new ArgumentException ("not SoapOutputFilter"); - // we'll get the ArgumentNullException in Add - InnerList.Add (o); - } - } - - // LAMESPEC: Shallow (implemented) or deep clone (todo) - public object Clone () - { - return new SoapOutputFilterCollection ((ArrayList) InnerList.Clone ()); - } - - public bool Contains (SoapOutputFilter filter) - { - if (filter == null) - throw new ArgumentNullException ("filter"); - return InnerList.Contains (filter); - } - - public bool Contains (Type filterType) - { - foreach (object o in InnerList) { - if (o.GetType () == filterType) - return true; - } - return false; - } - - public int IndexOf (SoapOutputFilter filter) - { - if (filter == null) - throw new ArgumentNullException ("filter"); - return InnerList.IndexOf (filter); - } - - public int IndexOf (Type filterType) - { - if (filterType == null) - throw new ArgumentNullException ("filterType"); - int i = 0; - foreach (object o in InnerList) { - if (o.GetType () == filterType) - return i; - i++; - } - return -1; - } - - public void Insert (int index, SoapOutputFilter filter) - { - if (filter == null) - throw new ArgumentNullException ("filter"); - InnerList.Insert (index, filter); - } - - public void Remove (SoapOutputFilter filter) - { - if (filter == null) - throw new ArgumentNullException ("filter"); - InnerList.Remove (filter); - } - - public void Remove (Type filterType) - { - if (filterType == null) - throw new ArgumentNullException ("filterType"); - int i = 0; - foreach (object o in InnerList) { - if (o.GetType () == filterType) - InnerList.RemoveAt (i); - i++; - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapWebRequest.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapWebRequest.cs deleted file mode 100644 index 39fba9fe55a..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapWebRequest.cs +++ /dev/null @@ -1,127 +0,0 @@ -// -// SoapWebRequest.cs: Soap Web Request -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.IO; -using System.Net; - -namespace Microsoft.Web.Services { - - public class SoapWebRequest : WebRequest { - - private Uri uri; - private SoapContext context; - private Pipeline pipeline; - private WebRequest request; - - public SoapWebRequest (string uri) : this (new Uri (uri)) {} - - public SoapWebRequest (Uri uri) : base () - { - this.uri = uri; - context = new SoapContext (null); - } - - [MonoTODO] - public override IAsyncResult BeginGetRequestStream (AsyncCallback cb, object state) - { - return Request.BeginGetRequestStream (cb, state); - } - - [MonoTODO] - public override IAsyncResult BeginGetResponse (AsyncCallback cb, object state) - { - return Request.BeginGetResponse (cb, state); - } - - [MonoTODO] - public override Stream EndGetRequestStream (IAsyncResult asyncResult) - { - return Request.EndGetRequestStream (asyncResult); - } - - [MonoTODO] - public override WebResponse EndGetResponse (IAsyncResult asyncResult) - { - return Request.EndGetResponse (asyncResult); - } - - public override Stream GetRequestStream () - { - Stream s = Request.GetRequestStream (); - SoapEnvelope env = new SoapEnvelope (context); - return new ChainStream (s, env, Pipeline); - } - - public override WebResponse GetResponse () - { - return new SoapWebResponse (this); - } - - public override string ConnectionGroupName { - get { return Request.ConnectionGroupName; } - set { Request.ConnectionGroupName = value; } - } - - public override string ContentType { - get { return Request.ContentType; } - set { Request.ContentType = value; } - } - - public override ICredentials Credentials { - get { return Request.Credentials; } - set { Request.Credentials = value; } - } - - public override WebHeaderCollection Headers { - get { return Request.Headers; } - } - - public override string Method { - get { return Request.Method; } - set { Request.Method = value; } - } - - public Pipeline Pipeline { - get { - // if none set, then get the default pipeline - if (pipeline == null) - pipeline = new Pipeline (); - return pipeline; - } - set { pipeline = value; } - } - - public override bool PreAuthenticate { - get { return Request.PreAuthenticate; } - set { Request.PreAuthenticate = value; } - } - - public WebRequest Request { - get { - if (request == null) - request = WebRequest.Create (uri); - return request; - } - } - - public override Uri RequestUri { - get { return uri; } - } - - public SoapContext SoapContext { - get { return context; } - } - - public override int Timeout { - get { return Request.Timeout; } - set { Request.Timeout = value; } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapWebResponse.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapWebResponse.cs deleted file mode 100644 index 9c669c5b7d9..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapWebResponse.cs +++ /dev/null @@ -1,58 +0,0 @@ -// -// SoapWebResponse.cs: Soap Web Response List -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using Microsoft.Web.Services; -using System; -using System.IO; -using System.Net; - -namespace Microsoft.Web.Services { - - public class SoapWebResponse : WebResponse { - - private SoapWebRequest request; - private MemoryStream ms; - private WebResponse response; - - internal SoapWebResponse (SoapWebRequest soapRequest) - { - request = soapRequest; - response = soapRequest.Request.GetResponse (); - } - - public override Stream GetResponseStream () - { - SoapEnvelope envelope = new SoapEnvelope (); - Stream s = response.GetResponseStream (); - envelope.Load (s); - request.Pipeline.ProcessInputMessage (envelope); - - ms = new MemoryStream (); - envelope.Save (ms); - ms.Position = 0; // ready to be read - return ms; - } - - public override long ContentLength { - get { return ((ms == null) ? 0 : ms.Length); } - } - - public override string ContentType { - get { return request.Request.ContentType; } - } - - public override WebHeaderCollection Headers { - get { return response.Headers; } - } - - public SoapContext SoapContext { - get { return request.SoapContext; } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/UriList.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/UriList.cs deleted file mode 100644 index af8bed317f8..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/UriList.cs +++ /dev/null @@ -1,89 +0,0 @@ -// -// UriList.cs: Uri List -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Collections; - -namespace Microsoft.Web.Services { - - public class UriList : ICollection { - - private ArrayList list; - - public UriList () - { - list = new ArrayList (); - } - - public int Add (Uri uri) - { - return list.Add (uri); - } - - public bool Contains (Uri uri) - { - return list.Contains (uri); - } - - public void CopyTo (Array array, int index) - { - list.CopyTo (array, index); - } - - public IEnumerator GetEnumerator () - { - return list.GetEnumerator (); - } - - public int IndexOf (Uri uri) - { - return list.IndexOf (uri); - } - - public void Insert (int index, Uri uri) - { - list.Insert (index, uri); - } - - public void Remove (Uri uri) - { - list.Remove (uri); - } - - public void RemoveAt (int index) - { - list.RemoveAt (index); - } - - public int Count { - get { return list.Count; } - } - - public bool IsFixedSize { - get { return list.IsFixedSize; } - } - - public bool IsReadOnly { - get { return list.IsReadOnly; } - } - - public bool IsSynchronized { - get { return list.IsSynchronized; } - } - - public Uri this [int index] { - get { return (Uri) list [index]; } - set { list [index] = value; } - } - - public object SyncRoot { - get { return list.SyncRoot; } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/WebServicesClientProtocol.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/WebServicesClientProtocol.cs deleted file mode 100644 index 27ca0399718..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/WebServicesClientProtocol.cs +++ /dev/null @@ -1,82 +0,0 @@ -// -// WebServicesClientProtocol.cs: Web Services Client Protocol -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Net; -using System.Web.Services.Protocols; - -namespace Microsoft.Web.Services { - - public class WebServicesClientProtocol : SoapHttpClientProtocol { - - private Pipeline _pipeline; - private SoapContext _requestContext; - private SoapContext _responseContext; - - public WebServicesClientProtocol () {} - - public Pipeline Pipeline { - get { - if (_pipeline == null) - _pipeline = new Pipeline (); - return _pipeline; - } - set { - if (value == null) - throw new System.ArgumentNullException ("value"); - _pipeline = value; - } - } - - public SoapContext RequestSoapContext { - get { - if (_requestContext == null) - _requestContext = new SoapContext (); - return _requestContext; - } - } - - public SoapContext ResponseSoapContext { - get { - if (_responseContext == null) - _responseContext = new SoapContext (); - return _responseContext; - } - } - - [MonoTODO("something is missing")] - public new string Url { - get { return base.Url; } - set { base.Url = value; } - } - - protected override WebRequest GetWebRequest (Uri uri) - { - SoapWebRequest request = new SoapWebRequest (uri); - RequestSoapContext.CopyTo (request.SoapContext); - request.Pipeline = Pipeline; - return request; - } - - protected override WebResponse GetWebResponse (WebRequest request) - { - WebResponse response = request.GetResponse (); - //response.SoapContext.CopyTo (ResponseSoapContext); - return response; - } - - [MonoTODO("do not support IAsyncResult")] - protected override WebResponse GetWebResponse (WebRequest request, IAsyncResult result) - { - SoapWebResponse response = (SoapWebResponse) request.GetResponse (); - response.SoapContext.CopyTo (ResponseSoapContext); - return response; - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/WebServicesExtension.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/WebServicesExtension.cs deleted file mode 100644 index f0332364ba8..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/WebServicesExtension.cs +++ /dev/null @@ -1,65 +0,0 @@ -// -// WebServicesExtension.cs: Web Service Extension -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.IO; -using System.Web.Services.Protocols; - -namespace Microsoft.Web.Services { - - public class WebServicesExtension : SoapExtension { - - public WebServicesExtension () {} - - [MonoTODO] - public override Stream ChainStream (Stream stream) - { - return null; - } - - [MonoTODO] - public override object GetInitializer (LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) - { - return null; - } - - [MonoTODO] - public override object GetInitializer (Type type) - { - return null; - } - - [MonoTODO] - public override void Initialize (object initializer) - { - } - - [MonoTODO] - public override void ProcessMessage (SoapMessage message) - { - if (message == null) - throw new ArgumentNullException ("message"); - - switch (message.Stage) { - case SoapMessageStage.BeforeSerialize: - // TODO - break; - case SoapMessageStage.AfterSerialize: - // TODO - break; - case SoapMessageStage.BeforeDeserialize: - // TODO - break; - case SoapMessageStage.AfterDeserialize: - // TODO - break; - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Mono.Xml/ChangeLog b/mcs/class/Microsoft.Web.Services/Mono.Xml/ChangeLog deleted file mode 100644 index ba6b1696c66..00000000000 --- a/mcs/class/Microsoft.Web.Services/Mono.Xml/ChangeLog +++ /dev/null @@ -1,4 +0,0 @@ -2004-03-30 Sebastien Pouliot - - * XmlCanonicalizer.cs: New. Copy of System.Security assembly. - Original by Aleksey Sanin. Modified by Atsushi Enomoto. diff --git a/mcs/class/Microsoft.Web.Services/Mono.Xml/XmlCanonicalizer.cs b/mcs/class/Microsoft.Web.Services/Mono.Xml/XmlCanonicalizer.cs deleted file mode 100644 index b4ca937657a..00000000000 --- a/mcs/class/Microsoft.Web.Services/Mono.Xml/XmlCanonicalizer.cs +++ /dev/null @@ -1,566 +0,0 @@ -// -// XmlCanonicalizer.cs - C14N implementation for XML Signature -// http://www.w3.org/TR/xml-c14n -// -// Author: -// Aleksey Sanin (aleksey@aleksey.com) -// -// (C) 2003 Aleksey Sanin (aleksey@aleksey.com) -// -using System; -using System.Collections; -using System.IO; -using System.Text; -using System.Xml; - -namespace Mono.Xml { - - internal class XmlCanonicalizer { - - private enum XmlCanonicalizerState - { - BeforeDocElement, - InsideDocElement, - AfterDocElement - } - - // c14n parameters - private bool comments; - private bool exclusive; - - // input/output - private XmlNodeList xnl; - private StringBuilder res; - - // namespaces rendering stack - private XmlCanonicalizerState state; - private ArrayList visibleNamespaces; - private int prevVisibleNamespacesStart; - private int prevVisibleNamespacesEnd; - - public XmlCanonicalizer (bool withComments, bool excC14N) - { - res = new StringBuilder (); - comments = withComments; - exclusive = excC14N; - state = XmlCanonicalizerState.BeforeDocElement; - visibleNamespaces = new ArrayList (); - prevVisibleNamespacesStart = 0; - prevVisibleNamespacesEnd = 0; - } - - public Stream Canonicalize (XmlDocument doc) - { - WriteDocumentNode (doc); - - UTF8Encoding utf8 = new UTF8Encoding (); - byte[] data = utf8.GetBytes (res.ToString ()); - return new MemoryStream (data); - } - - public Stream Canonicalize (XmlNodeList nodes) - { - xnl = nodes; - if (nodes == null || nodes.Count < 1) - return null; - return Canonicalize (nodes[0].OwnerDocument); - } - - private void WriteNode (XmlNode node) - { - // Console.WriteLine ("C14N Debug: node=" + node.Name); - - bool visible = IsNodeVisible (node); - switch (node.NodeType) { - case XmlNodeType.Document: - case XmlNodeType.DocumentFragment: - WriteDocumentNode (node); - break; - case XmlNodeType.Element: - WriteElementNode (node, visible); - break; - case XmlNodeType.CDATA: - case XmlNodeType.SignificantWhitespace: - case XmlNodeType.Text: - // CDATA sections are processed as text nodes - WriteTextNode (node, visible); - break; - case XmlNodeType.Whitespace: - if (state == XmlCanonicalizerState.InsideDocElement) - WriteTextNode (node, visible); - break; - case XmlNodeType.Comment: - WriteCommentNode (node, visible); - break; - case XmlNodeType.ProcessingInstruction: - WriteProcessingInstructionNode (node, visible); - break; - case XmlNodeType.EntityReference: - for (int i = 0; i < node.ChildNodes.Count; i++) - WriteNode (node.ChildNodes [i]); - break; - case XmlNodeType.Attribute: - throw new XmlException ("Attribute node is impossible here", null); - case XmlNodeType.EndElement: - throw new XmlException ("EndElement node is impossible here", null); - case XmlNodeType.EndEntity: - throw new XmlException ("EndEntity node is impossible here", null); - case XmlNodeType.DocumentType: - case XmlNodeType.Entity: - case XmlNodeType.Notation: - case XmlNodeType.XmlDeclaration: - // just do nothing - break; - } - } - - private void WriteDocumentNode (XmlNode node) - { - state = XmlCanonicalizerState.BeforeDocElement; - for (XmlNode child = node.FirstChild; child != null; child = child.NextSibling) - WriteNode (child); - } - - // Element Nodes - // If the element is not in the node-set, then the result is obtained - // by processing the namespace axis, then the attribute axis, then - // processing the child nodes of the element that are in the node-set - // (in document order). If the element is inthe node-set, then the result - // is an open angle bracket (<), the element QName, the result of - // processing the namespace axis, the result of processing the attribute - // axis, a close angle bracket (>), the result of processing the child - // nodes of the element that are in the node-set (in document order), an - // open angle bracket, a forward slash (/), the element QName, and a close - // angle bracket. - private void WriteElementNode (XmlNode node, bool visible) - { - // Console.WriteLine ("Debug: element node"); - - // remember current state - int savedPrevVisibleNamespacesStart = prevVisibleNamespacesStart; - int savedPrevVisibleNamespacesEnd = prevVisibleNamespacesEnd; - int savedVisibleNamespacesSize = visibleNamespaces.Count; - XmlCanonicalizerState s = state; - if (visible && state == XmlCanonicalizerState.BeforeDocElement) - state = XmlCanonicalizerState.InsideDocElement; - - // write start tag - if (visible) { - res.Append ("<"); - res.Append (node.Name); - } - - // this is odd but you can select namespaces - // and attributes even if node itself is not visible - WriteNamespacesAxis (node, visible); - WriteAttributesAxis (node); - - if (visible) - res.Append (">"); - - // write children - for (XmlNode child = node.FirstChild; child != null; child = child.NextSibling) - WriteNode (child); - - // write end tag - if (visible) { - res.Append (""); - } - - // restore state - if (visible && s == XmlCanonicalizerState.BeforeDocElement) - state = XmlCanonicalizerState.AfterDocElement; - prevVisibleNamespacesStart = savedPrevVisibleNamespacesStart; - prevVisibleNamespacesEnd = savedPrevVisibleNamespacesEnd; - if (visibleNamespaces.Count > savedVisibleNamespacesSize) { - visibleNamespaces.RemoveRange (savedVisibleNamespacesSize, - visibleNamespaces.Count - savedVisibleNamespacesSize); - } - } - - // Namespace Axis - // Consider a list L containing only namespace nodes in the - // axis and in the node-set in lexicographic order (ascending). To begin - // processing L, if the first node is not the default namespace node (a node - // with no namespace URI and no local name), then generate a space followed - // by xmlns="" if and only if the following conditions are met: - // - the element E that owns the axis is in the node-set - // - The nearest ancestor element of E in the node-set has a default - // namespace node in the node-set (default namespace nodes always - // have non-empty values in XPath) - // The latter condition eliminates unnecessary occurrences of xmlns="" in - // the canonical form since an element only receives an xmlns="" if its - // default namespace is empty and if it has an immediate parent in the - // canonical form that has a non-empty default namespace. To finish - // processing L, simply process every namespace node in L, except omit - // namespace node with local name xml, which defines the xml prefix, - // if its string value is http://www.w3.org/XML/1998/namespace. - private void WriteNamespacesAxis (XmlNode node, bool visible) - { - // Console.WriteLine ("Debug: namespaces"); - - XmlDocument doc = node.OwnerDocument; - bool has_empty_namespace = false; - ArrayList list = new ArrayList (); - for (XmlNode cur = node; cur != null && cur != doc; cur = cur.ParentNode) { - foreach (XmlNode attribute in cur.Attributes) { - if (!IsNamespaceNode (attribute)) - continue; - - // get namespace prefix - string prefix = string.Empty; - if (attribute.Prefix == "xmlns") - prefix = attribute.LocalName; - - // check if it is "xml" namespace - if (prefix == "xml" && attribute.Value == "http://www.w3.org/XML/1998/namespace") - continue; - - // make sure that this is an active namespace - // for our node - string ns = node.GetNamespaceOfPrefix (prefix); - if (ns != attribute.Value) - continue; - - // check that it is selected with XPath - if (!IsNodeVisible (attribute)) - continue; - - // check that we have not rendered it yet - bool rendered = IsNamespaceRendered (prefix, attribute.Value); - - // add to the visible namespaces stack - if (visible) - visibleNamespaces.Add (attribute); - - if (!rendered) - list.Add (attribute); - - if (prefix == string.Empty) - has_empty_namespace = true; - } - } - - // add empty namespace if needed - if (visible && !has_empty_namespace && !IsNamespaceRendered (string.Empty, string.Empty)) - res.Append (" xmlns=\"\""); - - list.Sort (new XmlDsigC14NTransformNamespacesComparer ()); - foreach (object obj in list) { - XmlNode attribute = (obj as XmlNode); - if (attribute != null) { - res.Append (" "); - res.Append (attribute.Name); - res.Append ("=\""); - res.Append (attribute.Value); - res.Append ("\""); - } - } - - // move the rendered namespaces stack - if (visible) { - prevVisibleNamespacesStart = prevVisibleNamespacesEnd; - prevVisibleNamespacesEnd = visibleNamespaces.Count; - } - } - - // Attribute Axis - // In lexicographic order (ascending), process each node that - // is in the element's attribute axis and in the node-set. - // - // The processing of an element node E MUST be modified slightly - // when an XPath node-set is given as input and the element's - // parent is omitted from the node-set. - private void WriteAttributesAxis (XmlNode node) - { - // Console.WriteLine ("Debug: attributes"); - - ArrayList list = new ArrayList (); - foreach (XmlNode attribute in node.Attributes) { - if (!IsNamespaceNode (attribute) && IsNodeVisible (attribute)) - list.Add (attribute); - } - - // Add attributes from "xml" namespace for "inclusive" c14n only: - // - // The method for processing the attribute axis of an element E - // in the node-set is enhanced. All element nodes along E's - // ancestor axis are examined for nearest occurrences of - // attributes in the xml namespace, such as xml:lang and - // xml:space (whether or not they are in the node-set). - // From this list of attributes, remove any that are in E's - // attribute axis (whether or not they are in the node-set). - // Then, lexicographically merge this attribute list with the - // nodes of E's attribute axis that are in the node-set. The - // result of visiting the attribute axis is computed by - // processing the attribute nodes in this merged attribute list. - if (!exclusive && node.ParentNode != null && node.ParentNode.ParentNode != null && !IsNodeVisible (node.ParentNode.ParentNode)) { - // if we have whole document then the node.ParentNode.ParentNode - // is always visible - for (XmlNode cur = node.ParentNode; cur != null; cur = cur.ParentNode) { - if (cur.Attributes == null) - continue; - foreach (XmlNode attribute in cur.Attributes) { - // we are looking for "xml:*" attributes - if (attribute.Prefix != "xml") - continue; - - // exclude ones that are in the node's attributes axis - if (node.Attributes.GetNamedItem (attribute.LocalName, attribute.NamespaceURI) != null) - continue; - - // finally check that we don't have the same attribute in our list - bool found = false; - foreach (object obj in list) { - XmlNode n = (obj as XmlNode); - if (n.Prefix == "xml" && n.LocalName == attribute.LocalName) { - found = true; - break; - } - } - - if (found) - continue; - - // now we can add this attribute to our list - list.Add (attribute); - } - } - } - - // sort namespaces and write results - list.Sort (new XmlDsigC14NTransformAttributesComparer ()); - foreach (object obj in list) { - XmlNode attribute = (obj as XmlNode); - if (attribute != null) { - res.Append (" "); - res.Append (attribute.Name); - res.Append ("=\""); - res.Append (NormalizeString (attribute.Value, XmlNodeType.Attribute)); - res.Append ("\""); - } - } - } - - // Text Nodes - // the string value, except all ampersands are replaced - // by &, all open angle brackets (<) are replaced by <, all closing - // angle brackets (>) are replaced by >, and all #xD characters are - // replaced by . - private void WriteTextNode (XmlNode node, bool visible) - { - // Console.WriteLine ("Debug: text node"); - if (visible) - res.Append (NormalizeString (node.Value, node.NodeType)); -// res.Append (NormalizeString (node.Value, XmlNodeType.Text)); - } - - // Comment Nodes - // Nothing if generating canonical XML without comments. For - // canonical XML with comments, generate the opening comment - // symbol (). Also, a trailing #xA is rendered - // after the closing comment symbol for comment children of the - // root node with a lesser document order than the document - // element, and a leading #xA is rendered before the opening - // comment symbol of comment children of the root node with a - // greater document order than the document element. (Comment - // children of the root node represent comments outside of the - // top-level document element and outside of the document type - // declaration). - private void WriteCommentNode (XmlNode node, bool visible) - { - // Console.WriteLine ("Debug: comment node"); - if (visible && comments) { - if (state == XmlCanonicalizerState.AfterDocElement) - res.Append ("\x0A\x0A"); - else - res.Append ("-->"); - } - } - - // Processing Instruction (PI) Nodes- - // The opening PI symbol (). If the string value is empty, - // then the leading space is not added. Also, a trailing #xA is - // rendered after the closing PI symbol for PI children of the - // root node with a lesser document order than the document - // element, and a leading #xA is rendered before the opening PI - // symbol of PI children of the root node with a greater document - // order than the document element. - private void WriteProcessingInstructionNode (XmlNode node, bool visible) - { - // Console.WriteLine ("Debug: PI node"); - - if (visible) { - if (state == XmlCanonicalizerState.AfterDocElement) - res.Append ("\x0A 0) { - res.Append (" "); - res.Append (NormalizeString (node.Value, XmlNodeType.ProcessingInstruction)); - } - - if (state == XmlCanonicalizerState.BeforeDocElement) - res.Append ("?>\x0A"); - else - res.Append ("?>"); - } - } - - private bool IsNodeVisible (XmlNode node) - { - // if node list is empty then we process whole document - if (xnl == null) - return true; - - // walk thru the list - foreach (XmlNode xn in xnl) { - if (node.Equals (xn)) - return true; - } - - return false; - } - - private bool IsNamespaceRendered (string prefix, string uri) - { - // if the default namespace xmlns="" is not re-defined yet - // then we do not want to print it out - bool IsEmptyNs = prefix == string.Empty && uri == string.Empty; - int start = (IsEmptyNs) ? 0 : prevVisibleNamespacesStart; - for (int i = visibleNamespaces.Count - 1; i >= start; i--) { - XmlNode node = (visibleNamespaces[i] as XmlNode); - if (node != null) { - // get namespace prefix - string p = string.Empty; - if (node.Prefix == "xmlns") - p = node.LocalName; - if (p == prefix) - return node.Value == uri; - } - } - - return IsEmptyNs; - } - - private bool IsNamespaceNode (XmlNode node) - { - if (node == null || node.NodeType != XmlNodeType.Attribute) - return false; - return node.NamespaceURI == "http://www.w3.org/2000/xmlns/"; - } - - private bool IsTextNode (XmlNodeType type) - { - switch (type) { - case XmlNodeType.Text: - case XmlNodeType.CDATA: - case XmlNodeType.SignificantWhitespace: - case XmlNodeType.Whitespace: - return true; - } - return false; - } - - private string NormalizeString (string input, XmlNodeType type) - { - StringBuilder sb = new StringBuilder (); - for (int i = 0; i < input.Length; i++) { - char ch = input[i]; - if (ch == '<' && (type == XmlNodeType.Attribute || IsTextNode (type))) - sb.Append ("<"); - else if (ch == '>' && IsTextNode (type)) - sb.Append (">"); - else if (ch == '&' && (type == XmlNodeType.Attribute || IsTextNode (type))) - sb.Append ("&"); - else if (ch == '\"' && type == XmlNodeType.Attribute) - sb.Append ("""); - else if (ch == '\x09' && type == XmlNodeType.Attribute) - sb.Append (" "); - else if (ch == '\x0A' && type == XmlNodeType.Attribute) - sb.Append (" "); - else if (ch == '\x0D' && (type == XmlNodeType.Attribute || - IsTextNode (type) && type != XmlNodeType.Whitespace || - type == XmlNodeType.Comment || - type == XmlNodeType.ProcessingInstruction)) - sb.Append (" "); - else if (ch == '\x0D') - continue; - else - sb.Append (ch); - } - - return sb.ToString (); - } - } - - internal class XmlDsigC14NTransformAttributesComparer : IComparer - { - public int Compare (object x, object y) - { - XmlNode n1 = (x as XmlNode); - XmlNode n2 = (y as XmlNode); - - // simple cases - if (n1 == n2) - return 0; - else if (n1 == null) - return -1; - else if (n2 == null) - return 1; - else if (n1.Prefix == n2.Prefix) - return string.Compare (n1.LocalName, n2.LocalName); - - // Attributes in the default namespace are first - // because the default namespace is not applied to - // unqualified attributes - if (n1.Prefix == string.Empty) - return -1; - else if (n2.Prefix == string.Empty) - return 1; - - int ret = string.Compare (n1.NamespaceURI, n2.NamespaceURI); - if (ret == 0) - ret = string.Compare (n1.LocalName, n2.LocalName); - return ret; - } - } - - internal class XmlDsigC14NTransformNamespacesComparer : IComparer - { - public int Compare (object x, object y) - { - XmlNode n1 = (x as XmlNode); - XmlNode n2 = (y as XmlNode); - - // simple cases - if (n1 == n2) - return 0; - else if (n1 == null) - return -1; - else if (n2 == null) - return 1; - else if (n1.Prefix == string.Empty) - return -1; - else if (n2.Prefix == string.Empty) - return 1; - - return string.Compare (n1.LocalName, n2.LocalName); - } - } -} - diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Addressing/Action.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Addressing/Action.cs deleted file mode 100644 index ce4aa4d44e6..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Addressing/Action.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using NUnit.Framework; -using System.Xml; -using Microsoft.Web.Services; - -namespace Microsoft.Web.Services.Addressing.Tests -{ - - [TestFixture] - public class ActionTest - { - - [Test] - public void CreateAction () - { - Action a = new Action("urn:action:test"); - Assert.IsTrue (a.Value == "urn:action:test"); - } - - [Test] - public void ActionToXml () - { - Action a = new Action("urn:action:test"); - XmlElement element = a.GetXml(new XmlDocument()); - Assert.IsTrue (element.OuterXml.Length != 0); - } - - [Test] - public void XmlToAction () - { - XmlDocument document = new XmlDocument (); - - XmlElement element = document.CreateElement("wsa", "Action", "http://schemas.xmlsoap.org/ws/2003/03/addressing"); - element.InnerText = "urn:action:test"; - - Action a = new Action (element); - - Assert.IsTrue (a.Value == "urn:action:test"); - } - - [Test] - public void RoundTripFromAction () - { - Action a = new Action ("urn:action:test"); - XmlElement element = a.GetXml(new XmlDocument()); - - Action b = new Action (element); - - Assert.IsTrue (b.Value == "urn:action:test"); - } - - [Test] - public void RoundTripFromXml () - { - XmlDocument document = new XmlDocument (); - - XmlElement element = document.CreateElement("wsa", "Action", "http://schemas.xmlsoap.org/ws/2003/03/addressing"); - element.InnerText = "urn:action:test"; - - Action a = new Action (element); - - XmlElement element2 = a.GetXml(new XmlDocument ()); - - Assert.IsTrue (element.OuterXml == element2.OuterXml); - - } - - [Test] - public void ImplicitString () - { - Action a = new Action ("urn:action:test"); - - Assert.IsTrue ("urn:action:test" == a); - } - - [Test] - public void ImplicitAction () - { - Action a = "urn:action:test"; - - Assert.IsTrue ("urn:action:test" == a); - - } - - [Test] - [ExpectedException(typeof(ArgumentException))] - public void InvalidElementExceptionTest () - { - XmlDocument doc = new XmlDocument (); - - XmlElement el = doc.CreateElement("b", "a", "d"); - - Action a = new Action (el); - } - - } - - -} diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Addressing/Address.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Addressing/Address.cs deleted file mode 100644 index 5a37c760c63..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Addressing/Address.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System; -using System.Xml; -using NUnit.Framework; -using Microsoft.Web.Services.Addressing; - -namespace Microsoft.Web.Services.Addressing.Tests -{ - - [TestFixture] - public class AddressTests - { - - [Test] - public void CreateAddress () - { - Address a = new Address (new Uri("soap.tcp://127.0.0.1/")); - Assert.IsNotNull (a); - } - - [Test] - public void AddressToXml () - { - Address a = new Address (new Uri("soap.tcp://127.0.0.1/")); - XmlElement e = a.GetXml (new XmlDocument ()); - - Assert.IsTrue (e.OuterXml.Length != 0); - } - - [Test] - public void XmlToAddress () - { - XmlDocument doc = new XmlDocument (); - XmlElement e = doc.CreateElement ("wsa", "Address", "http://schemas.xmlsoap.org/ws/2003/03/addressing"); - - e.InnerText = "soap.tcp://127.0.0.1/"; - - Address a = new Address (e); - - Assert.IsTrue (a.Value.AbsoluteUri == e.InnerText); - } - - [Test] - public void RoundTripFromAddress () - { - Address a = new Address (new Uri("soap.tcp://127.0.0.1")); - - XmlElement e = a.GetXml (new XmlDocument ()); - - Address b = new Address (e); - - Assert.IsTrue (a.Value.AbsoluteUri == b.Value.AbsoluteUri); - } - - [Test] - public void RoundTripFromXml () - { - XmlDocument doc = new XmlDocument (); - XmlElement e = doc.CreateElement ("wsa", "Address", "http://schemas.xmlsoap.org/ws/2003/03/addressing"); - - e.InnerText = "soap.tcp://127.0.0.1/"; - - Address a = new Address (e); - - XmlElement e2 = a.GetXml (new XmlDocument ()); - - Assert.IsTrue (e.OuterXml == e2.OuterXml); - } - - [Test] - public void ImplicitUri () - { - Uri u = new Uri ("soap.tcp://127.0.0.1/"); - - Address a = new Address(u); - - Assert.IsTrue (u.AbsoluteUri == ((Uri)a).AbsoluteUri); - } - - [Test] - public void ImplicitAddress () - { - Uri u = new Uri ("soap.tcp://127.0.0.1"); - - Address a = new Address (u); - - Assert.AreEqual (u, (Uri)a); - } - - [Test] - [ExpectedException(typeof(ArgumentException))] - public void InvalidArgumentException() - { - XmlDocument document = new XmlDocument (); - XmlElement e = document.CreateElement ("b", "a", "d"); - - Address a = new Address (e); - } - - } - -} diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Addressing/AddressList.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Addressing/AddressList.cs deleted file mode 100644 index 6196298ae67..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Addressing/AddressList.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using NUnit.Framework; -using Microsoft.Web.Services.Addressing; - -namespace Microsoft.Web.Services.Addressing.Tests -{ - [TestFixture] - public class AddressListTests - { - [Test] - public void NoTestsYet () - { - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Addressing/AddressingHeaders.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Addressing/AddressingHeaders.cs deleted file mode 100644 index 9554af83b63..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Addressing/AddressingHeaders.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using NUnit.Framework; -using Microsoft.Web.Services.Addressing; - -namespace Microsoft.Web.Services.Addressing.Tests -{ - - [TestFixture] - public class AddressingHeadersTest - { - - [Test] - public void NoTestsYet () - { - } - - } - -} diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Addressing/EndpointReference.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Addressing/EndpointReference.cs deleted file mode 100644 index a5d8071ea58..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Addressing/EndpointReference.cs +++ /dev/null @@ -1,123 +0,0 @@ -using System; -using System.Xml; -using NUnit.Framework; -using Microsoft.Web.Services.Xml; -using Microsoft.Web.Services.Addressing; - -namespace Microsoft.Web.Services.Addressing.Tests -{ - [TestFixture] - public class EndpointReferenceTests - { - - [Test] - public void CreateEndpointReferenceFromAddress () - { - EndpointReference e = new EndpointReference( new Address ( new Uri ("soap.tcp://127.0.0.1") ) ); - - Assert.IsNotNull (e.Address.Value); - } - - [Test] - public void CreateEndpointReferenceFromUri () - { - EndpointReference e = new EndpointReference( new Uri ("soap.tcp://127.0.0.1") ); - - Assert.IsNotNull (e.Address.Value); - } - - [Test] - public void MinimalXmlToEndpointReference () - { - XmlDocument doc = new XmlDocument (); - XmlElement element = doc.CreateElement ("wsa", "EndpointReference", "http://schemas.xmlsoap.org/ws/2003/03/addressing"); - - Address a = new Address ( new Uri ("soap.tcp://127.0.0.1") ); - - element.AppendChild (a.GetXml (doc)); - - EndpointReference e = new EndpointReference (element); - } - - [Test] - public void EndpointReferenceToMinimalXml () - { - EndpointReference e = new EndpointReference ( new Uri ("soap.tcp://127.0.0.1/") ); - XmlElement e2 = e.GetXml (new XmlDocument ()); - - Assert.IsTrue (e2.FirstChild.InnerText == "soap.tcp://127.0.0.1/"); - } - - [Test] - public void EndpointReferenceToXmlWithPortType () - { - EndpointReference e = new EndpointReference ( new Uri ("soap.tcp://127.0.0.1/") ); - e.PortType = new PortType (new QualifiedName ("a","s","http://schemas.xmlsoap.org/ws/2003/03/addressing")); - - XmlElement element = e.GetXml (new XmlDocument ()); - - Assert.IsTrue (element.FirstChild.NextSibling.InnerText == "a:s"); - } - - [Test] - public void EndpointReferenceToXmlWithProperties () - { - EndpointReference e = new EndpointReference (new Uri ("soap.tcp://127.0.0.1/") ); - e.ReferenceProperties = new ReferenceProperties (); - - XmlElement element = e.GetXml (new XmlDocument ()); - - Assert.IsTrue (element.FirstChild.NextSibling.LocalName == "ReferenceProperties"); - } - - [Test] - public void EndpointReferenceToXmlWithServiceName () - { - EndpointReference e = new EndpointReference (new Uri ("soap.tcp://127.0.0.1/") ); - e.ServiceName = new ServiceName( new QualifiedName ("a", "s", "http://schemas.xmlsoap.org/ws/2003/03/addressing")); - e.ServiceName.PortName = "test"; - - XmlElement element = e.GetXml (new XmlDocument ()); - - Assert.IsTrue (element.FirstChild.NextSibling.Attributes["wsa:PortName"].InnerText == "test"); - } - - [Test] - public void RoundTripFromXml () - { - XmlDocument doc = new XmlDocument (); - XmlElement element = doc.CreateElement ("wsa", "EndpointReference", "http://schemas.xmlsoap.org/ws/2003/03/addressing"); - - Address a = new Address ( new Uri ("soap.tcp://127.0.0.1") ); - - element.AppendChild (a.GetXml (doc)); - - PortType p = new PortType (new QualifiedName ("wsa", "test", "http://schemas.xmlsoap.org/ws/2003/03/addressing")); - - element.AppendChild (p.GetXml (doc)); - - EndpointReference e = new EndpointReference (element); - - XmlElement e2 = e.GetXml (new XmlDocument ()); - - Assert.IsNotNull (element); - Assert.IsNotNull (e2); - - Assert.IsTrue (element.OuterXml == e2.OuterXml); - } - - [Test] - public void RoundTripFromEndpointReference () - { - EndpointReference e = new EndpointReference ( new Uri ("soap.tcp://127.0.0.1/") ); - XmlElement e2 = e.GetXml (new XmlDocument ()); - - EndpointReference er = new EndpointReference (e2); - - Assert.IsTrue (e.Address.Value.AbsoluteUri == er.Address.Value.AbsoluteUri); - } - - //Not going to bother testing the implicit operators, they work fine. - - } -} diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Configuration/ChangeLog b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Configuration/ChangeLog deleted file mode 100644 index 0f0802c48ce..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Configuration/ChangeLog +++ /dev/null @@ -1,6 +0,0 @@ -2003-09-14 Sebastien Pouliot - - * ConfigurationBaseTest.cs: New. Test all WSE1 static protected methods. - * FilterConfigurationTest.cs: New. Test presence of default input/output - SOAP filters. - * WebServicesConfigurationTest.cs: New. Test FilterConfiguration. diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Configuration/ConfigurationBaseTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Configuration/ConfigurationBaseTest.cs deleted file mode 100644 index d02a7b4549e..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Configuration/ConfigurationBaseTest.cs +++ /dev/null @@ -1,344 +0,0 @@ -// -// ConfigurationBaseTest.cs: ConfigurationBase Unit Tests -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Configuration; -using System.Xml; - -using WSEC = Microsoft.Web.Services.Configuration; - -using NUnit.Framework; - -namespace MonoTests.MS.Web.Services.Configuration { - - [TestFixture] - public class ConfigurationBaseTest : WSEC.ConfigurationBase { - - [Test] - public void CheckForChildNodes_NoChildNode () - { - string xml = ""; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - CheckForChildNodes (doc.DocumentElement); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void CheckForChildNodes_Null () - { - CheckForChildNodes (null); - } - - [Test] - [ExpectedException (typeof (ConfigurationException))] - public void CheckForChildNodes_OneNode () - { - string xml = ""; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - CheckForChildNodes (doc.DocumentElement); - } - - [Test] - public void CheckForDuplicateChildNodes_NoDupes () - { - string xml = ""; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - CheckForDuplicateChildNodes (doc.DocumentElement); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void CheckForDuplicateChildNodes_Null () - { - CheckForDuplicateChildNodes (null); - } - - [Test] - [ExpectedException (typeof (ConfigurationException))] - public void CheckForDuplicateChildNodes_Dupes () - { - string xml = ""; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - CheckForDuplicateChildNodes (doc.DocumentElement); - } - - [Test] - public void CheckForUnrecognizedAttributes_NoAttribute () - { - string xml = ""; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - CheckForUnrecognizedAttributes (doc.DocumentElement); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void CheckForUnrecognizedAttributes_Null () - { - CheckForUnrecognizedAttributes (null); - } - - [Test] - [ExpectedException (typeof (ConfigurationException))] - public void CheckForUnrecognizedAttributes_OneAttribute () - { - string xml = ""; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - CheckForUnrecognizedAttributes (doc.DocumentElement); - } - - [Test] - public void GetAndRemoveAttribute_AttribPresentNotRequired () - { - string xml = ""; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - XmlNode xn = GetAndRemoveAttribute (doc.DocumentElement, "attrib", false); - Assertion.AssertEquals ("GetAndRemoveAttribute_AttribPresentNotRequired", "attrib=\"value\"", xn.OuterXml); - } - - [Test] - public void GetAndRemoveAttribute_AttribPresentAndRequired () - { - string xml = ""; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - XmlNode xn = GetAndRemoveAttribute (doc.DocumentElement, "attrib", true); - Assertion.AssertEquals ("GetAndRemoveAttribute_AttribPresentAndRequired", "attrib=\"value\"", xn.OuterXml); - } - - [Test] - public void GetAndRemoveAttribute_AttribNotPresentNotRequired () - { - string xml = ""; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - XmlNode xn = GetAndRemoveAttribute (doc.DocumentElement, "attrib", false); - Assertion.AssertNull ("GetAndRemoveAttribute_AttribNotPresentNotRequired", xn); - } - - [Test] - [ExpectedException (typeof (ConfigurationException))] - public void GetAndRemoveAttribute_AttribNotPresentAndRequired () - { - string xml = ""; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - XmlNode xn = GetAndRemoveAttribute (doc.DocumentElement, "attrib", true); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void GetAndRemoveAttribute_NullNode () - { - GetAndRemoveAttribute (null, "attrib", true); - } - - [Test] - public void GetAndRemoveAttribute_NullAttrib () - { - string xml = ""; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - XmlNode xn = GetAndRemoveAttribute (doc.DocumentElement, null, false); - Assertion.AssertNull ("GetAndRemoveAttribute_NullAttrib", xn); - } - - [Test] - public void GetAndRemoveBoolAttribute_AttribPresentNotRequired () - { - string xml = ""; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - bool result = false; - XmlNode xn = GetAndRemoveBoolAttribute (doc.DocumentElement, "attrib", false, ref result); - Assertion.AssertEquals ("GetAndRemoveBoolAttribute_AttribPresentNotRequired", "attrib=\"true\"", xn.OuterXml); - Assertion.Assert ("GetAndRemoveBoolAttribute_AttribPresentNotRequired", result); - } - - [Test] - public void GetAndRemoveBoolAttribute_AttribPresentAndRequired () - { - string xml = ""; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - bool result = false; - XmlNode xn = GetAndRemoveBoolAttribute (doc.DocumentElement, "attrib", true, ref result); - Assertion.AssertEquals ("GetAndRemoveBoolAttribute_AttribPresentAndRequired", "attrib=\"true\"", xn.OuterXml); - Assertion.Assert ("GetAndRemoveBoolAttribute_AttribPresentAndRequired", result); - } - - [Test] - public void GetAndRemoveBoolAttribute_AttribNotPresentNotRequired () - { - string xml = ""; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - bool result = false; - XmlNode xn = GetAndRemoveBoolAttribute (doc.DocumentElement, "attrib", false, ref result); - Assertion.AssertNull ("GetAndRemoveBoolAttribute_AttribNotPresentNotRequired", xn); - Assertion.Assert ("GetAndRemoveBoolAttribute_AttribNotPresentNotRequired", !result); - } - - [Test] - [ExpectedException (typeof (ConfigurationException))] - public void GetAndRemoveBoolAttribute_AttribNotPresentAndRequired () - { - string xml = ""; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - bool result = false; - XmlNode xn = GetAndRemoveBoolAttribute (doc.DocumentElement, "attrib", true, ref result); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void GetAndRemoveBoolAttribute_NullNode () - { - bool result = false; - GetAndRemoveBoolAttribute (null, "attrib", true, ref result); - } - - [Test] - public void GetAndRemoveBoolAttribute_NullAttrib () - { - string xml = ""; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - bool result = false; - XmlNode xn = GetAndRemoveBoolAttribute (doc.DocumentElement, null, false, ref result); - Assertion.AssertNull ("GetAndRemoveBoolAttribute_NullAttrib", xn); - Assertion.Assert ("GetAndRemoveBoolAttribute_NullAttrib", !result); - } - - [Test] - public void GetAndRemoveStringAttribute_AttribPresentNotRequired () - { - string xml = ""; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - string result = null; - XmlNode xn = GetAndRemoveStringAttribute (doc.DocumentElement, "attrib", false, ref result); - Assertion.AssertEquals ("GetAndRemoveStringAttribute_AttribPresentNotRequired", "attrib=\"true\"", xn.OuterXml); - Assertion.AssertEquals ("GetAndRemoveStringAttribute_AttribPresentNotRequired", "true", result); - } - - [Test] - public void GetAndRemoveStringAttribute_AttribPresentAndRequired () - { - string xml = ""; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - string result = null; - XmlNode xn = GetAndRemoveStringAttribute (doc.DocumentElement, "attrib", true, ref result); - Assertion.AssertEquals ("GetAndRemoveStringAttribute_AttribPresentAndRequired", "attrib=\"true\"", xn.OuterXml); - Assertion.AssertEquals ("GetAndRemoveStringAttribute_AttribPresentAndRequired", "true", result); - } - - [Test] - public void GetAndRemoveStringAttribute_AttribNotPresentNotRequired () - { - string xml = ""; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - string result = null; - XmlNode xn = GetAndRemoveStringAttribute (doc.DocumentElement, "attrib", false, ref result); - Assertion.AssertNull ("GetAndRemoveBoolAttribute_AttribNotPresentNotRequired", xn); - Assertion.AssertNull ("GetAndRemoveBoolAttribute_AttribNotPresentNotRequired", result); - } - - [Test] - [ExpectedException (typeof (ConfigurationException))] - public void GetAndRemoveStringAttribute_AttribNotPresentAndRequired () - { - string xml = ""; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - string result = null; - XmlNode xn = GetAndRemoveStringAttribute (doc.DocumentElement, "attrib", true, ref result); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void GetAndRemoveStringAttribute_NullNode () - { - string result = null; - GetAndRemoveStringAttribute (null, "attrib", true, ref result); - } - - [Test] - public void GetAndRemoveStringAttribute_NullAttrib () - { - string xml = ""; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - string result = null; - XmlNode xn = GetAndRemoveStringAttribute (doc.DocumentElement, null, false, ref result); - Assertion.AssertNull ("GetAndRemoveStringAttribute_NullAttrib", xn); - Assertion.AssertNull ("GetAndRemoveStringAttribute_NullAttrib", result); - } - - [Test] - public void ThrowIfElement_NoElement () - { - string xml = ""; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - ThrowIfElement (doc.DocumentElement.ChildNodes [0]); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void ThrowIfElement_Null () - { - ThrowIfElement (null); - } - - [Test] - [ExpectedException (typeof (ConfigurationException))] - public void ThrowIfElement_Element () - { - string xml = ""; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - ThrowIfElement (doc.DocumentElement); - } - - [Test] - public void ThrowIfNotComment_NoComment () - { - string xml = ""; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - ThrowIfNotComment (doc.DocumentElement.ChildNodes [0]); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void ThrowIfNotComment_Null () - { - ThrowIfNotComment (null); - } - - [Test] - [ExpectedException (typeof (ConfigurationException))] - public void ThrowIfNotComment_Element () - { - string xml = ""; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - ThrowIfNotComment (doc.DocumentElement); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Configuration/FilterConfigurationTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Configuration/FilterConfigurationTest.cs deleted file mode 100644 index 983d78eebd5..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Configuration/FilterConfigurationTest.cs +++ /dev/null @@ -1,51 +0,0 @@ -// -// FilterConfigurationTest.cs: FilterConfiguration Unit Tests -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Configuration; -using System.Xml; - -using Microsoft.Web.Services.Configuration; -using Microsoft.Web.Services.Security; -using Microsoft.Web.Services.Timestamp; -using Microsoft.Web.Services.Referral; -using Microsoft.Web.Services.Routing; - -using NUnit.Framework; - -namespace MonoTests.MS.Web.Services.Configuration { - - [TestFixture] - public class FilterConfigurationTest : Assertion { - - [Test] - public void InputFilters () - { - FilterConfiguration fc = WebServicesConfiguration.FilterConfiguration; - AssertEquals ("InputFilters.Count", 4, fc.InputFilters.Count); - // order is important (think so) - Assert ("InputFilters.0.SecurityInputFilter", fc.InputFilters [0] is SecurityInputFilter); - Assert ("InputFilters.1.TimestampInputFilter", fc.InputFilters [1] is TimestampInputFilter); - Assert ("InputFilters.2.ReferralInputFilter", fc.InputFilters [2] is ReferralInputFilter); - Assert ("InputFilters.3.RoutingInputFilter", fc.InputFilters [3] is RoutingInputFilter); - } - - [Test] - public void OutputFilters () - { - FilterConfiguration fc = WebServicesConfiguration.FilterConfiguration; - AssertEquals ("OutputFilters.Count", 4, fc.OutputFilters.Count); - // order is important (think so) - Assert ("InputFilters.0.SecurityOutputFilter", fc.OutputFilters [0] is SecurityOutputFilter); - Assert ("InputFilters.1.TimestampOutputFilter", fc.OutputFilters [1] is TimestampOutputFilter); - Assert ("InputFilters.2.ReferralOutputFilter", fc.OutputFilters [2] is ReferralOutputFilter); - Assert ("InputFilters.3.RoutingOutputFilter", fc.OutputFilters [3] is RoutingOutputFilter); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Configuration/WebServicesConfigurationTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Configuration/WebServicesConfigurationTest.cs deleted file mode 100644 index 213a4ecdaac..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Configuration/WebServicesConfigurationTest.cs +++ /dev/null @@ -1,28 +0,0 @@ -// -// WebServicesConfigurationTest.cs: WebServicesConfiguration Unit Tests -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -using Microsoft.Web.Services.Configuration; - -using NUnit.Framework; - -namespace MonoTests.MS.Web.Services.Configuration { - - [TestFixture] - public class WebServicesConfigurationTest : Assertion { - - [Test] - public void FilterConfiguration () - { - FilterConfiguration fc = WebServicesConfiguration.FilterConfiguration; - AssertNotNull ("FilterConfiguration", fc); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/AllTests.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/AllTests.cs deleted file mode 100644 index fca19662826..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/AllTests.cs +++ /dev/null @@ -1,126 +0,0 @@ -// -// MonoTests.MS.Web.Services.Security.AllTests.cs -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Security.Cryptography; -using Microsoft.Web.Services.Security; -using NUnit.Framework; - -namespace MonoTests.MS.Web.Services.Security { - - public class AllTests { - - public static byte[] dsaG = { 0x3D, 0x4F, 0xCC, 0x78, 0x6A, 0x7A, 0x23, 0xF1, 0x41, 0x76, 0xEB, 0xB0, 0x0F, 0xD5, 0x0F, 0x78, 0x21, 0x73, 0x83, 0xC2, 0x1B, 0xF4, 0x7E, 0x68, 0xB2, 0x4B, - 0xB9, 0x9D, 0x3F, 0x00, 0x84, 0x74, 0xD8, 0xF3, 0x31, 0xAA, 0x7A, 0xDB, 0xAF, 0x1E, 0x1C, 0x5B, 0x11, 0x2B, 0x78, 0x94, 0xBC, 0xFC, 0x69, 0x7C, 0xD7, - 0xD2, 0x82, 0x22, 0x32, 0xCB, 0xAC, 0x06, 0xBE, 0x84, 0xFD, 0xA0, 0x5D, 0xA2, 0x80, 0x48, 0xDF, 0xA7, 0xC7, 0xC1, 0x6F, 0x16, 0x9D, 0xD0, 0xA6, 0xC2, - 0x40, 0x75, 0x92, 0xFE, 0xE6, 0x85, 0x12, 0x01, 0xE3, 0x7D, 0x36, 0x52, 0xB7, 0xEF, 0x0B, 0x62, 0x96, 0x42, 0xE0, 0x72, 0xA5, 0xF9, 0x74, 0xFB, 0xE6, - 0xB5, 0xC2, 0x10, 0x4C, 0x0A, 0x1E, 0x55, 0x4C, 0x96, 0x07, 0xD6, 0xC0, 0x64, 0x14, 0x86, 0x95, 0x35, 0xE5, 0x1B, 0xB7, 0x94, 0x3A, 0xFD, 0x47, 0x62, - 0x65, 0x56 }; - public static byte[] dsaJ = { 0x00, 0x00, 0x00, 0x01, 0x0E, 0x8B, 0x4A, 0xE4, 0x62, 0x61, 0xDB, 0x28, 0x71, 0x9E, 0xAB, 0x83, 0x2A, 0x88, 0x3A, 0x91, 0x35, 0xFE, 0xE0, 0x8E, 0xD4, 0xF7, - 0xC4, 0x9F, 0xBE, 0x7C, 0x2E, 0x0D, 0x95, 0x5B, 0xA3, 0x87, 0x25, 0x36, 0x07, 0x34, 0x2D, 0xF4, 0xB3, 0x48, 0x12, 0x4C, 0x6F, 0xC9, 0xB7, 0x7A, 0x07, - 0x61, 0x7F, 0x92, 0xF2, 0xFA, 0xED, 0x35, 0x86, 0xFC, 0x91, 0x12, 0x7F, 0x8A, 0x98, 0x1C, 0xA1, 0xF1, 0xAA, 0xD9, 0x0A, 0x3F, 0x71, 0x82, 0x8F, 0xED, - 0x15, 0xF6, 0x2B, 0xA1, 0x09, 0xC1, 0x27, 0xD6, 0x22, 0x78, 0x6C, 0x34, 0xCA, 0xF5, 0x26, 0x6C, 0xEE, 0x2B, 0x49, 0x54, 0x2A, 0x45, 0xD7, 0x5D, 0x5A, - 0x35, 0xE5, 0xF2, 0xFC, 0x3B, 0x6F, 0xF5, 0xEA, 0xE1, 0x16, 0x32 }; - public static byte[] dsaP = { 0xB3, 0xF3, 0x9C, 0xD2, 0xDE, 0x20, 0x8F, 0x43, 0x51, 0xAA, 0x40, 0x8A, 0x8B, 0x8C, 0xA7, 0x26, 0x73, 0x80, 0x12, 0xE9, 0x0D, 0x86, 0x39, 0x07, 0x24, 0xF3, - 0xB3, 0x36, 0xC1, 0xCF, 0xEB, 0xD9, 0x32, 0x1C, 0xC5, 0x30, 0x67, 0x70, 0x33, 0x3A, 0x42, 0xC6, 0x60, 0xE5, 0xA5, 0x3A, 0x8D, 0xB3, 0x95, 0x82, 0xB3, - 0x49, 0xB6, 0x72, 0x80, 0x30, 0xC8, 0xE5, 0xD0, 0x96, 0x03, 0x98, 0x10, 0x17, 0x66, 0x46, 0x1C, 0x45, 0x25, 0x58, 0x93, 0x20, 0x53, 0x21, 0xE6, 0x93, - 0x26, 0xCE, 0x8B, 0x8E, 0x1C, 0xC8, 0x76, 0x97, 0xF7, 0x27, 0x86, 0x7D, 0xB9, 0xE8, 0x73, 0x7C, 0x45, 0xF6, 0xC6, 0x20, 0x90, 0x0D, 0xEF, 0x3D, 0x46, - 0x5A, 0x26, 0xE6, 0x0C, 0x3A, 0xC0, 0x69, 0xDE, 0x9C, 0x8F, 0x75, 0xE3, 0x7C, 0xFE, 0x62, 0xD4, 0xF2, 0x7D, 0x22, 0xBD, 0x44, 0x72, 0x3F, 0xED, 0xC6, - 0x7B, 0xD3 }; - public static byte[] dsaQ = { 0xAA, 0x47, 0x13, 0x5B, 0xE0, 0x9E, 0xD0, 0xBE, 0x64, 0xF0, 0xE1, 0x93, 0x50, 0xC9, 0x11, 0xA0, 0x62, 0x83, 0x73, 0x51 }; - public static byte[] dsaX = { 0x7C, 0x03, 0xB2, 0xB5, 0x9B, 0x6D, 0x51, 0x91, 0x73, 0xB7, 0xF0, 0x2F, 0xC1, 0x18, 0xA7, 0x9A, 0xF6, 0x0A, 0x2F, 0xB1 }; - public static byte[] dsaY = { 0xB2, 0x12, 0x51, 0x51, 0xD1, 0xB1, 0x11, 0x8C, 0x52, 0x28, 0xCE, 0x49, 0x56, 0x89, 0x7D, 0x1C, 0x07, 0x50, 0xC0, 0x82, 0xBE, 0xC0, 0x5F, 0x57, 0xE2, 0x7F, - 0x52, 0x00, 0x3F, 0xBE, 0xBD, 0xF6, 0x4E, 0x30, 0xE6, 0x22, 0xF8, 0xCD, 0x72, 0xBA, 0xF4, 0x00, 0x95, 0x0B, 0xE7, 0x4A, 0x54, 0xD3, 0x5A, 0xBE, 0xC2, - 0x64, 0xF4, 0x55, 0x00, 0x80, 0x8B, 0x80, 0x30, 0x5B, 0xAA, 0x2F, 0x62, 0x37, 0xE2, 0x1D, 0xEB, 0x47, 0x1C, 0x27, 0xE8, 0x70, 0xDE, 0x91, 0x83, 0x7C, - 0xBA, 0x49, 0xEC, 0x87, 0x45, 0x3E, 0xCC, 0xC9, 0x11, 0xE5, 0x0E, 0xF9, 0x26, 0x41, 0xC1, 0xFF, 0x27, 0x8C, 0x65, 0xD4, 0x2E, 0xA4, 0x8E, 0x0E, 0xCF, - 0xCD, 0x4D, 0xC8, 0xA2, 0x5F, 0xB1, 0x34, 0xEE, 0xB9, 0xBE, 0x29, 0xF9, 0x71, 0x14, 0xE8, 0x34, 0xAA, 0xD5, 0x80, 0x86, 0x66, 0x0B, 0xC4, 0x89, 0x03, - 0xC7, 0xBB }; - public static int dsaCounter = 224; - public static byte[] dsaSeed = { 0xB9, 0x83, 0x39, 0x6F, 0x6D, 0x25, 0xBA, 0xF6, 0xEE, 0xC9, 0xEB, 0xE2, 0xF5, 0x35, 0xC7, 0xC1, 0xE9, 0x1B, 0xAF, 0x9B }; - - static public DSAParameters GetDSAKey (bool includePrivateKey) - { - DSAParameters p = new DSAParameters(); - p.Counter = dsaCounter; - p.G = (byte[]) dsaG.Clone (); - p.J = (byte[]) dsaJ.Clone (); - p.P = (byte[]) dsaP.Clone (); - p.Q = (byte[]) dsaQ.Clone (); - p.Seed = (byte[]) dsaSeed.Clone (); - p.Y = (byte[]) dsaY.Clone (); - if (includePrivateKey) - p.X = (byte[]) dsaX.Clone (); - else - p.X = null; - return p; - } - - static byte[] rsaModulus = { 0xbb, 0xf8, 0x2f, 0x09, 0x06, 0x82, 0xce, 0x9c, 0x23, 0x38, 0xac, 0x2b, 0x9d, 0xa8, 0x71, 0xf7, - 0x36, 0x8d, 0x07, 0xee, 0xd4, 0x10, 0x43, 0xa4, 0x40, 0xd6, 0xb6, 0xf0, 0x74, 0x54, 0xf5, 0x1f, - 0xb8, 0xdf, 0xba, 0xaf, 0x03, 0x5c, 0x02, 0xab, 0x61, 0xea, 0x48, 0xce, 0xeb, 0x6f, 0xcd, 0x48, - 0x76, 0xed, 0x52, 0x0d, 0x60, 0xe1, 0xec, 0x46, 0x19, 0x71, 0x9d, 0x8a, 0x5b, 0x8b, 0x80, 0x7f, - 0xaf, 0xb8, 0xe0, 0xa3, 0xdf, 0xc7, 0x37, 0x72, 0x3e, 0xe6, 0xb4, 0xb7, 0xd9, 0x3a, 0x25, 0x84, - 0xee, 0x6a, 0x64, 0x9d, 0x06, 0x09, 0x53, 0x74, 0x88, 0x34, 0xb2, 0x45, 0x45, 0x98, 0x39, 0x4e, - 0xe0, 0xaa, 0xb1, 0x2d, 0x7b, 0x61, 0xa5, 0x1f, 0x52, 0x7a, 0x9a, 0x41, 0xf6, 0xc1, 0x68, 0x7f, - 0xe2, 0x53, 0x72, 0x98, 0xca, 0x2a, 0x8f, 0x59, 0x46, 0xf8, 0xe5, 0xfd, 0x09, 0x1d, 0xbd, 0xcb }; - static byte[] rsaExponent = { 0x11 }; - static byte[] rsaP = { 0xee, 0xcf, 0xae, 0x81, 0xb1, 0xb9, 0xb3, 0xc9, 0x08, 0x81, 0x0b, 0x10, 0xa1, 0xb5, 0x60, 0x01, - 0x99, 0xeb, 0x9f, 0x44, 0xae, 0xf4, 0xfd, 0xa4, 0x93, 0xb8, 0x1a, 0x9e, 0x3d, 0x84, 0xf6, 0x32, - 0x12, 0x4e, 0xf0, 0x23, 0x6e, 0x5d, 0x1e, 0x3b, 0x7e, 0x28, 0xfa, 0xe7, 0xaa, 0x04, 0x0a, 0x2d, - 0x5b, 0x25, 0x21, 0x76, 0x45, 0x9d, 0x1f, 0x39, 0x75, 0x41, 0xba, 0x2a, 0x58, 0xfb, 0x65, 0x99 }; - static byte[] rsaQ = { 0xc9, 0x7f, 0xb1, 0xf0, 0x27, 0xf4, 0x53, 0xf6, 0x34, 0x12, 0x33, 0xea, 0xaa, 0xd1, 0xd9, 0x35, - 0x3f, 0x6c, 0x42, 0xd0, 0x88, 0x66, 0xb1, 0xd0, 0x5a, 0x0f, 0x20, 0x35, 0x02, 0x8b, 0x9d, 0x86, - 0x98, 0x40, 0xb4, 0x16, 0x66, 0xb4, 0x2e, 0x92, 0xea, 0x0d, 0xa3, 0xb4, 0x32, 0x04, 0xb5, 0xcf, - 0xce, 0x33, 0x52, 0x52, 0x4d, 0x04, 0x16, 0xa5, 0xa4, 0x41, 0xe7, 0x00, 0xaf, 0x46, 0x15, 0x03 }; - static byte[] rsaDP = { 0x54, 0x49, 0x4c, 0xa6, 0x3e, 0xba, 0x03, 0x37, 0xe4, 0xe2, 0x40, 0x23, 0xfc, 0xd6, 0x9a, 0x5a, - 0xeb, 0x07, 0xdd, 0xdc, 0x01, 0x83, 0xa4, 0xd0, 0xac, 0x9b, 0x54, 0xb0, 0x51, 0xf2, 0xb1, 0x3e, - 0xd9, 0x49, 0x09, 0x75, 0xea, 0xb7, 0x74, 0x14, 0xff, 0x59, 0xc1, 0xf7, 0x69, 0x2e, 0x9a, 0x2e, - 0x20, 0x2b, 0x38, 0xfc, 0x91, 0x0a, 0x47, 0x41, 0x74, 0xad, 0xc9, 0x3c, 0x1f, 0x67, 0xc9, 0x81 }; - static byte[] rsaDQ = { 0x47, 0x1e, 0x02, 0x90, 0xff, 0x0a, 0xf0, 0x75, 0x03, 0x51, 0xb7, 0xf8, 0x78, 0x86, 0x4c, 0xa9, - 0x61, 0xad, 0xbd, 0x3a, 0x8a, 0x7e, 0x99, 0x1c, 0x5c, 0x05, 0x56, 0xa9, 0x4c, 0x31, 0x46, 0xa7, - 0xf9, 0x80, 0x3f, 0x8f, 0x6f, 0x8a, 0xe3, 0x42, 0xe9, 0x31, 0xfd, 0x8a, 0xe4, 0x7a, 0x22, 0x0d, - 0x1b, 0x99, 0xa4, 0x95, 0x84, 0x98, 0x07, 0xfe, 0x39, 0xf9, 0x24, 0x5a, 0x98, 0x36, 0xda, 0x3d }; - static byte[] rsaInverseQ = { 0xb0, 0x6c, 0x4f, 0xda, 0xbb, 0x63, 0x01, 0x19, 0x8d, 0x26, 0x5b, 0xdb, 0xae, 0x94, 0x23, 0xb3, - 0x80, 0xf2, 0x71, 0xf7, 0x34, 0x53, 0x88, 0x50, 0x93, 0x07, 0x7f, 0xcd, 0x39, 0xe2, 0x11, 0x9f, - 0xc9, 0x86, 0x32, 0x15, 0x4f, 0x58, 0x83, 0xb1, 0x67, 0xa9, 0x67, 0xbf, 0x40, 0x2b, 0x4e, 0x9e, - 0x2e, 0x0f, 0x96, 0x56, 0xe6, 0x98, 0xea, 0x36, 0x66, 0xed, 0xfb, 0x25, 0x79, 0x80, 0x39, 0xf7 }; - static byte[] rsaD = { 0xa5, 0xda, 0xfc, 0x53, 0x41, 0xfa, 0xf2, 0x89, 0xc4, 0xb9, 0x88, 0xdb, 0x30, 0xc1, 0xcd, 0xf8, - 0x3f, 0x31, 0x25, 0x1e, 0x06, 0x68, 0xb4, 0x27, 0x84, 0x81, 0x38, 0x01, 0x57, 0x96, 0x41, 0xb2, - 0x94, 0x10, 0xb3, 0xc7, 0x99, 0x8d, 0x6b, 0xc4, 0x65, 0x74, 0x5e, 0x5c, 0x39, 0x26, 0x69, 0xd6, - 0x87, 0x0d, 0xa2, 0xc0, 0x82, 0xa9, 0x39, 0xe3, 0x7f, 0xdc, 0xb8, 0x2e, 0xc9, 0x3e, 0xda, 0xc9, - 0x7f, 0xf3, 0xad, 0x59, 0x50, 0xac, 0xcf, 0xbc, 0x11, 0x1c, 0x76, 0xf1, 0xa9, 0x52, 0x94, 0x44, - 0xe5, 0x6a, 0xaf, 0x68, 0xc5, 0x6c, 0x09, 0x2c, 0xd3, 0x8d, 0xc3, 0xbe, 0xf5, 0xd2, 0x0a, 0x93, - 0x99, 0x26, 0xed, 0x4f, 0x74, 0xa1, 0x3e, 0xdd, 0xfb, 0xe1, 0xa1, 0xce, 0xcc, 0x48, 0x94, 0xaf, - 0x94, 0x28, 0xc2, 0xb7, 0xb8, 0x88, 0x3f, 0xe4, 0x46, 0x3a, 0x4b, 0xc8, 0x5b, 0x1c, 0xb3, 0xc1 }; - - static public RSAParameters GetRSAKey (bool includePrivateKey) - { - RSAParameters p = new RSAParameters(); - if (includePrivateKey) { - p.D = (byte[]) rsaD.Clone(); - p.DP = (byte[]) rsaDP.Clone(); - p.DQ = (byte[]) rsaDQ.Clone(); - p.P = (byte[]) rsaP.Clone(); - p.Q = (byte[]) rsaQ.Clone(); - p.InverseQ = (byte[]) rsaInverseQ.Clone(); - } - else { - p.D = null; - p.DP = null; - p.DQ = null; - p.P = null; - p.Q = null; - p.InverseQ = null; - } - p.Modulus = (byte[]) rsaModulus.Clone(); - p.Exponent = (byte[]) rsaExponent.Clone(); - return p; - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/AsymmetricDecryptionKeyTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/AsymmetricDecryptionKeyTest.cs deleted file mode 100644 index a93db217795..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/AsymmetricDecryptionKeyTest.cs +++ /dev/null @@ -1,81 +0,0 @@ -// -// AsymmetricDecryptionKeyTest.cs -// - NUnit Test Cases for AsymmetricDecryptionKey -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Security; -using System; -using System.Security.Cryptography; -using System.Web.Services.Protocols; -using System.Xml; - -namespace MonoTests.MS.Web.Services.Security { - - [TestFixture] - public class AsymmetricDecryptionKeyTest : Assertion { - - [Test] - //[ExpectedException (typeof (SecurityFault))] - public void ConstructorNull () - { - try { - AsymmetricDecryptionKey aek = new AsymmetricDecryptionKey (null); - } - catch (SoapHeaderException) { - // SecurityFault is internal - } - catch (Exception e) { - Fail ("Expected SecurityFault but got " + e.ToString ()); - } - } - - [Test] - // [ExpectedException (typeof (SecurityFault))] - public void ConstructorDSA () - { - try { - DSA dsa = DSA.Create (); - dsa.ImportParameters (AllTests.GetDSAKey (false)); - AsymmetricDecryptionKey aek = new AsymmetricDecryptionKey (dsa); - } - catch (SoapHeaderException) { - // SecurityFault is internal - } - catch (Exception e) { - Fail ("Expected SecurityFault but got " + e.ToString ()); - } - } - - [Test] - public void ConstructorRSA () - { - RSA rsa = RSA.Create (); - rsa.ImportParameters (AllTests.GetRSAKey (false)); - AsymmetricDecryptionKey aek = new AsymmetricDecryptionKey (rsa); - AssertNotNull ("Constructor(RSA)", aek); - } - - [Test] - public void Name () - { - RSA rsa = RSA.Create (); - rsa.ImportParameters (AllTests.GetRSAKey (false)); - AsymmetricDecryptionKey aek = new AsymmetricDecryptionKey (rsa); - // null by default (not empty) - AssertNull (aek.Name); - // can assign any string (not format) - string keyName = "My Key"; - aek.Name = keyName; - AssertEquals ("Name", keyName, aek.Name); - // can be set to null - aek.Name = null; - AssertNull (aek.Name); - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/AsymmetricEncryptionKeyTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/AsymmetricEncryptionKeyTest.cs deleted file mode 100644 index 3399d6f3510..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/AsymmetricEncryptionKeyTest.cs +++ /dev/null @@ -1,47 +0,0 @@ -// -// AsymmetricEncryptionKeyTest.cs -// - NUnit Test Cases for AsymmetricEncryptionKey -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Security; -using System; -using System.Security.Cryptography; -using System.Xml; - -namespace MonoTests.MS.Web.Services.Security { - - [TestFixture] - public class AsymmetricEncryptionKeyTest : Assertion { - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void ConstructorNull () - { - AsymmetricEncryptionKey aek = new AsymmetricEncryptionKey (null); - } - - [Test] - public void ConstructorDSA () - { - DSA dsa = DSA.Create (); - dsa.ImportParameters (AllTests.GetDSAKey (false)); - AsymmetricEncryptionKey aek = new AsymmetricEncryptionKey (dsa); - AssertNotNull("DSA-KeyInfo", aek.KeyInfo); - } - - [Test] - public void ConstructorRSA () - { - RSA rsa = RSA.Create (); - rsa.ImportParameters (AllTests.GetRSAKey (false)); - AsymmetricEncryptionKey aek = new AsymmetricEncryptionKey (rsa); - AssertNotNull ("RSA-KeyInfo", aek.KeyInfo); - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/AuthenticationKeyTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/AuthenticationKeyTest.cs deleted file mode 100644 index 0d2fdbecff4..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/AuthenticationKeyTest.cs +++ /dev/null @@ -1,97 +0,0 @@ -// -// AuthenticationKeyTest.cs -// - NUnit Test Cases for AuthenticationKey -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Security; -using System; -using System.Security.Cryptography; -using System.Xml; - -namespace MonoTests.MS.Web.Services.Security { - - [TestFixture] - public class AuthenticationKeyTest : Assertion { - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void ConstructorAsymmetricNull () - { - // we do not want to confuse the compiler about null ;-) - AsymmetricAlgorithm aa = null; - AuthenticationKey ak = new AuthenticationKey (aa); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void ConstructorSymmetricNull () - { - // we do not want to confuse the compiler about null ;-) - SymmetricAlgorithm sa = null; - AuthenticationKey ak = new AuthenticationKey (sa); - } - - [Test] - // LAMESPEC: undocumented exception - [ExpectedException (typeof (ArgumentNullException))] - public void CheckSignatureNull () - { - DSA dsa = DSA.Create (); - dsa.ImportParameters (AllTests.GetDSAKey (false)); - AuthenticationKey ak = new AuthenticationKey (dsa); - ak.CheckSignature (null); - } - - [Test] - public void CheckSignatureDSA () - { - DSA dsa = DSA.Create (); - dsa.ImportParameters (AllTests.GetDSAKey (false)); - AuthenticationKey ak = new AuthenticationKey (dsa); - AssertNotNull ("AuthenticationKey(DSA)", ak); - - XmlDocument doc = new XmlDocument (); - doc.LoadXml ("JjDjPDymSPahf7zC6CCqaTz39uQ=j2Rl0vEKoKbRfOTtEZvYoNSdiJdkCfN+FfuMntTqVMmYFFtl/nWExg=="); - SignedXml signedXml = new SignedXml (); - signedXml.LoadXml (doc.DocumentElement); - Assert ("CheckSignature(DSA)", ak.CheckSignature (signedXml)); - } - - [Test] - public void CheckSignatureRSA () - { - RSA rsa = RSA.Create (); - rsa.ImportParameters (AllTests.GetRSAKey (false)); - AuthenticationKey ak = new AuthenticationKey (rsa); - AssertNotNull ("AuthenticationKey(RSA)", ak); - - XmlDocument doc = new XmlDocument (); - doc.LoadXml ("JjDjPDymSPahf7zC6CCqaTz39uQ=l/Anzks1CncmNQsDb2ZgSYEcXcX7sS0jql5fmQcEVAkRDhxwV2Lb+6Z2yPO5F+QZ+54m8w/QJdbQJduyOF0w1blkWd1Iz5ubOt79Cg1f0zO8SYwB1X6j0SzXXB5tTm1hYjKzX/iAqgUJF1o8bscu74A8xCwQio2ay7TWoTEl/Ss="); - SignedXml signedXml = new SignedXml (); - signedXml.LoadXml (doc.DocumentElement); - Assert ("CheckSignature(RSA)", ak.CheckSignature (signedXml)); - } - - [Test] - public void CheckSignatureSymmetricAlgo () - { - // default (should be Rjindael) - SymmetricAlgorithm sa = SymmetricAlgorithm.Create (); - sa.Key = new byte [16]; // 128 bits (all zeros) - AuthenticationKey ak = new AuthenticationKey (sa); - AssertNotNull ("AuthenticationKey(SymmetricAlgorithm)", ak); - - XmlDocument doc = new XmlDocument (); - doc.LoadXml ("JjDjPDymSPahf7zC6CCqaTz39uQ=y5NfXaoCALrMxBsn/wGKNJUNJ7Y="); - SignedXml signedXml = new SignedXml (); - signedXml.LoadXml (doc.DocumentElement); - Assert ("CheckSignature(HMAC)", ak.CheckSignature (signedXml)); - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/BinarySecurityTokenTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/BinarySecurityTokenTest.cs deleted file mode 100644 index 9da5c5a1f86..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/BinarySecurityTokenTest.cs +++ /dev/null @@ -1,211 +0,0 @@ -// -// BinarySecurityTokenTest.cs -// - NUnit Test Cases for BinarySecurityToken -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Security; -using System; -using System.Security.Cryptography; -using System.Xml; -using MWSS = Microsoft.Web.Services.Security; - -namespace MonoTests.MS.Web.Services.Security { - - // non-abstract BinarySecurityToken for test uses only - public class BinarySecurityToken : MWSS.BinarySecurityToken { - -#if WSE1 - public BinarySecurityToken (XmlElement element) : base (element) {} -#endif - public BinarySecurityToken (XmlQualifiedName valueType) : base (valueType) {} - - public override AuthenticationKey AuthenticationKey { - get { return null; } - } - - public override DecryptionKey DecryptionKey { - get { return null; } - } - - public override EncryptionKey EncryptionKey { - get { return null; } - } - - public override SignatureKey SignatureKey { - get { return null; } - } - - public override bool SupportsDataEncryption { - get { return false; } - } - - public override bool SupportsDigitalSignature { - get { return false; } - } -#if WSE1 - public override void Verify() {} -#else - public override bool Equals (SecurityToken token) - { - return false; - } - - public override int GetHashCode () - { - return 0; - } - - public override bool IsCurrent { - get { return false; } - } -#endif - } - - [TestFixture] - public class BinarySecurityTokenTest : Assertion { - - private static string name = "mono"; - private static string ns = "http://www.go-mono.com/"; -#if WSE1 - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void ConstructorNullXmlElement () - { - // we do not want to confuse the compiler about null ;-) - XmlElement xel = null; - BinarySecurityToken bst = new BinarySecurityToken (xel); - } - - [Test] - public void ConstructorXmlElement () - { - string xml = ""; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - BinarySecurityToken bst = new BinarySecurityToken (doc.DocumentElement); - AssertNotNull ("BinarySecurityToken(XmlQualifiedName)", bst); - AssertEquals ("EncodingType.Name", "Base64Binary", bst.EncodingType.Name); - AssertEquals ("EncodingType.Namespace", "http://schemas.xmlsoap.org/ws/2002/07/secext", bst.EncodingType.Namespace); - AssertEquals ("ValueType.Name", name, bst.ValueType.Name); - AssertEquals ("ValueType.Namespace", ns, bst.ValueType.Namespace); - AssertNull ("RawData", bst.RawData); - Assert ("Id", bst.Id.StartsWith ("SecurityToken-")); - } -#endif - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void ConstructorNullXmlQualifiedName () - { - // we do not want to confuse the compiler about null ;-) - XmlQualifiedName xqn = null; - BinarySecurityToken bst = new BinarySecurityToken (xqn); - } - - [Test] - public void ConstructorXmlQualifiedName () - { - XmlQualifiedName xqn = new XmlQualifiedName (name, ns); - BinarySecurityToken bst = new BinarySecurityToken (xqn); - AssertNotNull ("BinarySecurityToken(XmlQualifiedName)", bst); - AssertEquals ("EncodingType.Name", "Base64Binary", bst.EncodingType.Name); - AssertEquals ("EncodingType.Namespace", "http://schemas.xmlsoap.org/ws/2002/07/secext", bst.EncodingType.Namespace); - AssertEquals ("ValueType.Name", name, bst.ValueType.Name); - AssertEquals ("ValueType.Namespace", ns, bst.ValueType.Namespace); - AssertNull ("RawData", bst.RawData); - Assert ("Id", bst.Id.StartsWith ("SecurityToken-")); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void NullEncodingType () - { - XmlQualifiedName xqn = new XmlQualifiedName (name, ns); - BinarySecurityToken bst = new BinarySecurityToken (xqn); - bst.EncodingType = null; - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void NullValueType () - { - XmlQualifiedName xqn = new XmlQualifiedName (name, ns); - BinarySecurityToken bst = new BinarySecurityToken (xqn); - bst.ValueType = null; - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void GetXmlNull () - { - XmlQualifiedName xqn = new XmlQualifiedName (name, ns); - BinarySecurityToken bst = new BinarySecurityToken (xqn); - XmlElement xel = bst.GetXml (null); - } - - [Test] - public void GetXml () - { - XmlQualifiedName xqn = new XmlQualifiedName (name, ns); - BinarySecurityToken bst = new BinarySecurityToken (xqn); - bst.Id = "staticIdUsedForNUnit"; - XmlDocument doc = new XmlDocument (); - XmlElement xel = bst.GetXml (doc); - // this one I can't generate exactly like the original so I check each parts - Assert ("GetXml(doc)1", xel.OuterXml.StartsWith (" 0); - Assert ("GetXml(doc)3", xel.OuterXml.IndexOf ("ValueType=\"vt:mono\"") > 0); - Assert ("GetXml(doc)4", xel.OuterXml.IndexOf ("EncodingType=\"wsse:Base64Binary\"") > 0); - Assert ("GetXml(doc)5", xel.OuterXml.IndexOf ("xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\"") > 0); - Assert ("GetXml(doc)6", xel.OuterXml.IndexOf ("wsu:Id=\"staticIdUsedForNUnit\"") > 0); - Assert ("GetXml(doc)7", xel.OuterXml.IndexOf ("xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/07/secext\"") > 0); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void LoadXmlNull () - { - XmlQualifiedName xqn = new XmlQualifiedName (name, ns); - BinarySecurityToken bst = new BinarySecurityToken (xqn); - bst.LoadXml (null); - } - - [Test] - public void LoadXml () - { - XmlQualifiedName xqn = new XmlQualifiedName (name, ns); - BinarySecurityToken bst = new BinarySecurityToken (xqn); - XmlDocument doc = new XmlDocument (); - doc.LoadXml (""); - bst.LoadXml (doc.DocumentElement); - AssertEquals ("EncodingType.Name", "Base64Binary", bst.EncodingType.Name); - AssertEquals ("EncodingType.Namespace", "http://schemas.xmlsoap.org/ws/2002/07/secext", bst.EncodingType.Namespace); - AssertEquals ("ValueType.Name", name, bst.ValueType.Name); - AssertEquals ("ValueType.Namespace", ns, bst.ValueType.Namespace); - AssertNull ("RawData", bst.RawData); - AssertEquals ("Id", "staticIdUsedForNUnit", bst.Id); - } - - [Test] - public void RawData () - { - XmlQualifiedName xqn = new XmlQualifiedName (name, ns); - BinarySecurityToken bst = new BinarySecurityToken (xqn); - AssertNull ("RawData(empty)", bst.RawData); - byte[] raw = new byte [1]; - bst.RawData = raw; - AssertNotNull ("RawData", bst.RawData); - AssertEquals ("RawData[0]=0", 0x00, bst.RawData [0]); - raw [0] = 1; - // same buffer or copy ? - AssertEquals ("RawData[0]=1", 0x01, bst.RawData [0]); - bst.RawData = null; - AssertNull ("RawData(null)", bst.RawData); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/ChangeLog b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/ChangeLog deleted file mode 100644 index 1b4375c54bc..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/ChangeLog +++ /dev/null @@ -1,57 +0,0 @@ -2003-11-06 Sebastien Pouliot - - * BinarySecurityTokenTest.cs: Fixed some tests and added one for RawData. - * DecryptionKeyProviderTest.cs: New. Unit tests for DecryptionKeyProvider. - * SignatureTest.cs: Updated for WSE2 compatibility (SignatureOptions). - -2003-10-31 Sebastien Pouliot - - * OASISTest.cs: New. Unit test for WSE2 OASIS descriptions. - * SaMLTest.cs: New. Unit test for WSE2 SaML descriptions. - * SMSecurityTest.cs: New. Unit test for WSE2 SMSecurity descriptions. - * XmltokTest.cs: New. Unit test for WSE2 Xmltok descriptions. - * XrMLTest.cs: New. Unit test for WSE2 XrML descriptions. - -2003-10-26 Sebastien Pouliot - - * ReferenceListTest.cs: Added test to list all references using the - enumerator. - -2003-10-25 Sebastien Pouliot - - * ReferenceListTest.cs: New. Complete unit tests for ReferenceList. - * WSSecurityTest.cs: Adjusted for WSE2. - -2003-10-24 Sebastien Pouliot - - * SignatureTest.cs: New. Basic tests for Signature. - -2003-10-22 Sebastien Pouliot - - * KeyIdentifierTest.cs: New. Unit tests for KeyIdentifier. - * NonceTest.cs: New. Unit tests for Nonce. The tests will only work for - WSE2 (as WSE1 Nonce constructor are internal) - * SecurityTokenReferenceTest.cs: New. Unit tests for SecurityTokenReference. - -2003-10-20 Sebastien Pouliot - - * EncryptedKeyTest.cs: New. Unit tests for EncryptedKey. - -2003-10-18 Sebastien Pouliot - - * X509SecurityTokenTest.cs: New. New. Unit tests for X509SecurityToken. - -2003-09-16 Sebastien Pouliot - - * AllTests.cs: New. Common methods to get DSA/RSA keypairs. - * AsymmetricDecryptionKeyTest.cs: New. Unit tests for AsymmetricDecryptionKey. - * AsymmetricEncryptionKeyTest.cs: New. Unit tests for AsymmetricEncryptionKey. - * AuthenticationKeyTest.cs: New. Unit tests for AuthenticationKey. - * BinarySecurityTokenTest.cs: New. Unit tests for BinarySecurityToken. - * SignatureKeyTest.cs: New. Unit tests for SignatureKey. - * SymmetricDecryptionKeyTest.cs: New. Unit tests for SymmetricDecryptionKey. - * SymmetricEncryptionKeyTest.cs: New. Unit tests for SymmetricEncryptionKey. - * UsernameTokenTest.cs: New. Unit tests for UsernameToken. - * WSSecurityTest.cs: New. Unit tests for WSSecurity. - * XmlEncryptionTest.cs: New. Unit tests for XmlEncryption. - * XmlSignatureTest.cs: New. Unit tests for XmlSignature. \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/DecryptionKeyProviderTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/DecryptionKeyProviderTest.cs deleted file mode 100644 index 07b3ba5bf85..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/DecryptionKeyProviderTest.cs +++ /dev/null @@ -1,79 +0,0 @@ -// -// DecryptionKeyProviderTest.cs - NUnit Test Cases for DecryptionKeyProvider -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Security; -using System; -using System.Security.Cryptography.Xml; -using System.Xml; - -namespace MonoTests.MS.Web.Services.Security { - - // Note: Test ONLY for WSE1 - the class is obsolete in WSE2 and throw an error when compiling - - [TestFixture] - public class DecryptionKeyProviderTest : Assertion { - - [Test] - public void NullAlgorithmUri () - { - DecryptionKeyProvider dkp = new DecryptionKeyProvider (); - DecryptionKey key = dkp.GetDecryptionKey (null, new KeyInfo ()); - AssertNull ("NullAlgorithmUri", key); - } - - [Test] - [Ignore ("Only works if you have the required certificate in your own store")] - public void RSAPkcs1v15 () - { - DecryptionKeyProvider dkp = new DecryptionKeyProvider (); - DecryptionKey key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.RSA15, new KeyInfo ()); - } - - [Test] - public void UnsupportedAlgorithmUri () - { - DecryptionKeyProvider dkp = new DecryptionKeyProvider (); - DecryptionKey key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.AES128, new KeyInfo ()); - AssertNull ("AES128", key); - key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.AES128KeyWrap, new KeyInfo ()); - AssertNull ("AES128KeyWrap", key); - key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.AES192, new KeyInfo ()); - AssertNull ("AES192", key); - key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.AES192KeyWrap, new KeyInfo ()); - AssertNull ("AES192KeyWrap", key); - key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.AES256, new KeyInfo ()); - AssertNull ("AES256", key); - key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.AES256KeyWrap, new KeyInfo ()); - AssertNull ("AES256KeyWrap", key); - key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.DES, new KeyInfo ()); - AssertNull ("DES", key); - key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.RSAOAEP, new KeyInfo ()); - AssertNull ("RSAOAEP", key); - key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.SHA1, new KeyInfo ()); - AssertNull ("SHA1", key); - key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.SHA256, new KeyInfo ()); - AssertNull ("SHA256", key); - key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.SHA512, new KeyInfo ()); - AssertNull ("SHA512", key); - key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.TripleDES, new KeyInfo ()); - AssertNull ("TripleDES", key); - key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.TripleDESKeyWrap, new KeyInfo ()); - AssertNull ("TripleDESKeyWrap", key); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void ConstructorByteArrayNull () - { - DecryptionKeyProvider dkp = new DecryptionKeyProvider (); - DecryptionKey key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.RSA15, null); - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/EncryptedKeyTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/EncryptedKeyTest.cs deleted file mode 100644 index 44fd51bc4a9..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/EncryptedKeyTest.cs +++ /dev/null @@ -1,183 +0,0 @@ -// -// EncryptedKeyTest.cs - NUnit Test Cases for EncryptedKey -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Security; -using System; -using System.Security.Cryptography; -using System.Security.Cryptography.Xml; -using System.Xml; - -namespace MonoTests.MS.Web.Services.Security { - - [TestFixture] - public class EncryptedKeyTest : Assertion { - - public const string key = "4o+Yqa3y34yOy+55ssgAALoxeVOutACyONctHoLCVxsbHBafJcnxxStlObm1B7aZnR5/ge6YTAPrboUTbpkBJfZ5bRb3jBoYl45tWmM0WDAth1MFO3gxUw6PZXxTK85ef2kPZ2jYPX6a0pA5bMWWuyA4y0sg/gv5RG0GrBn1zLk=AQAB

/DPHYnDUBmnKES9gv89w3UUmcSG7HuM6u1ZW7N0uoG2H6toF6M37RPs2DBEIwqNqr96VSyMhgDcvWXDHyiKhoQ==

5fj41n0S3h513mdZF+ZLsg1/qQ1StUgRWGCNPI7/lZfteUOVQJPxKokXLoVRtf1RrsnGyVYIDPQKb+OZ8h2EGQ==HkcpHMxm6A4zUDTb7Ks+5ZGzt8lQ6bhmCK+o5+719hSwSKW8J+Ly06lFJ9Wzs4pi+JJEYizpjLcTXC2KDt5xgQ==QyGxqhMqvdJQgBLVLCfa8ugD2xp7iVW3UoAk2oe3zjhiZyK2X/qPzOXl8XuThbej740RTVai1P0sSss69jVtiQ==GAhDRgTDIbUUCZmwVv2tq4J7Iyktwsgpp3Hpa6PHM06tA1XCcOzeTV6H9m2+JCJjakcc8V4p2jl7kBzt+P3txQ==No4HX8xwMF5jQD4DdgZs4b/0C9gXuGZ2g/NkfPVVoK35QDE+T1YqbqT9cgIC0oGoycm/QGVYrO1AstM+k6IqQSrWL8YjonGceUzZN71/VjBMpHEQOdtGTEX4/mMdFjGqNxxrsRgTAH/Wl3LAmraHgbnQcsdBcIy8RpmWZAveowE=
"; - - public const string xml = "MfB7IuMVrXzv++amAm93Tc0Hbas=1WfgPiTV7bpIOCtyKhmYXeTWvl7rykYoeaAqASh6iHQwhS7M61QHEOHw/wS4iphjBGVXsYcNUIFlpZEAkQalxeqLGMJHKkz5Mhd2Ee4N0DWfHlRz5hR7cnwxMKfo/MfzexPfLRcbDuE5iGrYDAb58XQPN3dHLmhCCK+kQ/4KH+E=A4L9y9NICU8KhOF3ip323wucnpUXbM1De0AOuMaQ2kFRG4wUjw2Wo/u14kQts5uGPNtYWI8/bsBunRr4JVfbMANV+/bPZ3d3v++J+5lrrvvBAaxBu+bCZDwZK45Li/fD"; - - private AsymmetricEncryptionKey GetKey () - { - RSA rsa = RSA.Create (); - rsa.FromXmlString (key); - AsymmetricEncryptionKey aek = new AsymmetricEncryptionKey (rsa); - aek.KeyInfo.AddClause (new RSAKeyValue (rsa)); - return aek; - } - - [Test] - public void ConstructorAsymmetricEncryptionKey () - { - EncryptedKey ek = new EncryptedKey (GetKey ()); - AssertNotNull ("EncryptedKey(AsymmetricEncryptionKey)", ek); - // check default - AssertEquals ("EncryptionMethod", XmlEncryption.AlgorithmURI.RSA15, ek.EncryptionMethod); - AssertEquals ("SessionAlgorithmURI", XmlEncryption.AlgorithmURI.TripleDES, ek.SessionAlgorithmURI); - AssertNotNull ("KeyInfo", ek.KeyInfo); - Assert ("KeyInfo.Count > 0", (ek.KeyInfo.Count > 0)); - AssertNotNull ("ReferenceList", ek.ReferenceList); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void ConstructorAsymmetricEncryptionKeyNull () - { - AsymmetricEncryptionKey aek = null; - EncryptedKey ek = new EncryptedKey (aek); - } - - [Test] - [Ignore("IDecryptionKeyProvider")] - public void ConstructorXmlElement () - { - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - EncryptedKey ek = new EncryptedKey (doc.DocumentElement); - AssertNotNull ("EncryptedKey(XmlElement)", ek); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void ConstructorXmlElementNull () - { - XmlElement xel = null; - EncryptedKey ek = new EncryptedKey (xel); - } - - [Test] - public void SessionAlgorithmURI_AES128 () - { - EncryptedKey ek = new EncryptedKey (GetKey ()); - ek.SessionAlgorithmURI = XmlEncryption.AlgorithmURI.AES128; - AssertEquals ("SessionAlgorithmURI==AES128", XmlEncryption.AlgorithmURI.AES128, ek.SessionAlgorithmURI); - } - - [Test] - public void SessionAlgorithmURI_AES192 () - { - EncryptedKey ek = new EncryptedKey (GetKey ()); - ek.SessionAlgorithmURI = XmlEncryption.AlgorithmURI.AES192; - AssertEquals ("SessionAlgorithmURI==AES192", XmlEncryption.AlgorithmURI.AES192, ek.SessionAlgorithmURI); - } - - [Test] - public void SessionAlgorithmURI_AES256 () - { - EncryptedKey ek = new EncryptedKey (GetKey ()); - ek.SessionAlgorithmURI = XmlEncryption.AlgorithmURI.AES256; - AssertEquals ("SessionAlgorithmURI==AES256", XmlEncryption.AlgorithmURI.AES256, ek.SessionAlgorithmURI); - } - - [Test] - public void SessionAlgorithmURI_TripleDES () - { - EncryptedKey ek = new EncryptedKey (GetKey ()); - ek.SessionAlgorithmURI = XmlEncryption.AlgorithmURI.TripleDES; - AssertEquals ("SessionAlgorithmURI==TripleDES", XmlEncryption.AlgorithmURI.TripleDES, ek.SessionAlgorithmURI); - } - - private void UnsupportedAlgorithm (EncryptedKey ek, string algorithm) - { - try { - ek.SessionAlgorithmURI = algorithm; - Fail ("expected SecurityFault but got none"); - } - catch (Exception e) { - if (!e.ToString ().StartsWith ("Microsoft.Web.Services.Security.SecurityFault")) - Fail ("expected SecurityFault but got " + e.ToString ()); - } - } - - [Test] - public void SessionAlgorithmURI_Unsupported () - { - EncryptedKey ek = new EncryptedKey (GetKey ()); - UnsupportedAlgorithm (ek, XmlEncryption.AlgorithmURI.AES128KeyWrap); - UnsupportedAlgorithm (ek, XmlEncryption.AlgorithmURI.AES192KeyWrap); - UnsupportedAlgorithm (ek, XmlEncryption.AlgorithmURI.AES256KeyWrap); - // strangely DES is defined but unsupported - UnsupportedAlgorithm (ek, XmlEncryption.AlgorithmURI.DES); - UnsupportedAlgorithm (ek, XmlEncryption.AlgorithmURI.RSA15); - UnsupportedAlgorithm (ek, XmlEncryption.AlgorithmURI.RSAOAEP); - UnsupportedAlgorithm (ek, XmlEncryption.AlgorithmURI.SHA1); - UnsupportedAlgorithm (ek, XmlEncryption.AlgorithmURI.SHA256); - UnsupportedAlgorithm (ek, XmlEncryption.AlgorithmURI.SHA512); - UnsupportedAlgorithm (ek, XmlEncryption.AlgorithmURI.TripleDESKeyWrap); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void SessionAlgorithmURI_Null () - { - EncryptedKey ek = new EncryptedKey (GetKey ()); - ek.SessionAlgorithmURI = null; - } - - [Test] - public void GetXml () - { - EncryptedKey ek = new EncryptedKey (GetKey ()); - XmlDocument doc = new XmlDocument (); - XmlElement xel = ek.GetXml (doc); - // output will always be different (new key each time) - AssertNotNull ("GetXml", xel); - // TODO: more - } - - [Test] - [Ignore("IDecryptionKeyProvider")] - public void GetLoadXmlRoundtrip () - { - EncryptedKey ek = new EncryptedKey (GetKey ()); - XmlDocument doc = new XmlDocument (); - XmlElement xel = ek.GetXml (doc); - // output will always be different (new key each time) - AssertNotNull ("GetXml", xel); - ek.LoadXml (xel); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void GetXmlNull () - { - EncryptedKey ek = new EncryptedKey (GetKey ()); - ek.GetXml (null); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void LoadXmlNull () - { - XmlElement xel = null; - EncryptedKey ek = new EncryptedKey (xel); - ek.LoadXml (null); - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/KeyIdentifierTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/KeyIdentifierTest.cs deleted file mode 100644 index fd085d8c10f..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/KeyIdentifierTest.cs +++ /dev/null @@ -1,201 +0,0 @@ -// -// KeyIdentifierTest.cs - NUnit Test Cases for KeyIdentifier -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Security; -using System; -using System.Xml; - -namespace MonoTests.MS.Web.Services.Security { - - [TestFixture] - public class KeyIdentifierTest : Assertion { - - private static byte[] array = { 0x00 }; - private const string ValueXml = "AA=="; - private const string ValueTypeXml = "AA=="; - private const string WellKnownValueTypeXml = "AA=="; - private const string BadCustomValueTypeXml = "AA=="; - - [Test] - public void ConstructorByteArray () - { - KeyIdentifier ki = new KeyIdentifier (array); - Assert ("Value", (ki.Value [0] == array [0])); - AssertNull ("ValueType", ki.ValueType); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void ConstructorByteArrayNull () - { - byte[] array = null; // resolve ambiguity - KeyIdentifier ki = new KeyIdentifier (array); - } - - private XmlQualifiedName GetQName () - { - return new XmlQualifiedName ("mono", "http://www.go-mono.com/"); - } - - [Test] - public void ConstructorXmlQualifiedName () - { - KeyIdentifier ki = new KeyIdentifier (array, GetQName ()); - Assert ("Value", (ki.Value [0] == array [0])); - AssertNotNull ("ValueType", ki.ValueType); - Assert ("ValueType.IsEmpty", !ki.ValueType.IsEmpty); - AssertEquals ("ValueType.Name", "mono", ki.ValueType.Name); - AssertEquals ("ValueType.Namespace", "http://www.go-mono.com/", ki.ValueType.Namespace); - } - - [Test] - public void ConstructorXmlQualifiedNameNull () - { - KeyIdentifier ki = new KeyIdentifier (array, null); - Assert ("Value", (ki.Value [0] == array [0])); - AssertNull ("ValueType", ki.ValueType); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void ConstructorXmlElementNull () - { - XmlElement xel = null; // resolve ambiguity - KeyIdentifier ki = new KeyIdentifier (xel); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void ValueNull () - { - KeyIdentifier ki = new KeyIdentifier (array); - ki.Value = null; - } - - [Test] - public void ValueTypeNull () - { - KeyIdentifier ki = new KeyIdentifier (array); - ki.ValueType = null; - } - - [Test] - public void GetXml_ValueOnly () - { - KeyIdentifier ki = new KeyIdentifier (array); - XmlDocument doc = new XmlDocument (); - XmlElement xel = ki.GetXml (doc); - AssertEquals ("GetXml_ValueOnly", ValueXml, xel.OuterXml); - } - - [Test] - public void GetXml_ValueAndValueType () - { - KeyIdentifier ki = new KeyIdentifier (array, GetQName ()); - XmlDocument doc = new XmlDocument (); - XmlElement xel = ki.GetXml (doc); - AssertEquals ("GetXml_ValueAndValueType", ValueTypeXml, xel.OuterXml); - } - - [Test] - public void GetXml_WellKnownValueType () - { - KeyIdentifier ki = new KeyIdentifier (array, new XmlQualifiedName ("well-known", WSSecurity.NamespaceURI)); - XmlDocument doc = new XmlDocument (); - XmlElement xel = ki.GetXml (doc); - AssertEquals ("GetXml_ValueAndValueType", WellKnownValueTypeXml, xel.OuterXml); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void GetXmlNull () - { - KeyIdentifier ki = new KeyIdentifier (array); - ki.GetXml (null); - } - - [Test] - public void LoadXml_Value () - { - KeyIdentifier ki = new KeyIdentifier (array); - XmlDocument doc = new XmlDocument (); - doc.LoadXml (ValueXml); - ki.LoadXml (doc.DocumentElement); - // roundtrip - XmlElement xel = ki.GetXml (doc); - AssertEquals ("LoadXml_Value", ValueXml, xel.OuterXml); - } - - [Test] - public void LoadXml_ValueType () - { - KeyIdentifier ki = new KeyIdentifier (array); - XmlDocument doc = new XmlDocument (); - doc.LoadXml (ValueTypeXml); - ki.LoadXml (doc.DocumentElement); - // roundtrip - XmlElement xel = ki.GetXml (doc); - AssertEquals ("LoadXml_ValueType", ValueTypeXml, xel.OuterXml); - } - - [Test] - public void LoadXml_WellKnownValueType () - { - KeyIdentifier ki = new KeyIdentifier (array); - XmlDocument doc = new XmlDocument (); - doc.LoadXml (WellKnownValueTypeXml); - ki.LoadXml (doc.DocumentElement); - // roundtrip - XmlElement xel = ki.GetXml (doc); - AssertEquals ("LoadXml_ValueType", WellKnownValueTypeXml, xel.OuterXml); - } - - [Test] - [ExpectedException (typeof (SecurityFormatException))] - public void LoadXml_BadCustomValueType () - { - KeyIdentifier ki = new KeyIdentifier (array); - XmlDocument doc = new XmlDocument (); - doc.LoadXml (BadCustomValueTypeXml); - ki.LoadXml (doc.DocumentElement); - // roundtrip - XmlElement xel = ki.GetXml (doc); - AssertEquals ("LoadXml_ValueType", BadCustomValueTypeXml, xel.OuterXml); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void LoadXml_BadLocalName () - { - KeyIdentifier ki = new KeyIdentifier (array); - XmlDocument doc = new XmlDocument (); - doc.LoadXml ("AA=="); - ki.LoadXml (doc.DocumentElement); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void LoadXml_BadNamespace () - { - KeyIdentifier ki = new KeyIdentifier (array); - XmlDocument doc = new XmlDocument (); - doc.LoadXml ("AA=="); - ki.LoadXml (doc.DocumentElement); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void LoadXmlNull () - { - KeyIdentifier ki = new KeyIdentifier (array); - ki.LoadXml (null); - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/NonceTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/NonceTest.cs deleted file mode 100644 index 653574da1b3..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/NonceTest.cs +++ /dev/null @@ -1,138 +0,0 @@ -// -// NonceTest.cs - NUnit Test Cases for Nonce -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Security; -using System; -using System.Xml; - -namespace MonoTests.MS.Web.Services.Security { - - [TestFixture] - public class NonceTest : Assertion { - - private const string Sample = "GWSRuy1IC4zb2jsA+Sz/rw=="; - private const string Zero = ""; - - - // NOTE: Nonce doesn't have a public constructor in WSE1 (*) so tests can only be runned with WSE2 - // (*) this is bad because we can't reuse Nonce inside other security protocols -#if !WSE1 - [Test] - public void ConstructorInt () - { - Nonce n = new Nonce (16); - } - - [Test] - public void ConstructorIntZero () - { - Nonce n = new Nonce (0); - AssertEquals ("Nonce(0).Value", String.Empty, n.Value); - AssertNotNull ("Nonce(0).GetValueBytes()", n.GetValueBytes ()); - XmlDocument doc = new XmlDocument (); - XmlElement xel = n.GetXml (doc); - AssertEquals ("Nonce(0).GetXml", Zero, xel.OuterXml); - } - - [Test] - [ExpectedException (typeof (OverflowException))] - public void ConstructorNegativeInt () - { - Nonce n = new Nonce (-1); - } - - [Test] - public void ConstructorXmlElement () - { - XmlDocument doc = new XmlDocument (); - doc.LoadXml (Sample); - Nonce n = new Nonce (doc.DocumentElement); - // roundtrip - XmlElement xel = n.GetXml (doc); - AssertEquals ("ConstructorXmlElement", Sample, xel.OuterXml); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void ConstructorXmlElementNull () - { - Nonce n = new Nonce (null); - } - - [Test] - public void Value () - { - Nonce n = new Nonce (16); - AssertNotNull ("Value", n.Value); - byte[] v = n.GetValueBytes (); - AssertNotNull ("GetValueBytes", v); - AssertEquals ("Value==base64(GetValueBytes)", n.Value, Convert.ToBase64String (v)); - } - - [Test] - public void GetXml () - { - Nonce n = new Nonce (16); - XmlDocument doc = new XmlDocument (); - XmlElement xel = n.GetXml (doc); - Assert ("GetXml.StartsWith", xel.OuterXml.StartsWith ("")); - Assert ("GetXml.EndsWith", xel.OuterXml.EndsWith ("==")); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void GetXmlNull () - { - Nonce n = new Nonce (16); - n.GetXml (null); - } - - [Test] - public void LoadXml () - { - Nonce n = new Nonce (16); - XmlDocument doc = new XmlDocument (); - doc.LoadXml (Sample); - n.LoadXml (doc.DocumentElement); - // roundtrip - XmlElement xel = n.GetXml (doc); - AssertEquals ("LoadXml", Sample, xel.OuterXml); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void LoadXml_BadLocalName () - { - Nonce n = new Nonce (16); - XmlDocument doc = new XmlDocument (); - doc.LoadXml (""); - n.LoadXml (doc.DocumentElement); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void LoadXml_BadNamespace () - { - Nonce n = new Nonce (16); - XmlDocument doc = new XmlDocument (); - doc.LoadXml (""); - n.LoadXml (doc.DocumentElement); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void LoadXmlNull () - { - Nonce n = new Nonce (16); - n.LoadXml (null); - } -#endif - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/OASISTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/OASISTest.cs deleted file mode 100644 index 1f9e51011e8..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/OASISTest.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -// OASISTest.cs - NUnit Test Cases for OASIS -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Security; -using System; - -namespace MonoTests.MS.Web.Services.Security { - - [TestFixture] - public class OASISTest : Assertion { - - [Test] - public void Constructor () - { - OASIS o = new OASIS ("mono"); - AssertNotNull ("Constructor", o); - AssertEquals ("OASIS(mono).PrefixValue", "wsse", o.PrefixValue); - AssertEquals ("OASIS(mono).NamespaceURIValue", "mono", o.NamespaceURIValue); - } - - [Test] - public void ConstructorNull () - { - OASIS o = new OASIS (null); - AssertNotNull ("Constructor", o); - AssertEquals ("OASIS(null).PrefixValue", "wsse", o.PrefixValue); - AssertNull ("OASIS(null).NamespaceURIValue", o.NamespaceURIValue); - } - - [Test] - public void PublicConstStrings () - { - AssertEquals ("Prefix", "wsse", OASIS.Prefix); - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/ReferenceListTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/ReferenceListTest.cs deleted file mode 100644 index ece973daf83..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/ReferenceListTest.cs +++ /dev/null @@ -1,217 +0,0 @@ -// -// ReferenceListTest.cs - NUnit Test Cases for ReferenceList -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Security; -using System; -using System.Collections; -using System.Xml; - -namespace MonoTests.MS.Web.Services.Security { - - [TestFixture] - public class ReferenceListTest : Assertion { - - private const string Empty = ""; - private const string One = ""; - private const string NotLocalUri = ""; - private const string NotDataReference = ""; - - [Test] - public void Constructor () - { - ReferenceList rl = new ReferenceList (); - AssertNotNull ("Constructor()", rl); - } - - [Test] - public void ConstructorXmlElement () - { - XmlDocument doc = new XmlDocument (); - doc.LoadXml (Empty); - ReferenceList rl = new ReferenceList (doc.DocumentElement); - AssertNotNull ("Constructor(XmlElement)", rl); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void ConstructorXmlElementNull () - { - ReferenceList rl = new ReferenceList (null); - } - - [Test] - public void Add () - { - ReferenceList rl = new ReferenceList (); - rl.Add ("mono"); - Assert ("Add/Contains(mono)", rl.Contains ("mono")); - Assert ("Add/Contains(#mono)", rl.Contains ("#mono")); - } - - [Test] - public void AddSharp () - { - ReferenceList rl = new ReferenceList (); - rl.Add ("#mono"); - Assert ("Add/Contains(mono)", rl.Contains ("mono")); - Assert ("Add/Contains(#mono)", rl.Contains ("#mono")); - Assert ("Add/Contains(##mono)", !rl.Contains ("##mono")); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void AddNull () - { - ReferenceList rl = new ReferenceList (); - rl.Add (null); - } - - [Test] - public void Contains () - { - ReferenceList rl = new ReferenceList (); - rl.Add ("mono"); - Assert ("Contains(mono)", rl.Contains ("mono")); - Assert ("Contains(#mono)", rl.Contains ("#mono")); - Assert ("!Contains(nomo)", !rl.Contains ("nomo")); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void ContainsNull () - { - ReferenceList rl = new ReferenceList (); - Assert ("Contains", rl.Contains (null)); - } - - [Test] - public void GetEnumetator () - { - ReferenceList rl = new ReferenceList (); - IEnumerator e = rl.GetEnumerator (); - AssertNotNull ("GetEnumerator", e); - } - - [Test] - public void ListWithEnumerator () - { - ReferenceList rl = new ReferenceList (); - for (int i=0; i < 16; i++) { - rl.Add ("mono" + i.ToString ()); - } - int n = 0; - foreach (string s in rl) { - Assert (s.StartsWith ("mono")); - n++; - } - AssertEquals ("Count", 16, n); - } - - [Test] - public void GetXml_Empty () - { - ReferenceList rl = new ReferenceList (); - XmlDocument doc = new XmlDocument (); - XmlElement xel = rl.GetXml (doc); - AssertEquals ("GetXml_Empty", Empty, xel.OuterXml); - } - - [Test] - public void GetXml_One () - { - ReferenceList rl = new ReferenceList (); - rl.Add ("mono"); - XmlDocument doc = new XmlDocument (); - XmlElement xel = rl.GetXml (doc); - AssertEquals ("GetXml_One", One, xel.OuterXml); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void GetXmlNull () - { - ReferenceList rl = new ReferenceList (); - rl.GetXml (null); - } - - [Test] - public void LoadXml_Empty () - { - ReferenceList rl = new ReferenceList (); - XmlDocument doc = new XmlDocument (); - doc.LoadXml (Empty); - rl.LoadXml (doc.DocumentElement); - Assert ("LoadXml_Empty-Contains(mono)", !rl.Contains ("mono")); - Assert ("LoadXml_Empty-Contains(#mono)", !rl.Contains ("#mono")); - } - - [Test] - public void LoadXml_One () - { - ReferenceList rl = new ReferenceList (); - XmlDocument doc = new XmlDocument (); - doc.LoadXml (One); - rl.LoadXml (doc.DocumentElement); - Assert ("LoadXml_One", rl.Contains ("mono")); - Assert ("LoadXml_One-Contains(mono)", rl.Contains ("mono")); - Assert ("LoadXml_One-Contains(#mono)", rl.Contains ("#mono")); - } - - [Test] - public void LoadXml_NotLocalUri () - { - ReferenceList rl = new ReferenceList (); - XmlDocument doc = new XmlDocument (); - doc.LoadXml (NotLocalUri); // mono, not #mono - rl.LoadXml (doc.DocumentElement); - Assert ("LoadXml_NotLocalUri-Contains(mono)", rl.Contains ("mono")); - Assert ("LoadXml_NotLocalUri-Contains(#mono)", rl.Contains ("#mono")); - } - - [Test] - public void LoadXml_NotDataReference () - { - ReferenceList rl = new ReferenceList (); - XmlDocument doc = new XmlDocument (); - doc.LoadXml (NotDataReference); - rl.LoadXml (doc.DocumentElement); - Assert ("LoadXml_NotDataReference(mono)", !rl.Contains ("mono")); - Assert ("LoadXml_NotDataReference(#mono)", !rl.Contains ("#mono")); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void LoadXml_BadLocalName () - { - ReferenceList rl = new ReferenceList (); - XmlDocument doc = new XmlDocument (); - doc.LoadXml (""); - rl.LoadXml (doc.DocumentElement); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void LoadXml_BadNamespace () - { - ReferenceList rl = new ReferenceList (); - XmlDocument doc = new XmlDocument (); - doc.LoadXml (""); - rl.LoadXml (doc.DocumentElement); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void LoadXmlNull () - { - ReferenceList rl = new ReferenceList (); - rl.LoadXml (null); - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/SMSecurityTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/SMSecurityTest.cs deleted file mode 100644 index d080099b808..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/SMSecurityTest.cs +++ /dev/null @@ -1,35 +0,0 @@ -// -// SMSecurityTest.cs - NUnit Test Cases for SMSecurity -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Security; -using System; - -namespace MonoTests.MS.Web.Services.Security { - - [TestFixture] - public class SMSecurityTest : Assertion { - - [Test] - public void Constructor () - { - SMSecurity o = new SMSecurity (); - AssertNotNull ("Constructor", o); - AssertEquals ("PrefixValue", "wsse", o.PrefixValue); - AssertEquals ("NamespaceURIValue", "http://schemas.xmlsoap.org/ws/2002/12/secext", o.NamespaceURIValue); - } - - [Test] - public void PublicConstStrings () - { - AssertEquals ("Prefix", "wsse", SMSecurity.Prefix); - AssertEquals ("NamespaceURI", "http://schemas.xmlsoap.org/ws/2002/12/secext", SMSecurity.NamespaceURI); - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/SaMLTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/SaMLTest.cs deleted file mode 100644 index 6abc1670826..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/SaMLTest.cs +++ /dev/null @@ -1,49 +0,0 @@ -// -// SaMLTest.cs - NUnit Test Cases for SaML -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Security; -using System; - -namespace MonoTests.MS.Web.Services.Security { - - [TestFixture] - public class SaMLTest : Assertion { - - [Test] - public void Constructor () - { - SaML s = new SaML (); - AssertNotNull ("Constructor", s); - } - - [Test] - public void PublicConstStrings () - { - AssertEquals ("NamespaceURI", "urn:oasis:names:tc:SAML:1.0:assertion", SaML.NamespaceURI); - AssertEquals ("Prefix", "saml", SaML.Prefix); - } - - [Test] - public void ElementNamesConstructor () - { - // test constructor - SaML.ElementNames sen = new SaML.ElementNames (); - AssertNotNull ("ElementNames Constructor", sen); - } - - [Test] - public void ElementNames () - { - // test public const strings - AssertEquals ("Assertion", "Assertion", SaML.ElementNames.Assertion); - AssertEquals ("AssertionIDReference", "AssertionIDReference", SaML.ElementNames.AssertionIDReference); - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/SecurityTokenReferenceTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/SecurityTokenReferenceTest.cs deleted file mode 100644 index 44b447854a9..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/SecurityTokenReferenceTest.cs +++ /dev/null @@ -1,213 +0,0 @@ -// -// SecurityTokenReferenceTest.cs - NUnit Test Cases for SecurityTokenReference -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Security; -using System; -using System.Xml; - -namespace MonoTests.MS.Web.Services.Security { - - [TestFixture] - public class SecurityTokenReferenceTest : Assertion { - - private const string Empty = ""; - private const string ReferenceMono = ""; - private const string KeyId = "AA=="; - private const string Full = "AA=="; - private const string BadReferenceURI = ""; - - [Test] - public void ConstructorEmpty () - { - SecurityTokenReference str = new SecurityTokenReference (); - AssertNull ("SecurityTokenReference ().KeyIdentifier", str.KeyIdentifier); - AssertNull ("SecurityTokenReference ().Reference", str.Reference); - } - - - [Test] - public void ConstructorXmlElement () - { - XmlDocument doc = new XmlDocument (); - doc.LoadXml (Empty); - SecurityTokenReference str = new SecurityTokenReference (doc.DocumentElement); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void ConstructorXmlElementNull () - { - XmlElement xel = null; // resolve ambiguity - SecurityTokenReference str = new SecurityTokenReference (xel); - } - - [Test] - public void Reference () - { - SecurityTokenReference str = new SecurityTokenReference (); - str.Reference = null; - AssertNull ("Reference=null", str.Reference); - str.Reference = "mono"; - AssertEquals ("Reference=mono", "mono", str.Reference); - str.Reference = "#mono"; - AssertEquals ("Reference=#mono", "#mono", str.Reference); - str.Reference = null; - AssertNull ("Reference=null(2)", str.Reference); - } - - [Test] - public void KeyIdentifier () - { - SecurityTokenReference str = new SecurityTokenReference (); - str.KeyIdentifier = null; - AssertNull ("KeyIdentifier=null", str.KeyIdentifier); - str.KeyIdentifier = new KeyIdentifier (new byte [1] { 0x00 }); - AssertNotNull ("KeyIdentifier=null", str.KeyIdentifier); - str.KeyIdentifier = null; - AssertNull ("KeyIdentifier=null(2)", str.KeyIdentifier); - } - - [Test] - public void GetXmlEmpty () - { - SecurityTokenReference str = new SecurityTokenReference (); - XmlDocument doc = new XmlDocument (); - XmlElement xel = str.GetXml (doc); - XmlElement xele = str.GetXml (); - AssertEquals ("GetXml()==GetXml(XmlDocument)", xel.OuterXml, xele.OuterXml); - AssertEquals ("GetXml().OuterXml", Empty, xele.OuterXml); - } - - [Test] - public void GetXml_Empty () - { - SecurityTokenReference str = new SecurityTokenReference (); - XmlDocument doc = new XmlDocument (); - XmlElement xel = str.GetXml (doc); - AssertEquals ("GetXml", Empty, xel.OuterXml); - } - - [Test] - public void GetXml_Reference () { - SecurityTokenReference str = new SecurityTokenReference (); - str.Reference = "mono"; - XmlDocument doc = new XmlDocument (); - XmlElement xel = str.GetXml (doc); - AssertEquals ("GetXml", ReferenceMono, xel.OuterXml); - } - - [Test] - public void GetXml_KeyId () - { - SecurityTokenReference str = new SecurityTokenReference (); - str.KeyIdentifier = new KeyIdentifier (new byte [1] { 0x00 }); - XmlDocument doc = new XmlDocument (); - XmlElement xel = str.GetXml (doc); - AssertEquals ("GetXml", KeyId, xel.OuterXml); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void GetXmlNull () - { - SecurityTokenReference str = new SecurityTokenReference (); - str.GetXml (null); - } - - [Test] - public void LoadXml_Empty () - { - SecurityTokenReference str = new SecurityTokenReference (); - XmlDocument doc = new XmlDocument (); - doc.LoadXml (Empty); - str.LoadXml (doc.DocumentElement); - // roundtrip - XmlElement xel = str.GetXml (doc); - AssertEquals ("LoadXml", Empty, xel.OuterXml); - } - - [Test] - public void LoadXml_Reference () - { - SecurityTokenReference str = new SecurityTokenReference (); - XmlDocument doc = new XmlDocument (); - doc.LoadXml (ReferenceMono); - str.LoadXml (doc.DocumentElement); - // roundtrip - XmlElement xel = str.GetXml (doc); - AssertEquals ("LoadXml", ReferenceMono, xel.OuterXml); - } - - [Test] - public void LoadXml_KeyId () - { - SecurityTokenReference str = new SecurityTokenReference (); - XmlDocument doc = new XmlDocument (); - doc.LoadXml (KeyId); - str.LoadXml (doc.DocumentElement); - // roundtrip - XmlElement xel = str.GetXml (doc); - AssertEquals ("LoadXml", KeyId, xel.OuterXml); - } - - [Test] - public void LoadXml_Full () - { - SecurityTokenReference str = new SecurityTokenReference (); - XmlDocument doc = new XmlDocument (); - doc.LoadXml (Full); - str.LoadXml (doc.DocumentElement); - // roundtrip - XmlElement xel = str.GetXml (doc); - AssertEquals ("LoadXml", Full, xel.OuterXml); - } - - [Test] - public void LoadXml_BadReferenceURI () - { - SecurityTokenReference str = new SecurityTokenReference (); - XmlDocument doc = new XmlDocument (); - doc.LoadXml (BadReferenceURI); - str.LoadXml (doc.DocumentElement); - // roundtrip - XmlElement xel = str.GetXml (doc); - // can't duplicate this bad behaviour - Assert ("LoadXml", BadReferenceURI != xel.OuterXml); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void LoadXml_BadLocalName () - { - SecurityTokenReference str = new SecurityTokenReference (); - XmlDocument doc = new XmlDocument (); - doc.LoadXml (""); - str.LoadXml (doc.DocumentElement); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void LoadXml_BadNamespace () - { - SecurityTokenReference str = new SecurityTokenReference (); - XmlDocument doc = new XmlDocument (); - doc.LoadXml (""); - str.LoadXml (doc.DocumentElement); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void LoadXmlNull () - { - SecurityTokenReference str = new SecurityTokenReference (); - str.LoadXml (null); - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/SignatureKeyTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/SignatureKeyTest.cs deleted file mode 100644 index 22a1d38f0d9..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/SignatureKeyTest.cs +++ /dev/null @@ -1,87 +0,0 @@ -// -// SignatureKeyTest.cs - NUnit Test Cases for SignatureKey -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Security; -using System; -using System.Security.Cryptography; -using System.Web.Services.Protocols; - -namespace MonoTests.MS.Web.Services.Security { - - [TestFixture] - public class SignatureKeyTest : Assertion { - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void ConstructorAsymmetricNull () - { - AsymmetricAlgorithm key = null; // resolve ambiguity - SignatureKey aek = new SignatureKey (key); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void ConstructorSymmetricNull () - { - SymmetricAlgorithm key = null; // resolve ambiguity - SignatureKey aek = new SignatureKey (key); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void ComputeSignatureNull () - { - DSA dsa = DSA.Create (); - dsa.ImportParameters (AllTests.GetDSAKey (true)); - SignatureKey sk = new SignatureKey (dsa); - sk.ComputeSignature (null); - } - - [Test] - public void ComputeSignatureDSA () - { - DSA dsa = DSA.Create (); - dsa.ImportParameters (AllTests.GetDSAKey (true)); - SignatureKey sk = new SignatureKey (dsa); - - SignedXml signedXml = new SignedXml (); - Reference r = new Reference ("http://www.go-mono.com/"); - signedXml.AddReference (r); - sk.ComputeSignature (signedXml); - } - - [Test] - public void ComputeSignatureRSA () - { - RSA rsa = RSA.Create (); - rsa.ImportParameters (AllTests.GetRSAKey (true)); - SignatureKey sk = new SignatureKey (rsa); - - SignedXml signedXml = new SignedXml (); - Reference r = new Reference ("http://www.go-mono.com/"); - signedXml.AddReference (r); - sk.ComputeSignature (signedXml); - } - - [Test] - public void ComputeSignatureSymmetricAlgo () - { - // default (should be Rjindael) - SymmetricAlgorithm sa = SymmetricAlgorithm.Create (); - sa.Key = new byte [16]; // 128 bits (all zeros) - SignatureKey sk = new SignatureKey (sa); - - SignedXml signedXml = new SignedXml (); - Reference r = new Reference ("http://www.go-mono.com/"); - signedXml.AddReference (r); - sk.ComputeSignature (signedXml); - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/SignatureTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/SignatureTest.cs deleted file mode 100644 index c038c7c6449..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/SignatureTest.cs +++ /dev/null @@ -1,122 +0,0 @@ -// -// SignatureTest.cs - NUnit Test Cases for Signature -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Security; -using MWSS = Microsoft.Web.Services.Security; -using Microsoft.Web.Services.Security.X509; -using System; -using System.Xml; - -namespace MonoTests.MS.Web.Services.Security { - - [TestFixture] - public class SignatureTest : Assertion { - - static private byte[] nonDSigCertificate = { 0x30,0x82,0x06,0x2F,0x30,0x82,0x05,0x17,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x6A,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,0x20,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x11,0x30,0x0F,0x06,0x03,0x55,0x04,0x0A,0x13,0x08,0x53,0x45,0x54,0x20,0x52,0x6F,0x6F,0x74,0x30,0x1E,0x17,0x0D,0x39,0x37,0x30,0x37,0x31,0x35,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x30,0x34,0x30,0x37,0x31,0x35,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x30,0x20,0x31,0x0B, - 0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x11,0x30,0x0F,0x06,0x03,0x55,0x04,0x0A,0x13,0x08,0x53,0x45,0x54,0x20,0x52,0x6F,0x6F,0x74,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xD4,0xDC,0x3E,0xBA,0xE1,0x94,0xF7,0xBE,0xCD,0xED,0x21,0x77,0xCF,0xDA,0x88,0x58,0x51,0x0E,0x8F,0xF4,0xDA,0x00,0x14,0x1E,0x0D,0xA7,0xAD,0xB6,0x96,0x5A,0xC6,0xD3,0xEC,0x25,0xED,0xD8,0x43, - 0x0B,0x6E,0x7F,0x3F,0x9E,0x1E,0x74,0xA0,0x1E,0x97,0x76,0x30,0xCA,0x6F,0x0A,0x63,0xC0,0xA3,0x31,0x40,0x25,0x80,0xB8,0xBD,0x28,0xEB,0x7D,0x75,0x0B,0x4E,0x41,0x34,0xC4,0x20,0x00,0xC2,0xCB,0xF4,0x9A,0x20,0x00,0x58,0xD9,0xF4,0x40,0x13,0x18,0x77,0x0C,0xB5,0x04,0xDE,0xB7,0xB6,0x43,0x8B,0xA4,0xCC,0x36,0x76,0x79,0xC5,0x0B,0x17,0xCB,0x7E,0x88,0xA1,0x33,0xB0,0xD3,0x34,0x27,0xBF,0x3B,0x61,0xDA,0xC5,0x20,0xEB,0xF9,0x94,0x9A,0x8B,0x79,0xB2,0xA8,0x8E,0xCB,0xC1,0xD9,0x94,0x4A,0x99,0x66,0x50,0x55,0xB2,0x83,0x28, - 0x7D,0x22,0x3D,0xEC,0xDC,0xA3,0xE8,0x39,0xDB,0x83,0x54,0xC9,0x89,0xA9,0xDF,0x59,0x52,0x9F,0x7A,0xEF,0x7C,0x11,0x62,0x52,0xEC,0xE6,0x67,0xBA,0x3D,0xEA,0xAB,0x47,0xDB,0xE4,0xF4,0x1F,0x73,0xC3,0x3D,0xEC,0x7E,0x84,0x7D,0x2F,0x29,0xFE,0x6C,0x17,0x3F,0x75,0x6D,0x56,0x6E,0xC0,0x4E,0xB5,0xBF,0x2A,0x20,0x8A,0xE4,0x57,0xAE,0xC0,0x2E,0x68,0xC9,0x09,0xCF,0x85,0x77,0x0A,0xEF,0x3A,0x37,0xCB,0x60,0x4C,0x45,0x73,0x7F,0x90,0x3E,0x86,0x1D,0xFA,0xC3,0xFC,0x50,0x8A,0xB2,0xC5,0x8A,0x34,0xF0,0xF2,0x43,0xEE,0x3C,0x56, - 0xBA,0x24,0xE9,0xE0,0xA5,0x87,0x1E,0x7C,0x30,0x33,0x77,0xFD,0x5D,0xE0,0x57,0x0D,0x6C,0x19,0x39,0x02,0x03,0x01,0x00,0x01,0xA3,0x82,0x03,0x72,0x30,0x82,0x03,0x6E,0x30,0x12,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x08,0x30,0x06,0x01,0x01,0xFF,0x02,0x01,0x03,0x30,0x82,0x02,0xC9,0x06,0x03,0x55,0x1D,0x20,0x01,0x01,0xFF,0x04,0x82,0x02,0xBD,0x30,0x82,0x02,0xB9,0x30,0x82,0x02,0xB5,0x06,0x04,0x67,0x2A,0x05,0x00,0x30,0x82,0x02,0xAB,0x30,0x82,0x02,0xA7,0x06,0x04,0x67,0x2A,0x07,0x06,0x30,0x82,0x02,0x9D, - 0x30,0x82,0x02,0x99,0x1A,0x82,0x02,0x95,0x54,0x68,0x69,0x73,0x20,0x53,0x45,0x54,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x61,0x6E,0x64,0x20,0x61,0x6E,0x79,0x20,0x63,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x61,0x75,0x74,0x68,0x65,0x6E,0x74,0x69,0x63,0x61,0x74,0x65,0x64,0x20,0x64,0x69,0x72,0x65,0x63,0x74,0x6C,0x79,0x20,0x6F,0x72,0x20,0x69,0x6E,0x64,0x69,0x72,0x65,0x63,0x74,0x6C,0x79,0x20,0x62,0x79,0x20,0x74,0x68,0x69,0x73,0x20,0x63, - 0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x2C,0x20,0x6D,0x61,0x79,0x20,0x6F,0x6E,0x6C,0x79,0x20,0x62,0x65,0x20,0x75,0x73,0x65,0x64,0x20,0x74,0x6F,0x20,0x65,0x6E,0x61,0x62,0x6C,0x65,0x20,0x22,0x53,0x65,0x63,0x75,0x72,0x65,0x20,0x46,0x69,0x6E,0x61,0x6E,0x63,0x69,0x61,0x6C,0x20,0x54,0x72,0x61,0x6E,0x73,0x61,0x63,0x74,0x69,0x6F,0x6E,0x73,0x22,0x20,0x61,0x73,0x20,0x64,0x65,0x66,0x69,0x6E,0x65,0x64,0x20,0x69,0x6E,0x20,0x74,0x68,0x65,0x20,0x53,0x45,0x54,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x65, - 0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x50,0x72,0x61,0x63,0x74,0x69,0x63,0x65,0x20,0x53,0x74,0x61,0x74,0x65,0x6D,0x65,0x6E,0x74,0x20,0x61,0x6E,0x64,0x2C,0x20,0x77,0x68,0x65,0x6E,0x20,0x61,0x70,0x70,0x72,0x6F,0x70,0x72,0x69,0x61,0x74,0x65,0x2C,0x20,0x69,0x6E,0x20,0x61,0x20,0x53,0x45,0x54,0x20,0x42,0x72,0x61,0x6E,0x64,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x50,0x72,0x61,0x63,0x74,0x69,0x63,0x65,0x20,0x53,0x74,0x61,0x74,0x65,0x6D,0x65,0x6E,0x74,0x2E,0x20,0x20, - 0x4E,0x6F,0x20,0x50,0x61,0x72,0x74,0x79,0x20,0x6D,0x61,0x79,0x20,0x72,0x65,0x6C,0x79,0x20,0x75,0x70,0x6F,0x6E,0x20,0x74,0x68,0x65,0x20,0x53,0x45,0x54,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x66,0x6F,0x72,0x20,0x61,0x6E,0x79,0x20,0x6F,0x74,0x68,0x65,0x72,0x20,0x70,0x75,0x72,0x70,0x6F,0x73,0x65,0x2E,0x20,0x20,0x41,0x20,0x53,0x45,0x54,0x20,0x42,0x72,0x61,0x6E,0x64,0x20,0x73,0x68,0x61,0x6C,0x6C,0x20,0x62,0x65,0x20,0x61,0x6E,0x79,0x20,0x70,0x61,0x79, - 0x6D,0x65,0x6E,0x74,0x20,0x62,0x72,0x61,0x6E,0x64,0x20,0x77,0x68,0x6F,0x73,0x65,0x20,0x53,0x45,0x54,0x20,0x63,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x69,0x73,0x20,0x73,0x69,0x67,0x6E,0x65,0x64,0x20,0x62,0x79,0x20,0x74,0x68,0x65,0x20,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x20,0x6B,0x65,0x79,0x20,0x63,0x6F,0x72,0x72,0x65,0x73,0x70,0x6F,0x6E,0x64,0x69,0x6E,0x67,0x20,0x74,0x6F,0x20,0x74,0x68,0x65,0x20,0x70,0x75,0x62,0x6C,0x69,0x63,0x20,0x6B,0x65,0x79,0x20,0x63,0x6F,0x6E,0x74,0x61,0x69, - 0x6E,0x65,0x64,0x20,0x69,0x6E,0x20,0x74,0x68,0x69,0x73,0x20,0x63,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x2E,0x20,0x20,0x41,0x6C,0x6C,0x20,0x6D,0x61,0x74,0x74,0x65,0x72,0x73,0x20,0x72,0x65,0x6C,0x61,0x74,0x69,0x6E,0x67,0x20,0x74,0x6F,0x20,0x75,0x73,0x61,0x67,0x65,0x2C,0x20,0x6C,0x69,0x61,0x62,0x69,0x6C,0x69,0x74,0x79,0x20,0x61,0x6E,0x64,0x20,0x70,0x72,0x6F,0x63,0x65,0x64,0x75,0x72,0x65,0x73,0x20,0x77,0x69,0x74,0x68,0x20,0x53,0x45,0x54,0x20,0x63,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61, - 0x74,0x65,0x73,0x20,0x69,0x73,0x73,0x75,0x65,0x64,0x20,0x62,0x65,0x6E,0x65,0x61,0x74,0x68,0x20,0x61,0x20,0x53,0x45,0x54,0x20,0x42,0x72,0x61,0x6E,0x64,0x20,0x73,0x68,0x61,0x6C,0x6C,0x20,0x62,0x65,0x20,0x64,0x65,0x74,0x65,0x72,0x6D,0x69,0x6E,0x65,0x64,0x20,0x62,0x79,0x20,0x74,0x68,0x61,0x74,0x20,0x53,0x45,0x54,0x20,0x42,0x72,0x61,0x6E,0x64,0x2E,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x2B,0x06,0x03,0x55,0x1D,0x10,0x04,0x24,0x30,0x22,0x80,0x0F,0x31,0x39, - 0x39,0x37,0x30,0x37,0x31,0x35,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x81,0x0F,0x31,0x39,0x39,0x38,0x30,0x37,0x31,0x35,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x30,0x10,0x06,0x04,0x67,0x2A,0x07,0x01,0x01,0x01,0xFF,0x04,0x05,0x03,0x03,0x07,0x00,0x80,0x30,0x3C,0x06,0x04,0x67,0x2A,0x07,0x00,0x01,0x01,0xFF,0x04,0x31,0x30,0x2F,0x30,0x2D,0x02,0x01,0x00,0x30,0x09,0x06,0x05,0x2B,0x0E,0x03,0x02,0x1A,0x05,0x00,0x30,0x07,0x06,0x05,0x67,0x2A,0x03,0x00,0x00,0x04,0x14,0xC8,0x57,0x44,0x4F,0xD7,0x91,0x56,0x3E,0xC6,0xF3, - 0xE0,0xE6,0x08,0x2E,0x9A,0xAF,0x61,0x11,0x43,0x5D,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0x91,0x6D,0x0D,0x97,0xB7,0x8D,0x44,0x23,0xB9,0x49,0xAD,0x23,0xA9,0x8B,0xED,0x93,0x33,0x97,0x4C,0xE1,0x6E,0xB1,0x34,0x96,0x18,0xF3,0x58,0xB3,0x9C,0xBF,0x63,0x0F,0x61,0x46,0xC7,0xD1,0x01,0x41,0x0C,0xC8,0x42,0x55,0x6B,0x54,0x71,0x06,0x3B,0xF7,0xD1,0x77,0x65,0xDF,0x16,0xE7,0x63,0x03,0x7B,0x23,0x26,0x28,0xEC,0x94,0xF8,0x9F,0x94,0x04,0x0F,0xE5,0x45,0x99, - 0x4E,0xB5,0x1B,0xBC,0xB9,0xC4,0xB0,0xE2,0x8A,0x3E,0x05,0xA6,0xE3,0x56,0x7D,0x01,0x77,0xAB,0xC2,0xA6,0x72,0x90,0x23,0xD3,0x15,0x8F,0x0F,0xEA,0x7B,0x31,0xDE,0x89,0x31,0xF0,0x1B,0x81,0x6B,0x5F,0xA8,0x13,0xC6,0x62,0x7D,0xFE,0x74,0x14,0x40,0x2A,0x14,0xC2,0xA1,0x1B,0x9C,0xB2,0xD6,0xEF,0x2A,0x6D,0xA5,0xF7,0xA6,0x38,0x8F,0xD4,0x94,0x74,0x30,0x10,0x9E,0xBA,0xA9,0xAB,0x6B,0x61,0x6B,0xFC,0xB2,0x3F,0x87,0x6B,0x19,0x82,0x83,0x70,0xE7,0xD8,0xEA,0x28,0x7B,0xB4,0x29,0x47,0xF4,0x59,0xB3,0x3E,0x4B,0x6A,0x9D,0x54, - 0x0D,0x4E,0x1C,0xD0,0x29,0xB4,0xD1,0xE1,0x19,0x79,0x41,0x73,0xF6,0x57,0x72,0xBE,0x75,0x03,0x94,0xD7,0x58,0xA8,0xC4,0x08,0x71,0xA2,0xE3,0x16,0x31,0xCD,0xC0,0xEE,0x1C,0x21,0x26,0x52,0x55,0x7B,0x00,0x54,0x6D,0xA6,0x44,0xC2,0x4F,0xEA,0x8F,0x04,0x1C,0x3A,0xA2,0xE3,0x5B,0xD7,0x9D,0xE2,0x57,0x30,0x2C,0xF5,0xAE,0x62,0x3B,0xB5,0x49,0x89,0xCB,0x01,0xD1,0x5A,0x38,0xDE,0x97,0x57,0x85,0x91,0x68,0x6B,0xFD,0xEC,0xD3,0x80,0xF0,0x82,0xBF,0x9A }; - - [Test] - public void ConstructorUsernameToken () - { - // UsernameToken supports digital signature - UsernameToken ut = new UsernameToken ("me", "mono"); - Signature s = new Signature (ut); - AssertNotNull ("Signature/UsernameToken", s); - Assert ("Signature/UsernameToken/SecurityToken", s.SecurityToken is UsernameToken); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void ConstructorX509 () - { - // this certificate was choosen because it DOESN'T support Digital Signature - X509Certificate x509 = new X509Certificate (nonDSigCertificate); - Assert ("!X509Certificate.SupportsDigitalSignature", !x509.SupportsDigitalSignature); - X509SecurityToken xst = new X509SecurityToken (x509); - Signature s = new Signature (xst); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void ConstructorNull () - { - Signature s = new Signature (null); - } - - [Test] - public void SignatureOptionsAssign () - { - UsernameToken ut = new UsernameToken ("me", "mono"); - Signature s = new Signature (ut); - s.SignatureOptions = SignatureOptions.IncludeNone; - AssertEquals ("SignatureOptions.IncludeNone", SignatureOptions.IncludeNone, s.SignatureOptions); - s.SignatureOptions = SignatureOptions.IncludePath; - AssertEquals ("SignatureOptions.IncludePath", SignatureOptions.IncludePath, s.SignatureOptions); -#if WSE1 - s.SignatureOptions = SignatureOptions.IncludePathAction; - AssertEquals ("SignatureOptions.IncludePathAction", SignatureOptions.IncludePathAction, s.SignatureOptions); - s.SignatureOptions = SignatureOptions.IncludePathFrom; - AssertEquals ("SignatureOptions.IncludePathFrom", SignatureOptions.IncludePathFrom, s.SignatureOptions); - s.SignatureOptions = SignatureOptions.IncludePathId; - AssertEquals ("SignatureOptions.IncludePathId", SignatureOptions.IncludePathId, s.SignatureOptions); - s.SignatureOptions = SignatureOptions.IncludePathTo; - AssertEquals ("SignatureOptions.IncludePathTo", SignatureOptions.IncludePathTo, s.SignatureOptions); -#endif - s.SignatureOptions = SignatureOptions.IncludeSoapBody; - AssertEquals ("SignatureOptions.IncludeSoapBody", SignatureOptions.IncludeSoapBody, s.SignatureOptions); - s.SignatureOptions = SignatureOptions.IncludeTimestamp; - AssertEquals ("SignatureOptions.IncludeTimestamp", SignatureOptions.IncludeTimestamp, s.SignatureOptions); - s.SignatureOptions = SignatureOptions.IncludeTimestampCreated; - AssertEquals ("SignatureOptions.IncludeTimestampCreated", SignatureOptions.IncludeTimestampCreated, s.SignatureOptions); - s.SignatureOptions = SignatureOptions.IncludeTimestampExpires; - AssertEquals ("SignatureOptions.IncludeTimestampExpires", SignatureOptions.IncludeTimestampExpires, s.SignatureOptions); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void LoadXmlSecurityNull () - { - UsernameToken ut = new UsernameToken ("me", "mono"); - Signature s = new Signature (ut); - XmlDocument doc = new XmlDocument (); - s.LoadXml (null, doc.DocumentElement); - } - - [Test] - //[ExpectedException (typeof (SecurityFault))] SecurityFault is internal - public void LoadXmlXmlElementNull () - { - UsernameToken ut = new UsernameToken ("me", "mono"); - Signature s = new Signature (ut); - MWSS.Security sec = new MWSS.Security ("actor"); - try { - s.LoadXml (sec, null); - } - catch (Exception e) { - if (!e.ToString ().StartsWith ("Microsoft.Web.Services.Security.SecurityFault")) - Fail ("Expected SecurityFault bug got " + e.ToString ()); - } - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/SymmetricDecryptionKeyTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/SymmetricDecryptionKeyTest.cs deleted file mode 100644 index 495cb619ff7..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/SymmetricDecryptionKeyTest.cs +++ /dev/null @@ -1,130 +0,0 @@ -// -// SymmetricDecryptionKeyTest.cs - NUnit Test Cases for SymmetricDecryptionKey -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Security; -using System; -using System.Security.Cryptography; -using System.Web.Services.Protocols; -using System.Xml; - -namespace MonoTests.MS.Web.Services.Security { - - [TestFixture] - public class SymmetricDecryptionKeyTest : Assertion { - - private void UnsupportedAlgorithm (string algo) - { - SymmetricAlgorithm sa = SymmetricAlgorithm.Create (algo); - try { - SymmetricDecryptionKey sdk = new SymmetricDecryptionKey (sa); - Fail (algo + " - Expected SecurityFault but got none"); - } - catch (SoapHeaderException she) { - // this is expected (but not documented) - // SecurityFault isn't public so we catch it's ancestor - // worse you can create SymmetricEncryptionKey with those algorithms - if (she.ToString ().StartsWith ("Microsoft.Web.Services.Security.SecurityFault")) { - // this is expected - } - else - Fail ("Expected SecurityFault but got " + she.ToString ()); - } - catch (Exception e) { - Fail (algo + " - Expected SecurityFault but got " + e.ToString ()); - } - } - - [Test] - public void UnsupportedAlgorithms () - { - UnsupportedAlgorithm ("DES"); - UnsupportedAlgorithm ("RC2"); - } - - private void SupportedAlgorithm (string algo) - { - SymmetricAlgorithm sa = SymmetricAlgorithm.Create (algo); - SymmetricDecryptionKey sdk = new SymmetricDecryptionKey (sa); - } - - [Test] - public void SupportedAlgorithms () - { - SupportedAlgorithm ("Rijndael"); - SupportedAlgorithm ("TripleDES"); - } - - [Test] - public void NullAlgoConstructor () - { - try { - SymmetricDecryptionKey sdk = new SymmetricDecryptionKey (null); - Fail ("Expected SecurityFault but got none"); - } - catch (SoapHeaderException she) { - // this is expected (from WSE) - // should be ArgumentNullException - // SecurityFault isn't public so we catch it's ancestor - // worse you can create SymmetricEncryptionKey with those algorithms - if (she.ToString ().StartsWith ("Microsoft.Web.Services.Security.SecurityFault")) { - // this is expected - } - else - Fail ("Expected SecurityFault but got " + she.ToString ()); - } - catch (Exception e) { - Fail ("Expected SecurityFault but got " + e.ToString ()); - } - } - - [Test] - public void AlgoWithKeyConstructor () - { - SymmetricAlgorithm sa = SymmetricAlgorithm.Create ("TripleDES"); - byte[] key = new byte [32]; - SymmetricDecryptionKey sdk = new SymmetricDecryptionKey (sa, key); - AssertNull ("Name", sdk.Name); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void Constructor_NullValue () - { - SymmetricAlgorithm sa = SymmetricAlgorithm.Create ("TripleDES"); - SymmetricDecryptionKey sdk = null; - sdk = new SymmetricDecryptionKey (sa, null); - } - - [Test] - public void Constructor_NullAlgorithm () - { - SymmetricDecryptionKey sdk = null; - byte[] key = new byte [32]; - try { - sdk = new SymmetricDecryptionKey (null, key); - Fail ("Expected SecurityFault but got none"); - } - catch (SoapHeaderException she) { - // this is expected (from WSE) - // should be ArgumentNullException - // SecurityFault isn't public so we catch it's ancestor - // worse you can create SymmetricEncryptionKey with those algorithms - if (she.ToString ().StartsWith ("Microsoft.Web.Services.Security.SecurityFault")) { - // this is expected - } - else - Fail ("Expected SecurityFault but got " + she.ToString ()); - } - catch (Exception e) { - Fail ("Expected SecurityFault but got " + e.ToString ()); - } - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/SymmetricEncryptionKeyTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/SymmetricEncryptionKeyTest.cs deleted file mode 100644 index f790b1f3c0e..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/SymmetricEncryptionKeyTest.cs +++ /dev/null @@ -1,68 +0,0 @@ -// -// SymmetricEncryptionKeyTest.cs - NUnit Test Cases for SymmetricEncryptionKey -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Security; -using System; -using System.Security.Cryptography; -using System.Xml; - -namespace MonoTests.MS.Web.Services.Security { - - [TestFixture] - public class SymmetricEncryptionKeyTest : Assertion { - - static private string emptyKeyInfo = ""; - - [Test] - public void EmptyConstructor () - { - SymmetricEncryptionKey sek = new SymmetricEncryptionKey (); - AssertEquals ("KeyInfo()", emptyKeyInfo, sek.KeyInfo.GetXml ().OuterXml); - } - - [Test] - public void AlgoConstructor () - { - SymmetricAlgorithm sa = SymmetricAlgorithm.Create ("RC2"); - SymmetricEncryptionKey sek = new SymmetricEncryptionKey (sa); - AssertEquals ("KeyInfo()", emptyKeyInfo, sek.KeyInfo.GetXml ().OuterXml); - } - - [Test] - // should be ArgumentNullException - [ExpectedException (typeof (NullReferenceException))] - public void NullAlgoConstructor () - { - SymmetricEncryptionKey sek = new SymmetricEncryptionKey (null); - } - - [Test] - public void AlgoWithKeyConstructor () - { - SymmetricAlgorithm sa = SymmetricAlgorithm.Create ("RC2"); - byte[] key = new byte [32]; // 256 bits (invalid size for RC2) - SymmetricEncryptionKey sek = new SymmetricEncryptionKey (sa, key); - AssertEquals ("KeyInfo()", emptyKeyInfo, sek.KeyInfo.GetXml ().OuterXml); - } - - [Test] - public void NullAlgoWithKeyConstructor () - { - SymmetricAlgorithm sa = SymmetricAlgorithm.Create ("RC2"); - byte[] key = new byte [32]; // 256 bits (invalid size for RC2) - - SymmetricEncryptionKey sek = new SymmetricEncryptionKey (null, key); - AssertEquals ("KeyInfo()", emptyKeyInfo, sek.KeyInfo.GetXml ().OuterXml); - - sek = new SymmetricEncryptionKey (sa, null); - AssertEquals ("KeyInfo()", emptyKeyInfo, sek.KeyInfo.GetXml ().OuterXml); - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/UsernameTokenTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/UsernameTokenTest.cs deleted file mode 100644 index 079058f980a..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/UsernameTokenTest.cs +++ /dev/null @@ -1,276 +0,0 @@ -// -// UsernameTokenTest.cs - NUnit Test Cases for UsernameToken -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Security; -using System; -using System.Configuration; -using System.Security.Cryptography; -using System.Web.Services.Protocols; -using System.Xml; - -namespace MonoTests.MS.Web.Services.Security { - - [TestFixture] - public class UsernameTokenTest : Assertion { - - [Test] - public void Constructor_UP () - { - UsernameToken token = new UsernameToken ("me", "mine"); - AssertEquals ("Username", "me", token.Username); - AssertEquals ("Password", "mine", token.Password); - AssertEquals ("PasswordOption", PasswordOption.SendNone, token.PasswordOption); - AssertNull ("Nonce", token.Nonce); - } - - [Test] - public void Constructor_UPO () - { - UsernameToken token = new UsernameToken ("me", "mine", PasswordOption.SendNone); - AssertEquals ("SendNone", PasswordOption.SendNone, token.PasswordOption); - AssertNull ("Nonce", token.Nonce); - - token = new UsernameToken ("me", "mine", PasswordOption.SendPlainText); - AssertEquals ("SendPlainText", PasswordOption.SendPlainText, token.PasswordOption); - AssertNull ("Nonce", token.Nonce); - - token = new UsernameToken ("me", "mine", PasswordOption.SendHashed); - AssertEquals ("SendHashed", PasswordOption.SendHashed, token.PasswordOption); - AssertNull ("Nonce", token.Nonce); // strange - must be generated later... - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void Constructor_NullUsername () - { - UsernameToken token = new UsernameToken (null, "mine"); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void Constructor_EmptyUsername () - { - UsernameToken token = new UsernameToken ("", "mine"); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void Constructor_NullPassword () - { - UsernameToken token = new UsernameToken ("me", null); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void Constructor_EmptyPassword () - { - UsernameToken token = new UsernameToken ("me", ""); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void Constructor_NullElement () - { - UsernameToken token = new UsernameToken (null); - } - - [Test] - public void Created () - { - UsernameToken token = new UsernameToken ("me", "mine"); - AssertEquals ("Created before GetXml", DateTime.MinValue, token.Created); - - XmlDocument doc = new XmlDocument (); - XmlElement xel = token.GetXml (doc); - Assert ("Created after GetXml", DateTime.MinValue < token.Created); - } - - [Test] - [ExpectedException (typeof (InvalidOperationException))] - public void AuthenticationKey_BeforeGetXml () - { - UsernameToken token = new UsernameToken ("me", "mine"); - AssertNotNull ("AuthenticationKey", token.AuthenticationKey); - } - - [Test] - [Ignore("this works on MS only when stepping in debugger")] - public void AuthenticationKey_AfterGetXml () - { - UsernameToken token = new UsernameToken ("me", "mine"); - XmlDocument doc = new XmlDocument (); - XmlElement xel = token.GetXml (doc); - AssertNotNull ("AuthenticationKey", token.AuthenticationKey); - } - - [Test] - [ExpectedException (typeof (NotSupportedException))] - public void DecryptionKey () - { - UsernameToken token = new UsernameToken ("me", "mine"); - AssertNotNull ("DecryptionKey", token.DecryptionKey); - } - - [Test] - [ExpectedException (typeof (NotSupportedException))] - public void EncryptionKey () - { - UsernameToken token = new UsernameToken ("me", "mine"); - AssertNotNull ("EncryptionKey", token.EncryptionKey); - } - - [Test] - public void SignatureKey () - { - UsernameToken token = new UsernameToken ("me", "mine"); - AssertNotNull ("SignatureKey", token.SignatureKey); - // TODO use signature key - } - - [Test] - public void Password () - { - UsernameToken token = new UsernameToken ("me", "mine"); - AssertEquals ("mine", token.Password); - AssertEquals ("SendNone(implicit)", PasswordOption.SendNone, token.PasswordOption); - - token = new UsernameToken ("me", "none", PasswordOption.SendNone); - AssertEquals ("Password", "none", token.Password); - AssertEquals ("SendNone(explicit)", PasswordOption.SendNone, token.PasswordOption); - } - - [Test] - public void Nonce () - { - UsernameToken token = new UsernameToken ("me", "mine"); - AssertNull ("Nonce before GetXml", token.Nonce); - - XmlDocument doc = new XmlDocument (); - XmlElement xel = token.GetXml (doc); - AssertNotNull ("Nonce after GetXml", token.Nonce); - } - - [Test] - public void Supports () - { - UsernameToken token = new UsernameToken ("me", "mine"); - Assert ("SupportsDataEncryption", !token.SupportsDataEncryption); - Assert ("SupportsDigitalSignature", token.SupportsDigitalSignature); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void GetXmlNull () - { - UsernameToken token = new UsernameToken ("me", "mine"); - XmlElement xel = token.GetXml (null); - } - - [Test] - public void GetXml () - { - UsernameToken token = new UsernameToken ("me", "mine"); - XmlDocument doc = new XmlDocument (); - string xml = token.GetXml (doc).OuterXml; - Assert ("Id", xml.IndexOf (" wsu:Id=\"SecurityToken-") > 0); - Assert ("Username", xml.IndexOf ("me") > 0); - Assert ("Password", xml.IndexOf ("mine") < 0); - Assert ("Nonce", xml.IndexOf ("") > 0); - Assert ("Created", xml.IndexOf ("") > 0); - - token = new UsernameToken ("me", "mine", PasswordOption.SendPlainText); - xml = token.GetXml (doc).OuterXml; - Assert ("Id", xml.IndexOf (" wsu:Id=\"SecurityToken-") > 0); - Assert ("Username", xml.IndexOf ("me") > 0); - Assert ("Password", xml.IndexOf ("mine") > 0); - Assert ("Nonce", xml.IndexOf ("") > 0); - Assert ("Created", xml.IndexOf ("") > 0); - - token = new UsernameToken ("me", "mine", PasswordOption.SendHashed); - xml = token.GetXml (doc).OuterXml; - Assert ("Id", xml.IndexOf (" wsu:Id=\"SecurityToken-") > 0); - Assert ("Username", xml.IndexOf ("me") > 0); - Assert ("Password", xml.IndexOf ("") > 0); - Assert ("Nonce", xml.IndexOf ("") > 0); - Assert ("Created", xml.IndexOf ("") > 0); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void LoadXmlNull () - { - UsernameToken token = new UsernameToken ("me", "mine"); - token.LoadXml (null); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void LoadXml_BadElement () - { - UsernameToken token = new UsernameToken ("me", "mine"); - XmlDocument doc = new XmlDocument (); - // bad element (Timestamp case is invalid) - doc.LoadXml (""); - token.LoadXml (doc.DocumentElement); - } - - [Test] - [ExpectedException (typeof (ConfigurationException))] - public void LoadXml_WithoutPasswordProvider () - { - string xml = "meU98BosqSRZFZAH9Izw4k7Q==2003-09-10T01:33:13Z"; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - UsernameToken token = new UsernameToken (doc.DocumentElement); - } - - - [Test] - [ExpectedException (typeof (ConfigurationException))] -// [Ignore("requires setting up a PasswordProvider - strange because no password is sent !?!")] - // sample taken from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnglobspec/html/ws-security.asp - public void LoadXml_PasswordNone () - { - string xml = "meU98BosqSRZFZAH9Izw4k7Q==2003-09-10T01:33:13Z"; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - UsernameToken token = new UsernameToken (doc.DocumentElement); - XmlElement xel = token.GetXml (doc); - // TODO - with a PasswordProvider - } - - [Test] - [ExpectedException (typeof (ConfigurationException))] -// [Ignore("requires setting up a PasswordProvider")] - // sample taken from http://msdn.microsoft.com/webservices/building/wse/default.aspx?pull=/library/en-us/dnwebsrv/html/wssecdrill.asp - public void LoadXml_PasswordText () - { - string xml = "domain_name\\joeblowNoTelinNE1QLSVRt9g3e19jJXJYhtBKA==2003-07-05T22:37:52Z"; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - UsernameToken token = new UsernameToken (doc.DocumentElement); - XmlElement xel = token.GetXml (doc); - // TODO - with a PasswordProvider - } - - [Test] - [ExpectedException (typeof (ConfigurationException))] -// [Ignore("requires setting up a PasswordProvider")] - public void LoadXml_PasswordHashed () - { - string xml = "memvFakbZuqOwWZ+ULU0CYy1YAYtM=IHMGSS18kXhPqBqRZezDNg==2003-09-13T17:51:54Z"; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - UsernameToken token = new UsernameToken (doc.DocumentElement); - XmlElement xel = token.GetXml (doc); - // TODO - with a PasswordProvider - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/WSSecurityTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/WSSecurityTest.cs deleted file mode 100644 index de08dbb60a5..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/WSSecurityTest.cs +++ /dev/null @@ -1,86 +0,0 @@ -// -// WSSecurityTest.cs - NUnit Test Cases for WSSecurity -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Security; -using System; - -namespace MonoTests.MS.Web.Services.Security { - - [TestFixture] - public class WSSecurityTest : Assertion { - - [Test] - public void Constructor () - { - WSSecurity wss = new WSSecurity (); - Assertion.AssertNotNull ("Constructor", wss); - } - - [Test] - public void PublicConstStrings () - { -#if WSE1 - AssertEquals ("NamespaceURI", "http://schemas.xmlsoap.org/ws/2002/07/secext", WSSecurity.NamespaceURI); -#else - AssertEquals ("NamespaceURI", "http://schemas.xmlsoap.org/ws/2002/12/secext", WSSecurity.NamespaceURI); -#endif - AssertEquals ("Prefix", "wsse", WSSecurity.Prefix); - } - - // LAMESPEC AttributeNames aren't documented - [Test] - public void AttributeNamesConstructor () - { - // test constructor - WSSecurity.AttributeNames wsan = new WSSecurity.AttributeNames (); - AssertNotNull ("AttributeNames Constructor", wsan); - } - - // LAMESPEC AttributeNames aren't documented - [Test] - public void AttributeNames () - { - // test public const strings - AssertEquals ("EncodingType", "EncodingType", WSSecurity.AttributeNames.EncodingType); - AssertEquals ("IdentifierType", "IdentifierType", WSSecurity.AttributeNames.IdentifierType); -#if WSE1 - AssertEquals ("TokenType", "TokenType", WSSecurity.AttributeNames.TokenType); -#endif - AssertEquals ("Type", "Type", WSSecurity.AttributeNames.Type); - AssertEquals ("Uri", "URI", WSSecurity.AttributeNames.Uri); - AssertEquals ("ValueType", "ValueType", WSSecurity.AttributeNames.ValueType); - } - - // LAMESPEC ElementNames aren't documented - [Test] - public void ElementNamesConstructor () - { - // test constructor - WSSecurity.ElementNames wsen = new WSSecurity.ElementNames (); - AssertNotNull ("ElementNames Constructor", wsen); - } - - // LAMESPEC ElementNames aren't documented - [Test] - public void TestElementNames () - { - // test public const strings - AssertEquals ("BinarySecurityToken", "BinarySecurityToken", WSSecurity.ElementNames.BinarySecurityToken); - AssertEquals ("KeyIdentifier", "KeyIdentifier", WSSecurity.ElementNames.KeyIdentifier); - AssertEquals ("Nonce", "Nonce", WSSecurity.ElementNames.Nonce); - AssertEquals ("Password", "Password", WSSecurity.ElementNames.Password); - AssertEquals ("Reference", "Reference", WSSecurity.ElementNames.Reference); - AssertEquals ("Security", "Security", WSSecurity.ElementNames.Security); - AssertEquals ("SecurityTokenReference", "SecurityTokenReference", WSSecurity.ElementNames.SecurityTokenReference); - AssertEquals ("Username", "Username", WSSecurity.ElementNames.Username); - AssertEquals ("UsernameToken", "UsernameToken", WSSecurity.ElementNames.UsernameToken); - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/X509SecurityTokenTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/X509SecurityTokenTest.cs deleted file mode 100644 index b37d34206d6..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/X509SecurityTokenTest.cs +++ /dev/null @@ -1,444 +0,0 @@ -// -// X509SecurityTokenTest.cs - NUnit Test Cases for X509SecurityToken -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Security; -using Microsoft.Web.Services.Security.X509; -using System; -using System.ComponentModel; // for Win32Exception -using System.Reflection; -using System.Security.Cryptography; -using System.Xml; - -namespace MonoTests.MS.Web.Services.Security { - - [TestFixture] - public class X509SecurityTokenTest : Assertion { - - // current but not trusted (test certificate) - private static byte[] cert1 = { 0x30, 0x82, 0x02, 0x2A, 0x30, 0x82, 0x01, 0x97, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x91, 0xC4, 0x4B, 0x0D, 0xB7, 0xD8, 0x10, 0x84, 0x42, 0x26, 0x71, 0xB3, 0x97, 0xB5, 0x00, 0x97, 0x30, 0x09, 0x06, 0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1D, 0x05, 0x00, 0x30, 0x28, 0x31, 0x26, 0x30, 0x24, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x1D, 0x4D, 0x6F, 0x74, 0x75, 0x73, 0x20, 0x54, 0x65, 0x63, 0x68, 0x6E, 0x6F, 0x6C, 0x6F, 0x67, 0x69, 0x65, 0x73, 0x20, 0x69, 0x6E, 0x63, 0x2E, 0x28, 0x74, 0x65, 0x73, 0x74, 0x29, 0x30, 0x1E, 0x17, 0x0D, 0x30, 0x33, 0x30, 0x38, 0x31, 0x33, 0x30, 0x30, 0x34, 0x33, 0x34, 0x37, 0x5A, 0x17, 0x0D, 0x33, 0x39, 0x31, 0x32, 0x33, 0x31, 0x32, 0x33, 0x35, - 0x39, 0x35, 0x39, 0x5A, 0x30, 0x13, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x08, 0x46, 0x41, 0x52, 0x53, 0x43, 0x41, 0x50, 0x45, 0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81, 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xD2, 0xCB, 0x47, 0x21, 0xF5, 0x62, 0xDD, 0x35, 0xBF, 0x1D, 0xEC, 0x9A, 0x4C, 0x07, 0x2C, 0x01, 0xF0, 0x28, 0xC2, 0x82, 0x17, 0x8E, 0x58, 0x32, 0xD5, 0x4C, 0xAC, 0x86, 0xB4, 0xC9, 0xEB, 0x21, 0x26, 0xF3, 0x22, 0x30, 0xC5, 0x7A, 0xA3, 0x5A, 0xDD, 0x53, 0xAB, 0x1C, 0x06, 0x3E, 0xB2, 0x13, 0xC4, 0x05, 0x1D, 0x95, 0x8B, 0x0A, 0x71, 0x71, 0x11, 0xA7, 0x47, 0x26, 0x61, 0xF1, - 0x76, 0xBE, 0x35, 0x72, 0x32, 0xC5, 0xCB, 0x47, 0xA4, 0x22, 0x41, 0x1E, 0xAD, 0x29, 0x11, 0x0D, 0x39, 0x22, 0x0C, 0x79, 0x90, 0xC6, 0x52, 0xA1, 0x10, 0xF6, 0x55, 0x09, 0x4E, 0x51, 0x26, 0x47, 0x0E, 0x94, 0xE6, 0x81, 0xF5, 0x18, 0x6B, 0x99, 0xF0, 0x76, 0xF3, 0xB2, 0x4C, 0x91, 0xE9, 0xBA, 0x3B, 0x3F, 0x6E, 0x63, 0xDA, 0x12, 0xD1, 0x0B, 0x73, 0x0E, 0x12, 0xC7, 0x70, 0x77, 0x22, 0x03, 0x9D, 0x5D, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x72, 0x30, 0x70, 0x30, 0x13, 0x06, 0x03, 0x55, 0x1D, 0x25, 0x04, 0x0C, 0x30, 0x0A, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x01, 0x30, 0x59, 0x06, 0x03, 0x55, 0x1D, 0x01, 0x04, 0x52, 0x30, 0x50, 0x80, 0x10, 0xAE, 0xD7, 0x80, 0x88, 0xA6, 0x3D, 0xBA, - 0x50, 0xA1, 0x7E, 0x57, 0xE5, 0x40, 0xC9, 0x6F, 0xC5, 0xA1, 0x2A, 0x30, 0x28, 0x31, 0x26, 0x30, 0x24, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x1D, 0x4D, 0x6F, 0x74, 0x75, 0x73, 0x20, 0x54, 0x65, 0x63, 0x68, 0x6E, 0x6F, 0x6C, 0x6F, 0x67, 0x69, 0x65, 0x73, 0x20, 0x69, 0x6E, 0x63, 0x2E, 0x28, 0x74, 0x65, 0x73, 0x74, 0x29, 0x82, 0x10, 0x9D, 0xAE, 0xA3, 0x39, 0x47, 0x0E, 0xD4, 0xA2, 0x49, 0x78, 0xEA, 0x6C, 0xBA, 0x0D, 0xDE, 0x9C, 0x30, 0x09, 0x06, 0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1D, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, 0x32, 0x8A, 0x7E, 0xAD, 0xE7, 0x67, 0x9E, 0x5C, 0x4C, 0xD8, 0x33, 0x59, 0x68, 0xCF, 0x94, 0xC0, 0x36, 0x47, 0x7A, 0xA7, 0x85, 0xC2, 0xDD, 0xD8, 0xDA, 0x11, 0x3C, 0x66, 0xC1, 0x83, - 0xE3, 0xAB, 0x33, 0x06, 0x7C, 0xE3, 0x6A, 0x15, 0x72, 0xB8, 0x83, 0x3D, 0x0B, 0xAB, 0x3C, 0xEE, 0x75, 0x13, 0xBD, 0x5C, 0x96, 0x25, 0x56, 0x36, 0x05, 0xFA, 0xAE, 0xD4, 0xF4, 0xCF, 0x52, 0xEC, 0x11, 0xB5, 0xEA, 0x9F, 0x20, 0xA3, 0xC8, 0x34, 0x72, 0x59, 0x09, 0x51, 0xE7, 0x36, 0x87, 0x86, 0x86, 0x98, 0xB5, 0x30, 0x7B, 0xFB, 0x3D, 0xCC, 0x5E, 0xE8, 0xC9, 0x49, 0xE0, 0xC6, 0xEA, 0x02, 0x76, 0x01, 0xE0, 0xBB, 0x8A, 0x70, 0xEB, 0x07, 0x86, 0xE8, 0x04, 0xE7, 0x48, 0xE4, 0x6C, 0x90, 0xE6, 0x16, 0x42, 0xB4, 0xBB, 0xC0, 0xC4, 0x82, 0x5F, 0xF8, 0xFB, 0x7E, 0xB2, 0x9E, 0xC2, 0x78, 0x26, 0x86 }; - - // this certificate isn't current - private static byte[] cert2 = { 0x30,0x82,0x09,0xB9,0x30,0x82,0x09,0x22,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x20,0x0B,0x35,0x5E,0xCE,0xC4,0xB0,0x63,0xB7,0xDE,0xC6,0x34,0xB9,0x70,0x34,0x44,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x30,0x62,0x31,0x11,0x30,0x0F,0x06,0x03,0x55,0x04,0x07,0x13,0x08,0x49,0x6E,0x74,0x65,0x72,0x6E,0x65,0x74,0x31,0x17,0x30,0x15,0x06,0x03,0x55,0x04,0x0A,0x13,0x0E,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x34,0x30,0x32,0x06,0x03,0x55,0x04,0x0B, - 0x13,0x2B,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x43,0x41,0x20,0x2D,0x20,0x49,0x6E,0x64,0x69,0x76,0x69,0x64,0x75,0x61,0x6C,0x20,0x53,0x75,0x62,0x73,0x63,0x72,0x69,0x62,0x65,0x72,0x30,0x1E,0x17,0x0D,0x39,0x36,0x30,0x38,0x32,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x39,0x37,0x30,0x38,0x32,0x30,0x32,0x33,0x35,0x39,0x35,0x39,0x5A,0x30,0x82,0x01,0x0A,0x31,0x11,0x30,0x0F,0x06,0x03,0x55,0x04,0x07,0x13,0x08,0x49,0x6E,0x74,0x65,0x72,0x6E,0x65,0x74, - 0x31,0x17,0x30,0x15,0x06,0x03,0x55,0x04,0x0A,0x13,0x0E,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x34,0x30,0x32,0x06,0x03,0x55,0x04,0x0B,0x13,0x2B,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x43,0x41,0x20,0x2D,0x20,0x49,0x6E,0x64,0x69,0x76,0x69,0x64,0x75,0x61,0x6C,0x20,0x53,0x75,0x62,0x73,0x63,0x72,0x69,0x62,0x65,0x72,0x31,0x46,0x30,0x44,0x06,0x03,0x55,0x04,0x0B,0x13,0x3D,0x77,0x77,0x77,0x2E,0x76,0x65,0x72,0x69,0x73,0x69, - 0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x2F,0x72,0x65,0x70,0x6F,0x73,0x69,0x74,0x6F,0x72,0x79,0x2F,0x43,0x50,0x53,0x20,0x49,0x6E,0x63,0x6F,0x72,0x70,0x2E,0x20,0x62,0x79,0x20,0x52,0x65,0x66,0x2E,0x2C,0x4C,0x49,0x41,0x42,0x2E,0x4C,0x54,0x44,0x28,0x63,0x29,0x39,0x36,0x31,0x26,0x30,0x24,0x06,0x03,0x55,0x04,0x0B,0x13,0x1D,0x44,0x69,0x67,0x69,0x74,0x61,0x6C,0x20,0x49,0x44,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x2D,0x20,0x4E,0x65,0x74,0x73,0x63,0x61,0x70,0x65,0x31,0x16,0x30,0x14,0x06,0x03,0x55,0x04,0x03, - 0x13,0x0D,0x44,0x61,0x76,0x69,0x64,0x20,0x54,0x2E,0x20,0x47,0x72,0x61,0x79,0x31,0x1E,0x30,0x1C,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x01,0x16,0x0F,0x64,0x61,0x76,0x69,0x64,0x40,0x66,0x6F,0x72,0x6D,0x61,0x6C,0x2E,0x69,0x65,0x30,0x5C,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x4B,0x00,0x30,0x48,0x02,0x41,0x00,0xC5,0x81,0x07,0xA2,0xEB,0x0F,0xB8,0xFF,0xF8,0xF8,0x1C,0xEE,0x32,0xFF,0xBF,0x12,0x35,0x6A,0xF9,0x6B,0xC8,0xBE,0x2F,0xFB,0x3E,0xAF,0x04,0x51, - 0x4A,0xAC,0xDD,0x10,0x29,0xA8,0xCD,0x40,0x5B,0x66,0x1E,0x98,0xEF,0xF2,0x4C,0x77,0xFA,0x8F,0x86,0xD1,0x21,0x67,0x92,0x44,0x4A,0xC4,0x89,0xC9,0x83,0xCF,0x88,0x9F,0x6F,0xE2,0x32,0x35,0x02,0x03,0x01,0x00,0x01,0xA3,0x82,0x07,0x08,0x30,0x82,0x07,0x04,0x30,0x09,0x06,0x03,0x55,0x1D,0x13,0x04,0x02,0x30,0x00,0x30,0x82,0x02,0x1F,0x06,0x03,0x55,0x1D,0x03,0x04,0x82,0x02,0x16,0x30,0x82,0x02,0x12,0x30,0x82,0x02,0x0E,0x30,0x82,0x02,0x0A,0x06,0x0B,0x60,0x86,0x48,0x01,0x86,0xF8,0x45,0x01,0x07,0x01,0x01,0x30,0x82, - 0x01,0xF9,0x16,0x82,0x01,0xA7,0x54,0x68,0x69,0x73,0x20,0x63,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x69,0x6E,0x63,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x65,0x73,0x20,0x62,0x79,0x20,0x72,0x65,0x66,0x65,0x72,0x65,0x6E,0x63,0x65,0x2C,0x20,0x61,0x6E,0x64,0x20,0x69,0x74,0x73,0x20,0x75,0x73,0x65,0x20,0x69,0x73,0x20,0x73,0x74,0x72,0x69,0x63,0x74,0x6C,0x79,0x20,0x73,0x75,0x62,0x6A,0x65,0x63,0x74,0x20,0x74,0x6F,0x2C,0x20,0x74,0x68,0x65,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x43, - 0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x50,0x72,0x61,0x63,0x74,0x69,0x63,0x65,0x20,0x53,0x74,0x61,0x74,0x65,0x6D,0x65,0x6E,0x74,0x20,0x28,0x43,0x50,0x53,0x29,0x2C,0x20,0x61,0x76,0x61,0x69,0x6C,0x61,0x62,0x6C,0x65,0x20,0x61,0x74,0x3A,0x20,0x68,0x74,0x74,0x70,0x73,0x3A,0x2F,0x2F,0x77,0x77,0x77,0x2E,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x2F,0x43,0x50,0x53,0x3B,0x20,0x62,0x79,0x20,0x45,0x2D,0x6D,0x61,0x69,0x6C,0x20,0x61,0x74,0x20,0x43,0x50,0x53,0x2D, - 0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x73,0x40,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x3B,0x20,0x6F,0x72,0x20,0x62,0x79,0x20,0x6D,0x61,0x69,0x6C,0x20,0x61,0x74,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x2C,0x20,0x32,0x35,0x39,0x33,0x20,0x43,0x6F,0x61,0x73,0x74,0x20,0x41,0x76,0x65,0x2E,0x2C,0x20,0x4D,0x6F,0x75,0x6E,0x74,0x61,0x69,0x6E,0x20,0x56,0x69,0x65,0x77,0x2C,0x20,0x43,0x41,0x20,0x39,0x34,0x30,0x34,0x33,0x20,0x55,0x53,0x41,0x20,0x54,0x65, - 0x6C,0x2E,0x20,0x2B,0x31,0x20,0x28,0x34,0x31,0x35,0x29,0x20,0x39,0x36,0x31,0x2D,0x38,0x38,0x33,0x30,0x20,0x43,0x6F,0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x63,0x29,0x20,0x31,0x39,0x39,0x36,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x20,0x20,0x41,0x6C,0x6C,0x20,0x52,0x69,0x67,0x68,0x74,0x73,0x20,0x52,0x65,0x73,0x65,0x72,0x76,0x65,0x64,0x2E,0x20,0x43,0x45,0x52,0x54,0x41,0x49,0x4E,0x20,0x57,0x41,0x52,0x52,0x41,0x4E,0x54,0x49,0x45,0x53,0x20,0x44,0x49,0x53,0x43, - 0x4C,0x41,0x49,0x4D,0x45,0x44,0x20,0x61,0x6E,0x64,0x20,0x4C,0x49,0x41,0x42,0x49,0x4C,0x49,0x54,0x59,0x20,0x4C,0x49,0x4D,0x49,0x54,0x45,0x44,0x2E,0xA0,0x0E,0x06,0x0C,0x60,0x86,0x48,0x01,0x86,0xF8,0x45,0x01,0x07,0x01,0x01,0x01,0xA1,0x0E,0x06,0x0C,0x60,0x86,0x48,0x01,0x86,0xF8,0x45,0x01,0x07,0x01,0x01,0x02,0x30,0x2C,0x30,0x2A,0x16,0x28,0x68,0x74,0x74,0x70,0x73,0x3A,0x2F,0x2F,0x77,0x77,0x77,0x2E,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x2F,0x72,0x65,0x70,0x6F,0x73,0x69,0x74,0x6F, - 0x72,0x79,0x2F,0x43,0x50,0x53,0x20,0x30,0x11,0x06,0x09,0x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x01,0x04,0x04,0x03,0x02,0x07,0x80,0x30,0x36,0x06,0x09,0x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x08,0x04,0x29,0x16,0x27,0x68,0x74,0x74,0x70,0x73,0x3A,0x2F,0x2F,0x77,0x77,0x77,0x2E,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x2F,0x72,0x65,0x70,0x6F,0x73,0x69,0x74,0x6F,0x72,0x79,0x2F,0x43,0x50,0x53,0x30,0x82,0x04,0x87,0x06,0x09,0x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x0D,0x04,0x82,0x04, - 0x78,0x16,0x82,0x04,0x74,0x43,0x41,0x55,0x54,0x49,0x4F,0x4E,0x3A,0x20,0x54,0x68,0x65,0x20,0x43,0x6F,0x6D,0x6D,0x6F,0x6E,0x20,0x4E,0x61,0x6D,0x65,0x20,0x69,0x6E,0x20,0x74,0x68,0x69,0x73,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x44,0x69,0x67,0x69,0x74,0x61,0x6C,0x20,0x0A,0x49,0x44,0x20,0x69,0x73,0x20,0x6E,0x6F,0x74,0x20,0x61,0x75,0x74,0x68,0x65,0x6E,0x74,0x69,0x63,0x61,0x74,0x65,0x64,0x20,0x62,0x79,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2E,0x20,0x49,0x74,0x20,0x6D,0x61,0x79,0x20,0x62, - 0x65,0x20,0x74,0x68,0x65,0x0A,0x68,0x6F,0x6C,0x64,0x65,0x72,0x27,0x73,0x20,0x72,0x65,0x61,0x6C,0x20,0x6E,0x61,0x6D,0x65,0x20,0x6F,0x72,0x20,0x61,0x6E,0x20,0x61,0x6C,0x69,0x61,0x73,0x2E,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x64,0x6F,0x65,0x73,0x20,0x61,0x75,0x74,0x68,0x2D,0x0A,0x65,0x6E,0x74,0x69,0x63,0x61,0x74,0x65,0x20,0x74,0x68,0x65,0x20,0x65,0x2D,0x6D,0x61,0x69,0x6C,0x20,0x61,0x64,0x64,0x72,0x65,0x73,0x73,0x20,0x6F,0x66,0x20,0x74,0x68,0x65,0x20,0x68,0x6F,0x6C,0x64,0x65,0x72,0x2E, - 0x0A,0x0A,0x54,0x68,0x69,0x73,0x20,0x63,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x69,0x6E,0x63,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x65,0x73,0x20,0x62,0x79,0x20,0x72,0x65,0x66,0x65,0x72,0x65,0x6E,0x63,0x65,0x2C,0x20,0x61,0x6E,0x64,0x20,0x0A,0x69,0x74,0x73,0x20,0x75,0x73,0x65,0x20,0x69,0x73,0x20,0x73,0x74,0x72,0x69,0x63,0x74,0x6C,0x79,0x20,0x73,0x75,0x62,0x6A,0x65,0x63,0x74,0x20,0x74,0x6F,0x2C,0x20,0x74,0x68,0x65,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x0A,0x43,0x65,0x72, - 0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x50,0x72,0x61,0x63,0x74,0x69,0x63,0x65,0x20,0x53,0x74,0x61,0x74,0x65,0x6D,0x65,0x6E,0x74,0x20,0x28,0x43,0x50,0x53,0x29,0x2C,0x20,0x61,0x76,0x61,0x69,0x6C,0x61,0x62,0x6C,0x65,0x0A,0x69,0x6E,0x20,0x74,0x68,0x65,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x72,0x65,0x70,0x6F,0x73,0x69,0x74,0x6F,0x72,0x79,0x20,0x61,0x74,0x3A,0x20,0x0A,0x68,0x74,0x74,0x70,0x73,0x3A,0x2F,0x2F,0x77,0x77,0x77,0x2E,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E, - 0x63,0x6F,0x6D,0x3B,0x20,0x62,0x79,0x20,0x45,0x2D,0x6D,0x61,0x69,0x6C,0x20,0x61,0x74,0x0A,0x43,0x50,0x53,0x2D,0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x73,0x40,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x3B,0x20,0x6F,0x72,0x20,0x62,0x79,0x20,0x6D,0x61,0x69,0x6C,0x20,0x61,0x74,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x0A,0x49,0x6E,0x63,0x2E,0x2C,0x20,0x32,0x35,0x39,0x33,0x20,0x43,0x6F,0x61,0x73,0x74,0x20,0x41,0x76,0x65,0x2E,0x2C,0x20,0x4D,0x6F,0x75,0x6E,0x74,0x61,0x69,0x6E, - 0x20,0x56,0x69,0x65,0x77,0x2C,0x20,0x43,0x41,0x20,0x39,0x34,0x30,0x34,0x33,0x20,0x55,0x53,0x41,0x0A,0x0A,0x43,0x6F,0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x63,0x29,0x31,0x39,0x39,0x36,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x20,0x20,0x41,0x6C,0x6C,0x20,0x52,0x69,0x67,0x68,0x74,0x73,0x20,0x0A,0x52,0x65,0x73,0x65,0x72,0x76,0x65,0x64,0x2E,0x20,0x43,0x45,0x52,0x54,0x41,0x49,0x4E,0x20,0x57,0x41,0x52,0x52,0x41,0x4E,0x54,0x49,0x45,0x53,0x20,0x44,0x49,0x53,0x43, - 0x4C,0x41,0x49,0x4D,0x45,0x44,0x20,0x41,0x4E,0x44,0x20,0x0A,0x4C,0x49,0x41,0x42,0x49,0x4C,0x49,0x54,0x59,0x20,0x4C,0x49,0x4D,0x49,0x54,0x45,0x44,0x2E,0x0A,0x0A,0x57,0x41,0x52,0x4E,0x49,0x4E,0x47,0x3A,0x20,0x54,0x48,0x45,0x20,0x55,0x53,0x45,0x20,0x4F,0x46,0x20,0x54,0x48,0x49,0x53,0x20,0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x20,0x49,0x53,0x20,0x53,0x54,0x52,0x49,0x43,0x54,0x4C,0x59,0x0A,0x53,0x55,0x42,0x4A,0x45,0x43,0x54,0x20,0x54,0x4F,0x20,0x54,0x48,0x45,0x20,0x56,0x45,0x52,0x49, - 0x53,0x49,0x47,0x4E,0x20,0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x49,0x4F,0x4E,0x20,0x50,0x52,0x41,0x43,0x54,0x49,0x43,0x45,0x0A,0x53,0x54,0x41,0x54,0x45,0x4D,0x45,0x4E,0x54,0x2E,0x20,0x20,0x54,0x48,0x45,0x20,0x49,0x53,0x53,0x55,0x49,0x4E,0x47,0x20,0x41,0x55,0x54,0x48,0x4F,0x52,0x49,0x54,0x59,0x20,0x44,0x49,0x53,0x43,0x4C,0x41,0x49,0x4D,0x53,0x20,0x43,0x45,0x52,0x54,0x41,0x49,0x4E,0x0A,0x49,0x4D,0x50,0x4C,0x49,0x45,0x44,0x20,0x41,0x4E,0x44,0x20,0x45,0x58,0x50,0x52,0x45,0x53,0x53,0x20, - 0x57,0x41,0x52,0x52,0x41,0x4E,0x54,0x49,0x45,0x53,0x2C,0x20,0x49,0x4E,0x43,0x4C,0x55,0x44,0x49,0x4E,0x47,0x20,0x57,0x41,0x52,0x52,0x41,0x4E,0x54,0x49,0x45,0x53,0x0A,0x4F,0x46,0x20,0x4D,0x45,0x52,0x43,0x48,0x41,0x4E,0x54,0x41,0x42,0x49,0x4C,0x49,0x54,0x59,0x20,0x4F,0x52,0x20,0x46,0x49,0x54,0x4E,0x45,0x53,0x53,0x20,0x46,0x4F,0x52,0x20,0x41,0x20,0x50,0x41,0x52,0x54,0x49,0x43,0x55,0x4C,0x41,0x52,0x0A,0x50,0x55,0x52,0x50,0x4F,0x53,0x45,0x2C,0x20,0x41,0x4E,0x44,0x20,0x57,0x49,0x4C,0x4C,0x20,0x4E,0x4F, - 0x54,0x20,0x42,0x45,0x20,0x4C,0x49,0x41,0x42,0x4C,0x45,0x20,0x46,0x4F,0x52,0x20,0x43,0x4F,0x4E,0x53,0x45,0x51,0x55,0x45,0x4E,0x54,0x49,0x41,0x4C,0x2C,0x0A,0x50,0x55,0x4E,0x49,0x54,0x49,0x56,0x45,0x2C,0x20,0x41,0x4E,0x44,0x20,0x43,0x45,0x52,0x54,0x41,0x49,0x4E,0x20,0x4F,0x54,0x48,0x45,0x52,0x20,0x44,0x41,0x4D,0x41,0x47,0x45,0x53,0x2E,0x20,0x53,0x45,0x45,0x20,0x54,0x48,0x45,0x20,0x43,0x50,0x53,0x0A,0x46,0x4F,0x52,0x20,0x44,0x45,0x54,0x41,0x49,0x4C,0x53,0x2E,0x0A,0x0A,0x43,0x6F,0x6E,0x74,0x65,0x6E, - 0x74,0x73,0x20,0x6F,0x66,0x20,0x74,0x68,0x65,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x65,0x64,0x0A,0x6E,0x6F,0x6E,0x76,0x65,0x72,0x69,0x66,0x69,0x65,0x64,0x53,0x75,0x62,0x6A,0x65,0x63,0x74,0x41,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x73,0x20,0x65,0x78,0x74,0x65,0x6E,0x73,0x69,0x6F,0x6E,0x20,0x76,0x61,0x6C,0x75,0x65,0x20,0x73,0x68,0x61,0x6C,0x6C,0x20,0x0A,0x6E,0x6F,0x74,0x20,0x62,0x65,0x20,0x63,0x6F,0x6E,0x73,0x69,0x64,0x65,0x72,0x65,0x64,0x20, - 0x61,0x73,0x20,0x61,0x63,0x63,0x75,0x72,0x61,0x74,0x65,0x20,0x69,0x6E,0x66,0x6F,0x72,0x6D,0x61,0x74,0x69,0x6F,0x6E,0x20,0x76,0x61,0x6C,0x69,0x64,0x61,0x74,0x65,0x64,0x20,0x0A,0x62,0x79,0x20,0x74,0x68,0x65,0x20,0x49,0x41,0x2E,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x03,0x81,0x81,0x00,0x2B,0x3D,0x44,0xC7,0x32,0x59,0xAE,0xF1,0x5F,0x8F,0x3F,0x87,0xE3,0x3E,0xEB,0x81,0x30,0xF8,0xA9,0x96,0xDB,0x01,0x42,0x0B,0x04,0xEF,0x37,0x02,0x3F,0xD4,0x20,0x61,0x58,0xC4,0x4A,0x3A, - 0x39,0xB3,0xFB,0xD9,0xF8,0xA5,0xC4,0x5E,0x33,0x5A,0x0E,0xFA,0x93,0x56,0x2F,0x6F,0xD6,0x61,0xA2,0xAF,0xA5,0x0C,0x1D,0xE2,0x41,0x65,0xF3,0x40,0x75,0x66,0x83,0xD2,0x5A,0xB4,0xB7,0x56,0x0B,0x8E,0x0D,0xA1,0x33,0x13,0x7D,0x49,0xC3,0xB1,0x00,0x68,0x83,0x7F,0xB5,0x66,0xD4,0x32,0x32,0xFE,0x8B,0x9A,0x5A,0xD6,0x01,0x72,0x31,0x5D,0x85,0x91,0xBC,0x93,0x9B,0x65,0x60,0x25,0xC6,0x1F,0xBC,0xDD,0x69,0x44,0x62,0xC2,0xB2,0x6F,0x46,0xAB,0x2F,0x20,0xA5,0x6F,0xDA,0x48,0x6C,0x9C }; - - public const string xml = "MIICKjCCAZegAwIBAgIQkcRLDbfYEIRCJnGzl7UAlzAJBgUrDgMCHQUAMCgxJjAkBgNVBAMTHU1vdHVzIFRlY2hub2xvZ2llcyBpbmMuKHRlc3QpMB4XDTAzMDgxMzAwNDM0N1oXDTM5MTIzMTIzNTk1OVowEzERMA8GA1UEAxMIRkFSU0NBUEUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANLLRyH1Yt01vx3smkwHLAHwKMKCF45YMtVMrIa0yeshJvMiMMV6o1rdU6scBj6yE8QFHZWLCnFxEadHJmHxdr41cjLFy0ekIkEerSkRDTkiDHmQxlKhEPZVCU5RJkcOlOaB9RhrmfB287JMkem6Oz9uY9oS0QtzDhLHcHciA51dAgMBAAGjcjBwMBMGA1UdJQQMMAoGCCsGAQUFBwMBMFkGA1UdAQRSMFCAEK7XgIimPbpQoX5X5UDJb8WhKjAoMSYwJAYDVQQDEx1Nb3R1cyBUZWNobm9sb2dpZXMgaW5jLih0ZXN0KYIQna6jOUcO1KJJeOpsug3enDAJBgUrDgMCHQUAA4GBADKKfq3nZ55cTNgzWWjPlMA2R3qnhcLd2NoRPGbBg+OrMwZ842oVcriDPQurPO51E71cliVWNgX6rtT0z1LsEbXqnyCjyDRyWQlR5zaHhoaYtTB7+z3MXujJSeDG6gJ2AeC7inDrB4boBOdI5GyQ5hZCtLvAxIJf+Pt+sp7CeCaG"; - - private void CheckValueType (X509SecurityToken xst) - { - AssertNotNull ("ValueType!=null", xst); - Assert ("ValueType.IsEmpty", !xst.ValueType.IsEmpty); - AssertEquals ("ValueType.Name", "X509v3", xst.ValueType.Name); - AssertEquals ("ValueType.Namespace", WSSecurity.NamespaceURI, xst.ValueType.Namespace); - } - - [Test] - public void ConstructorX509 () - { - X509Certificate x = new X509Certificate (cert1); - X509SecurityToken xst = new X509SecurityToken (x); - AssertNotNull ("X509SecurityToken(X509Certificate)", xst); - AssertNotNull ("X509SecurityToken.Certificate", xst.Certificate); - AssertNotNull ("X509SecurityToken.RawData", xst.RawData); - // check "static" properties (no need to do it for every certificate) - Assert ("EncodingType.IsEmpty", !xst.EncodingType.IsEmpty); - AssertEquals ("EncodingType.Name", "Base64Binary", xst.EncodingType.Name); - AssertEquals ("EncodingType.Namespace", WSSecurity.NamespaceURI, xst.EncodingType.Namespace); - CheckValueType (xst); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void ConstructorX509Null () - { - X509Certificate x = null; - X509SecurityToken xst = new X509SecurityToken (x); - } - - [Test] - public void ConstructorXmlElement () - { - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - X509SecurityToken xst = new X509SecurityToken (doc.DocumentElement); - AssertNotNull ("X509SecurityToken(XmlElement)", xst); - AssertNotNull ("X509SecurityToken.Certificate", xst.Certificate); - // check "static" properties (no need to do it for every certificate) - Assert ("EncodingType.IsEmpty", !xst.EncodingType.IsEmpty); - AssertEquals ("EncodingType.Name", "Base64Binary", xst.EncodingType.Name); - AssertEquals ("EncodingType.Namespace", WSSecurity.NamespaceURI, xst.EncodingType.Namespace); - Assert ("ValueType.IsEmpty", !xst.ValueType.IsEmpty); - AssertEquals ("ValueType.Name", "X509v3", xst.ValueType.Name); - AssertEquals ("ValueType.Namespace", WSSecurity.NamespaceURI, xst.ValueType.Namespace); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void ConstructorXmlElementNull () - { - XmlElement xel = null; - X509SecurityToken xst = new X509SecurityToken (xel); - } - - [Test] - public void Certificate () - { - X509Certificate x = new X509Certificate (cert1); - X509SecurityToken xst = new X509SecurityToken (x); - AssertEquals ("X509SecurityToken.Certificate", BitConverter.ToString (cert1), BitConverter.ToString (xst.Certificate.GetRawCertData ())); - } - - [Test] - // LAMESPEC: [ExpectedException (typeof (ArgumentNullException))] - public void CertificateNull () - { - X509Certificate x = new X509Certificate (cert1); - X509SecurityToken xst = new X509SecurityToken (x); - xst.Certificate = null; - // oops - many things can go wrong if the certificate is null! - // so I think it's a bug, not just some lame spec - AssertNull (xst.Certificate); - } - - [Test] - public void NullCertificateRawData () - { - X509Certificate x = new X509Certificate (cert1); - X509SecurityToken xst = new X509SecurityToken (x); - xst.Certificate = null; - byte[] rd = xst.RawData; - AssertNull ("(Certificate==null).RawData", rd); - } - - [Test] - // supports both DigitalSignature and DataEncryption - public void TestCertificate1 () - { - X509Certificate x = new X509Certificate (cert1); - X509SecurityToken xst = new X509SecurityToken (x); - // check properties - AssertEquals ("RawData.Length", cert1.Length, xst.RawData.Length); - Assert ("Certificate1.SupportsDigitalSignature", xst.SupportsDigitalSignature); - AssertNotNull ("Certificate1.AuthenticationKey", xst.AuthenticationKey); - Assert ("Certificate1.SupportsDataEncryption", xst.SupportsDataEncryption); - AssertNotNull ("Certificate1.EncryptionKey", xst.EncryptionKey); - } - - [Test] - // supports both DigitalSignature and DataEncryption - public void TestCertificate2 () - { - X509Certificate x = new X509Certificate (cert2); - X509SecurityToken xst = new X509SecurityToken (x); - // check properties - AssertEquals ("RawData.Length", cert2.Length, xst.RawData.Length); - Assert ("Certificate2.SupportsDigitalSignature", xst.SupportsDigitalSignature); - AssertNotNull ("Certificate2.AuthenticationKey", xst.AuthenticationKey); - Assert ("Certificate2.SupportsDataEncryption", xst.SupportsDataEncryption); - AssertNotNull ("Certificate2.EncryptionKey", xst.EncryptionKey); - } - - [Test] - public void GetXml () - { - X509Certificate x = new X509Certificate (cert1); - X509SecurityToken xst = new X509SecurityToken (x); - XmlDocument doc = new XmlDocument (); - XmlElement xel = xst.GetXml (doc); - AssertEquals ("XML length", xml.Length, xel.OuterXml.Length); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void GetXmlNull () - { - X509Certificate x = new X509Certificate (cert1); - X509SecurityToken xst = new X509SecurityToken (x); - xst.GetXml (null); - } - - [Test] - public void LoadXml () - { - X509Certificate x = new X509Certificate (cert2); - X509SecurityToken xst = new X509SecurityToken (x); - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - xst.LoadXml (doc.DocumentElement); - CheckValueType (xst); - AssertEquals ("Same cert", BitConverter.ToString (cert1), BitConverter.ToString (xst.RawData)); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void LoadXmlNull () - { - X509Certificate x = new X509Certificate (cert1); - X509SecurityToken xst = new X509SecurityToken (x); - xst.LoadXml (null); - } - - [Test] - public void AuthenticationKey () - { - X509Certificate x = new X509Certificate (cert1); - X509SecurityToken xst = new X509SecurityToken (x); - AssertNotNull ("Certificate1.AuthenticationKey", xst.AuthenticationKey); - Assert ("X509Certificate.SupportsDigitalSignature", x.SupportsDigitalSignature); - } - - [Test] - [ExpectedException (typeof (InvalidOperationException))] - public void NullCertificateAuthenticationKey () - { - X509Certificate x = new X509Certificate (cert1); - X509SecurityToken xst = new X509SecurityToken (x); - xst.Certificate = null; - AssertNotNull ("(Certificate==null).AuthenticationKey", xst.AuthenticationKey); - } - - [Test] - [Ignore ("need to complete X509Store")] - public void DecryptionKey () - { - // TODO with a certificate associated with a private key - } - - [Test] - [ExpectedException (typeof (InvalidOperationException))] - public void NullCertificateDecryptionKey () - { - X509Certificate x = new X509Certificate (cert1); - X509SecurityToken xst = new X509SecurityToken (x); - xst.Certificate = null; - AssertNotNull ("(Certificate==null).DecryptionKey", xst.DecryptionKey); - } - - [Test] - [ExpectedException (typeof (Win32Exception))] - public void CertificateWithoutPrivateKeyDecryptionKey () - { - X509Certificate x = new X509Certificate (cert2); - X509SecurityToken xst = new X509SecurityToken (x); - AssertNotNull ("Certificate2.DecryptionKey", xst.DecryptionKey); - Assert ("X509Certificate.SupportsDataEncryption", x.SupportsDataEncryption); - } - - [Test] - public void EncryptionKey () - { - X509Certificate x = new X509Certificate (cert1); - X509SecurityToken xst = new X509SecurityToken (x); - AssertNotNull ("Certificate1.EncryptionKey", xst.EncryptionKey); - Assert ("X509Certificate.SupportsDataEncryption", x.SupportsDataEncryption); - } - - [Test] - [ExpectedException (typeof (InvalidOperationException))] - public void NullCertificateEncryptionKey () - { - X509Certificate x = new X509Certificate (cert1); - X509SecurityToken xst = new X509SecurityToken (x); - xst.Certificate = null; - AssertNotNull ("(Certificate==null).EncryptionKey", xst.EncryptionKey); - } - - [Test] - public void RawData () - { - X509Certificate x = new X509Certificate (cert1); - X509SecurityToken xst = new X509SecurityToken (x); - AssertEquals ("RawData1", BitConverter.ToString (cert1), BitConverter.ToString (xst.RawData)); - // kind of indirect null - xst.Certificate = null; - AssertNull ("(Certificate==null).RawData", xst.RawData); - xst.RawData = cert1; - AssertEquals ("RawData2", BitConverter.ToString (cert1), BitConverter.ToString (xst.RawData)); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void RawDataNull () - { - X509Certificate x = new X509Certificate (cert1); - X509SecurityToken xst = new X509SecurityToken (x); - xst.RawData = null; - } - - [Test] - [Ignore ("need to complete X509Store")] - public void SignatureKey () - { - // TODO with a certificate associated with a private key - } - - [Test] - [ExpectedException (typeof (InvalidOperationException))] - public void NullCertificateSignatureKey () - { - X509Certificate x = new X509Certificate (cert1); - X509SecurityToken xst = new X509SecurityToken (x); - xst.Certificate = null; - AssertNotNull ("(Certificate==null).SignatureKey", xst.SignatureKey); - } - - [Test] - [ExpectedException (typeof (Win32Exception))] - public void CertificateWithoutPrivateKeySignatureKey () - { - X509Certificate x = new X509Certificate (cert2); - X509SecurityToken xst = new X509SecurityToken (x); - AssertNotNull ("Certificate2.SignatureKey", xst.SignatureKey); - Assert ("X509Certificate.SupportsDigitalSignature", x.SupportsDigitalSignature); - } - - [Test] - public void SupportsDataEncryption () - { - X509Certificate x = new X509Certificate (cert1); - X509SecurityToken xst = new X509SecurityToken (x); - Assert ("SupportsDataEncryption", xst.SupportsDataEncryption); - } - - [Test] - [ExpectedException (typeof (InvalidOperationException))] - public void NullCertificateSupportsDataEncryption () - { - X509Certificate x = new X509Certificate (cert1); - X509SecurityToken xst = new X509SecurityToken (x); - xst.Certificate = null; - Assert ("(Certificate==null).SupportsDataEncryption", xst.SupportsDataEncryption); - } - - [Test] - public void SupportsDigitalSignature () - { - X509Certificate x = new X509Certificate (cert1); - X509SecurityToken xst = new X509SecurityToken (x); - Assert ("SupportsDigitalSignature", xst.SupportsDigitalSignature); - } - - [Test] - [ExpectedException (typeof (InvalidOperationException))] - public void NullCertificateSupportsDigitalSignature () - { - X509Certificate x = new X509Certificate (cert1); - X509SecurityToken xst = new X509SecurityToken (x); - xst.Certificate = null; - Assert ("(Certificate==null).SupportsDigitalSignature", xst.SupportsDigitalSignature); - } - - [Test] - public void NullCertificateValueType () - { - X509Certificate x = new X509Certificate (cert1); - X509SecurityToken xst = new X509SecurityToken (x); - // is ValueType related to certificate presence ? - xst.Certificate = null; - CheckValueType (xst); - } - - [Test] - public void ValueType () - { - X509Certificate x = new X509Certificate (cert1); - X509SecurityToken xst = new X509SecurityToken (x); - XmlQualifiedName qn = new XmlQualifiedName ("X509v3", WSSecurity.NamespaceURI); - xst.ValueType = qn; - } - - [Test] - [ExpectedException (typeof (SecurityFormatException))] - public void ValueTypeInvalidName () - { - X509Certificate x = new X509Certificate (cert1); - X509SecurityToken xst = new X509SecurityToken (x); - XmlQualifiedName qn = new XmlQualifiedName ("?", WSSecurity.NamespaceURI); - xst.ValueType = qn; - } - - [Test] - [ExpectedException (typeof (SecurityFormatException))] - public void ValueTypeInvalidNamespace () - { - X509Certificate x = new X509Certificate (cert1); - X509SecurityToken xst = new X509SecurityToken (x); - XmlQualifiedName qn = new XmlQualifiedName ("X509v3", "?"); - xst.ValueType = qn; - } - - [Test] - [Ignore ("strangely MS code signing cert seems invalid - need another candidate")] - public void Verify () - { - X509Certificate x = new X509Certificate (null); - X509SecurityToken xst = new X509SecurityToken (x); - xst.Verify (); - // ok if not exception is thrown - } - - [Test] - // [ExpectedException (typeof (SecurityFault))] SecurityFault is internal - public void VerifyNullCertificate () - { - X509Certificate x = new X509Certificate (cert1); - X509SecurityToken xst = new X509SecurityToken (x); - xst.Certificate = null; - try { - xst.Verify (); - } - catch (Exception e) { - if (!e.ToString ().StartsWith ("Microsoft.Web.Services.Security.SecurityFault")) - Fail ("expected SecurityFault"); - } - } - - [Test] - // [ExpectedException (typeof (SecurityFault))] SecurityFault is internal - public void VerifyCertificateNotCurrent () - { - X509Certificate x = new X509Certificate (cert2); - X509SecurityToken xst = new X509SecurityToken (x); - try { - xst.Verify (); - } - catch (Exception e) { - if (!e.ToString ().StartsWith ("Microsoft.Web.Services.Security.SecurityFault")) - Fail ("expected SecurityFault"); - } - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/XmlEncryptionTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/XmlEncryptionTest.cs deleted file mode 100644 index 1ee26686ce2..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/XmlEncryptionTest.cs +++ /dev/null @@ -1,122 +0,0 @@ -// -// XmlEncryptionTest.cs - NUnit Test Cases for XmlEncryption -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Security; -using System; - -namespace MonoTests.MS.Web.Services.Security { - - [TestFixture] - public class XmlEncryptionTest : Assertion { - - [Test] - public void Constructor () - { - XmlEncryption xe = new XmlEncryption (); - AssertNotNull ("Constructor", xe); - } - - [Test] - public void PublicConstStrings () - { - AssertEquals ("NamespaceURI", "http://www.w3.org/2001/04/xmlenc#", XmlEncryption.NamespaceURI); - AssertEquals ("Prefix", "xenc", XmlEncryption.Prefix); - } - - [Test] - public void AlgorithmURIConstructor () - { - // test constructor - XmlEncryption.AlgorithmURI xeau = new XmlEncryption.AlgorithmURI (); - AssertNotNull ("AlgorithmURI Constructor", xeau); - } - - [Test] - public void AlgorithmURI () - { - AssertEquals ("AES128", "http://www.w3.org/2001/04/xmlenc#aes128-cbc", XmlEncryption.AlgorithmURI.AES128); - AssertEquals ("AES128KeyWrap", "http://www.w3.org/2001/04/xmlenc#kw-aes128", XmlEncryption.AlgorithmURI.AES128KeyWrap); - AssertEquals ("AES192", "http://www.w3.org/2001/04/xmlenc#aes192-cbc", XmlEncryption.AlgorithmURI.AES192); - AssertEquals ("AES192KeyWrap", "http://www.w3.org/2001/04/xmlenc#kw-aes192", XmlEncryption.AlgorithmURI.AES192KeyWrap); - AssertEquals ("AES256", "http://www.w3.org/2001/04/xmlenc#aes256-cbc", XmlEncryption.AlgorithmURI.AES256); - AssertEquals ("AES256KeyWrap", "http://www.w3.org/2001/04/xmlenc#kw-aes256", XmlEncryption.AlgorithmURI.AES256KeyWrap); - AssertEquals ("DES", "http://www.w3.org/2001/04/xmlenc#des-cbc", XmlEncryption.AlgorithmURI.DES); - AssertEquals ("RSA15", "http://www.w3.org/2001/04/xmlenc#rsa-1_5", XmlEncryption.AlgorithmURI.RSA15); - AssertEquals ("RSAOAEP", "http://www.w3.org/2001/04/xmlenc#rsa-aoep-mgf1pl", XmlEncryption.AlgorithmURI.RSAOAEP); - AssertEquals ("SHA1", "http://www.w3.org/2000/09/xmldsig#sha1", XmlEncryption.AlgorithmURI.SHA1); - AssertEquals ("SHA256", "http://www.w3.org/2001/04/xmlenc#sha256", XmlEncryption.AlgorithmURI.SHA256); - AssertEquals ("SHA512", "http://www.w3.org/2001/04/xmlenc#sha512", XmlEncryption.AlgorithmURI.SHA512); - AssertEquals ("TripleDES", "http://www.w3.org/2001/04/xmlenc#tripledes-cbc", XmlEncryption.AlgorithmURI.TripleDES); - AssertEquals ("TripleDESKeyWrap", "http://www.w3.org/2001/04/xmlenc#kw-tripledes", XmlEncryption.AlgorithmURI.TripleDESKeyWrap); - } - - [Test] - public void AttributeNamesConstructor () - { - // test constructor - XmlEncryption.AttributeNames xean = new XmlEncryption.AttributeNames (); - AssertNotNull ("AttributeNames Constructor", xean); - } - - [Test] - public void AttributeNames () - { - AssertEquals ("Algorithm ", "Algorithm", XmlEncryption.AttributeNames.Algorithm); - // LAMESPEC AssertEquals ("EncodingType", "EncodingType", XmlEncryption.AttributeNames.EncodingType); - AssertEquals ("Id", "Id", XmlEncryption.AttributeNames.Id); - // LAMESPEC AssertEquals ("IdentifierType", "IdentifierType", XmlEncryption.AttributeNames.IdentifierType); - // LAMESPEC AssertEquals ("TokenType", "TokenType", XmlEncryption.AttributeNames.TokenType); - AssertEquals ("Type", "Type", XmlEncryption.AttributeNames.Type); - // LAMESPEC AssertEquals ("Uri", "Uri", XmlEncryption.AttributeNames.Uri); - AssertEquals ("URI", "URI", XmlEncryption.AttributeNames.URI); - // LAMESPEC AssertEquals ("ValueType", "ValueType", XmlEncryption.AttributeNames.ValueType); - } - - // LAMESPEC ElementNames aren't documented - [Test] - public void ElementNamesConstructor () - { - // test constructor - XmlEncryption.ElementNames xeen = new XmlEncryption.ElementNames (); - AssertNotNull ("ElementNames Constructor", xeen); - } - - // LAMESPEC ElementNames aren't documented - [Test] - public void ElementNames () - { - // test public const strings - AssertEquals ("CipherData", "CipherData", XmlEncryption.ElementNames.CipherData); - AssertEquals ("CipherValue", "CipherValue", XmlEncryption.ElementNames.CipherValue); - AssertEquals ("DataReference", "DataReference", XmlEncryption.ElementNames.DataReference); - AssertEquals ("EncryptedData", "EncryptedData", XmlEncryption.ElementNames.EncryptedData); - AssertEquals ("EncryptedKey", "EncryptedKey", XmlEncryption.ElementNames.EncryptedKey); - AssertEquals ("EncryptionMethod", "EncryptionMethod", XmlEncryption.ElementNames.EncryptionMethod); - AssertEquals ("ReferenceList", "ReferenceList", XmlEncryption.ElementNames.ReferenceList); - } - - [Test] - public void TypeURIConstructor () - { - // test constructor - XmlEncryption.TypeURI xetu = new XmlEncryption.TypeURI (); - AssertNotNull ("TypeURI Constructor", xetu); - } - - [Test] - public void TypeURI () - { - // test public const strings - AssertEquals ("Content", "http://www.w3.org/2001/04/xmlenc#Content", XmlEncryption.TypeURI.Content); - AssertEquals ("Element", "http://www.w3.org/2001/04/xmlenc#Element", XmlEncryption.TypeURI.Element); - AssertEquals ("EncryptedKey", "http://www.w3.org/2001/04/xmlenc#EncryptedKey", XmlEncryption.TypeURI.EncryptedKey); - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/XmlSignatureTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/XmlSignatureTest.cs deleted file mode 100644 index 4041dad9644..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/XmlSignatureTest.cs +++ /dev/null @@ -1,66 +0,0 @@ -// -// XmlSignatureTest.cs - NUnit Test Cases for XmlSignature -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Security; -using System; - -namespace MonoTests.MS.Web.Services.Security { - - [TestFixture] - public class XmlSignatureTest : Assertion { - - [Test] - public void Constructor () - { - XmlSignature xs = new XmlSignature (); - AssertNotNull ("Constructor", xs); - } - - [Test] - public void PublicConstStrings () - { - AssertEquals ("NamespaceURI", "http://www.w3.org/2000/09/xmldsig#", XmlSignature.NamespaceURI); - AssertEquals ("Prefix", "ds", XmlSignature.Prefix); - } - - [Test] - public void ElementNamesConstructor () - { - // test constructor - XmlSignature.ElementNames xsen = new XmlSignature.ElementNames (); - AssertNotNull ("ElementNames Constructor", xsen); - } - - [Test] - public void ElementNames () - { - // test public const strings - // LAMESPEC: AssertEquals ("BinarySecurityToken", "BinarySecurityToken", XmlSignature.ElementNames.BinarySecurityToken); - // LAMESPEC: AssertEquals ("CipherData", "CipherData", XmlSignature.ElementNames.CipherData); - // LAMESPEC: AssertEquals ("CipherValue", "CipherValue", XmlSignature.ElementNames.CipherValue); - // LAMESPEC: AssertEquals ("DataReference", "DataReference", XmlSignature.ElementNames.DataReference); - // LAMESPEC: AssertEquals ("EncryptedData", "EncryptedData", XmlSignature.ElementNames.EncryptedData); - // LAMESPEC: AssertEquals ("EncryptedKey", "EncryptedKey", XmlSignature.ElementNames.EncryptedKey); - // LAMESPEC: AssertEquals ("EncryptionMethod", "EncryptionMethod", XmlSignature.ElementNames.EncryptionMethod); - // LAMESPEC: AssertEquals ("KeyIdentifier", "KeyIdentifier", XmlSignature.ElementNames.KeyIdentifier); - AssertEquals ("KeyInfo", "KeyInfo", XmlSignature.ElementNames.KeyInfo); - AssertEquals ("KeyName", "KeyName", XmlSignature.ElementNames.KeyName); - // LAMESPEC: AssertEquals ("Nonce", "Nonce", XmlSignature.ElementNames.Nonce); - // LAMESPEC: AssertEquals ("Password", "Password", XmlSignature.ElementNames.Password); - // LAMESPEC: AssertEquals ("Reference", "Reference", XmlSignature.ElementNames.Reference); - // LAMESPEC: AssertEquals ("ReferenceList", "ReferenceList", XmlSignature.ElementNames.ReferenceList); - // LAMESPEC: AssertEquals ("Security", "Security", XmlSignature.ElementNames.Security); - // LAMESPEC: AssertEquals ("SecurityTokenReference", "SecurityTokenReference", XmlSignature.ElementNames.SecurityTokenReference); - AssertEquals ("Signature", "Signature", XmlSignature.ElementNames.Signature); - // LAMESPEC: AssertEquals ("Username", "Username", XmlSignature.ElementNames.Username); - // LAMESPEC: AssertEquals ("UsernameToken", "UsernameToken", XmlSignature.ElementNames.UsernameToken); - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/XmltokTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/XmltokTest.cs deleted file mode 100644 index 65ffcc34657..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/XmltokTest.cs +++ /dev/null @@ -1,34 +0,0 @@ -// -// XmltokTest.cs - NUnit Test Cases for Xmltok -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Security; -using System; - -namespace MonoTests.MS.Web.Services.Security { - - [TestFixture] - public class XmltokTest : Assertion { - - [Test] - public void Constructor () - { - Xmltok x = new Xmltok (); - AssertNotNull ("Constructor", x); - } - - [Test] - public void PublicConstStrings () - { - AssertEquals ("NamespaceURI", "http://schemas.xmlsoap.org/ws/2002/08/xmltok", Xmltok.NamespaceURI); - // prefix not Prefix (like elsewhere) - AssertEquals ("Prefix", "tok", Xmltok.prefix); - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/XrMLTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/XrMLTest.cs deleted file mode 100644 index 5a3c211b8eb..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Security/XrMLTest.cs +++ /dev/null @@ -1,63 +0,0 @@ -// -// XrMLTest.cs - NUnit Test Cases for XrML -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Security; -using System; - -namespace MonoTests.MS.Web.Services.Security { - - [TestFixture] - public class XrMLTest : Assertion { - - [Test] - public void Constructor () - { - XrML x = new XrML (); - AssertNotNull ("Constructor", x); - } - - [Test] - public void PublicConstStrings () - { - AssertEquals ("NamespaceURI", "urn:oasis:names:tc:WSS:1.0:bindings:WSS-XrML-binding", XrML.NamespaceURI); - AssertEquals ("Prefix", "xrml", XrML.Prefix); - } - - [Test] - public void AttributeNamesConstructor () - { - // test constructor - XrML.AttributeNames xan = new XrML.AttributeNames (); - AssertNotNull ("AttributeNames Constructor", xan); - } - - [Test] - public void AttributeNames () - { - // test public const strings - AssertEquals ("RefType", "RefType", XrML.AttributeNames.RefType); - } - - [Test] - public void ElementNamesConstructor () - { - // test constructor - XrML.ElementNames xen = new XrML.ElementNames (); - AssertNotNull ("ElementNames Constructor", xen); - } - - [Test] - public void ElementNames () - { - // test public const strings - AssertEquals ("License", "license", XrML.ElementNames.License); - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Timestamp/AllTests.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Timestamp/AllTests.cs deleted file mode 100644 index 7a5e496864e..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Timestamp/AllTests.cs +++ /dev/null @@ -1,34 +0,0 @@ -// -// MonoTests.MS.Web.Services.Timestamp.AllTests.cs -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using Microsoft.Web.Services.Timestamp; -using NUnit.Framework; - -// note: due to compiler confusion between classes and namespace (like Timestamp) -// I renamed the test namespace from "MonoTests.Microsoft.Web.Services.Timestamp" -// to "MonoTests.MS.Web.Services.Timestamp". -namespace MonoTests.MS.Web.Services.Timestamp { - - public class AllTests { - - // some missing overloads for the tests - - public static void AssertEquals (string message, DateTime expected, DateTime actual) - { - // Format before compare (Timestamp doesn't have a good resolution) - Assertion.Assert (message, (expected.ToString (WSTimestamp.TimeFormat) == actual.ToString (WSTimestamp.TimeFormat))); - } - - public static void AssertEquals (string message, long expected, long actual) - { - Assertion.Assert (message, (expected == actual)); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Timestamp/ChangeLog b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Timestamp/ChangeLog deleted file mode 100644 index 926132678f3..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Timestamp/ChangeLog +++ /dev/null @@ -1,10 +0,0 @@ -2003-09-14 Sebastien Pouliot - - * AllTests.cs: New. Common methods to compare DateTimes and longs. - * ReceivedCollectionTest.cs: New. Unit tests for ReceivedCollection. - * ReceivedTest.cs: New. Unit test for Received. - * TimestampFormatExceptionTest.cs: Unit test for TimestampFormatException. - * TimestampInputFilterTest.cs: Unit test for TimestampInputFilter. - * TimestampOutputFilterTest.cs: Unit test for TimestampOutputFilter. - * TimestampTest.cs: Unit test for Timestamp. - * WSTimestampTest.cs: Unit test for WSTimestamp. diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Timestamp/ReceivedCollectionTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Timestamp/ReceivedCollectionTest.cs deleted file mode 100644 index 09dafc3b943..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Timestamp/ReceivedCollectionTest.cs +++ /dev/null @@ -1,85 +0,0 @@ -// -// ReceivedCollectionTest.cs - NUnit Test Cases for ReceivedCollection -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Timestamp; -using System; -using System.Xml; - -// note: due to compiler confusion between classes and namespace (like Timestamp) -// I renamed the test namespace from "MonoTests.Microsoft.Web.Services.Timestamp" -// to "MonoTests.MS.Web.Services.Timestamp". -namespace MonoTests.MS.Web.Services.Timestamp { - - [TestFixture] - public class ReceivedCollectionTest : Assertion { - - private ReceivedCollection coll; - - [SetUp] - void SetUp () - { - coll = new ReceivedCollection (); - } - - [Test] - public void Empty () - { - AssertEquals ("Empty: Count = 0", 0, coll.Count); - AssertNotNull ("Enumerator", coll.GetEnumerator ()); - } - - [Test] - [ExpectedException (typeof (ArgumentOutOfRangeException))] - public void EmptyAccess () - { - Received r = coll[0]; - } - - [Test] - public void Add () - { - Received r = new Received (new Uri ("http://www.go-mono.com/")); - coll.Add (r); - AssertEquals ("Add: Count = 1", 1, coll.Count); - Assert ("Contains 1", coll.Contains (r)); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void AddNull () - { - Received r = null; - coll.Add (r); - } - - [Test] - public void CopyTo () - { - Received r = new Received (new Uri ("http://www.go-mono.com/")); - coll.Add (r); - - object[] container = new object [3]; - coll.CopyTo (container, 0); - AssertNotNull ("CopyTo[0]", container[0]); - AssertNull ("CopyTo[1]", container[1]); - AssertNull ("CopyTo[2]", container[2]); - - coll.Remove (r); - AssertEquals ("Remove: Count = 0", 0, coll.Count); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void CopyToException () - { - coll.CopyTo (null, 0); - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Timestamp/ReceivedTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Timestamp/ReceivedTest.cs deleted file mode 100644 index 7bec2c7987e..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Timestamp/ReceivedTest.cs +++ /dev/null @@ -1,135 +0,0 @@ -// -// ReceivedTest.cs - NUnit Test Cases for Received -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Timestamp; -using System; -using System.Xml; - -// note: due to compiler confusion between classes and namespace (like Timestamp) -// I renamed the test namespace from "MonoTests.Microsoft.Web.Services.Timestamp" -// to "MonoTests.MS.Web.Services.Timestamp". -namespace MonoTests.MS.Web.Services.Timestamp { - - [TestFixture] - public class ReceivedTest : Assertion { - - [Test] - public void Constructor_Uri () - { - Uri uri = new Uri ("http://www.go-mono.com/"); - Received recv = new Received (uri); - AssertNotNull ("Received (uri)", recv); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void Constructor_UriNull () - { - Uri nullUri = null; - Received recv = new Received (nullUri); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void Constructor_XmlElementNull () - { - XmlElement nullXml = null; - Received recv = new Received (nullXml); - } - - [Test] - public void Properties () - { - string actor = "http://www.go-mono.com/"; - Uri uri = new Uri (actor); - Received recv = new Received (uri); - - AssertEquals ("Actor", actor, recv.Actor.AbsoluteUri); - // compare longs not objects !!! - AllTests.AssertEquals ("Delay", 0, recv.Delay); - // we dont check default value because it's UtcNow (too late ;-) - DateTime testDate = DateTime.FromFileTime (0xDEADC0DE); // 12/31/1600 - recv.Value = testDate; - AssertEquals ("Value", testDate, recv.Value); - } - - [Test] - public void Roundtrips () - { - string actor = "http://www.go-mono.com/"; - Uri uri = new Uri (actor); - Received recv = new Received (uri); - recv.Value = DateTime.FromFileTime (0xDEADC0DE); // 12/31/1600 - - XmlDocument doc = new XmlDocument (); - XmlElement xel = recv.GetXml (doc); - Assertion.AssertEquals ("Xml", "1600-12-31T19:06:13Z", xel.OuterXml); - - try { - Received recv2 = new Received (xel); - Assertion.Fail ("Expected TimestampFormatException but got none"); - } - catch (TimestampFormatException e) { - // not logical but as documented - if (e.Message != TimestampFormatException.MissingActorAttributeInReceivedElement) - Assertion.Fail ("Invalid TimestampFormatException.Message -> MissingActorAttributeInReceivedElement"); - } - catch (Exception e) { - Assertion.Fail ("Expected TimestampFormatException but got: " + e.ToString ()); - } - - try { - Received recv3 = new Received (uri); - recv3.LoadXml (xel); - Assertion.Fail ("Expected TimestampFormatException but got none"); - } - catch (TimestampFormatException e) { - // not logical but as documented - if (e.Message != TimestampFormatException.MissingActorAttributeInReceivedElement) - Assertion.Fail ("Invalid TimestampFormatException.Message -> MissingActorAttributeInReceivedElement"); - } - catch (Exception e) { - Assertion.Fail ("Expected TimestampFormatException but got: " + e.ToString ()); - } - } - - public void TestDelay () - { - string actor = "http://www.go-mono.com/"; - Uri uri = new Uri (actor); - Received recv = new Received (uri); - recv.Delay = 60; - recv.Value = DateTime.FromFileTime (0xDEADC0DE); // 12/31/1600 - - XmlDocument doc = new XmlDocument (); - XmlElement xel = recv.GetXml (doc); - // Actor isn't present - AssertEquals ("Xml", "1600-12-31T19:06:13Z", xel.OuterXml); - - string xml = "1600-12-31T19:06:13Z"; - doc.LoadXml (xml); - - // FIXME: Shouldn't need this - Bug in WSE ? - xel.SetAttribute (WSTimestamp.AttributeNames.Actor, actor); - Received recv2 = new Received (xel); - AssertEquals ("Actor", recv.Actor.AbsoluteUri, recv2.Actor.AbsoluteUri); - AssertEquals ("Delay", recv.Delay, recv2.Delay); - // compare DateTime not objects !!! - AllTests.AssertEquals ("Value", recv.Value, recv2.Value); - - Received recv3 = new Received (uri); - recv3.LoadXml (doc.DocumentElement); - AssertEquals ("Actor", recv.Actor.AbsoluteUri, recv3.Actor.AbsoluteUri); - AssertEquals ("Delay", recv.Delay, recv3.Delay); - // compare DateTime not objects !!! - AllTests.AssertEquals ("Value", recv.Value, recv3.Value); - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Timestamp/TimestampFormatExceptionTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Timestamp/TimestampFormatExceptionTest.cs deleted file mode 100644 index c1b59546a83..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Timestamp/TimestampFormatExceptionTest.cs +++ /dev/null @@ -1,31 +0,0 @@ -// -// TimestampFormatExceptionTest.cs - NUnit Test Cases for TimestampFormatException -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Timestamp; -using System; -using System.Xml; - -// note: due to compiler confusion between classes and namespace (like Timestamp) -// I renamed the test namespace from "MonoTests.Microsoft.Web.Services.Timestamp" -// to "MonoTests.MS.Web.Services.Timestamp". -namespace MonoTests.MS.Web.Services.Timestamp { - - [TestFixture] - public class TimestampFormatExceptionTest : Assertion { - - [Test] - public void Constructor () - { - string msg = "message"; - TimestampFormatException e = new TimestampFormatException (msg); - AssertEquals ("Message", msg, e.Message); - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Timestamp/TimestampInputFilterTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Timestamp/TimestampInputFilterTest.cs deleted file mode 100644 index 2242d138def..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Timestamp/TimestampInputFilterTest.cs +++ /dev/null @@ -1,84 +0,0 @@ -// -// TimestampInputFilterTest.cs - NUnit Test Cases for TimestampInputFilter -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services; -using Microsoft.Web.Services.Timestamp; -using System; -using System.Web.Services.Protocols; -using System.Xml; - -// note: due to compiler confusion between classes and namespace (like Timestamp) -// I renamed the test namespace from "MonoTests.Microsoft.Web.Services.Timestamp" -// to "MonoTests.MS.Web.Services.Timestamp". -namespace MonoTests.MS.Web.Services.Timestamp { - - // Reference: - // 1. Inside the Web Services Enhancements Pipeline - // http://msdn.microsoft.com/library/en-us/dnwebsrv/html/insidewsepipe.asp - - [TestFixture] - public class TimestampInputFilterTest : Assertion { - - static string soapMinimal = ""; - static string soapExpiredEnvelope = "2002-11-14T19:03:27Z2002-11-14T19:08:27Z"; - static string soapTimestampEnvelope = "2002-11-14T19:03:27Z2020-11-14T19:08:27Z"; - - [Test] - public void NoTimestamp () - { - SoapEnvelope env = new SoapEnvelope (); - env.LoadXml (soapMinimal); - - TimestampInputFilter tsInput = new TimestampInputFilter (); - tsInput.ProcessMessage (env); - AssertEquals ("Envelope", soapMinimal, env.Envelope.OuterXml); - AllTests.AssertEquals ("Created", DateTime.MinValue, env.Context.Timestamp.Created); - AllTests.AssertEquals ("Expires", DateTime.MaxValue, env.Context.Timestamp.Expires); - } - - [Test] - public void ExpiredMessage () - { - SoapEnvelope env = new SoapEnvelope (); - env.LoadXml (soapExpiredEnvelope); - - TimestampInputFilter tsInput = new TimestampInputFilter (); - try { - tsInput.ProcessMessage (env); - Fail ("Expected TimestampFault but got none"); - } - catch (SoapHeaderException she) { - // TimestampFault isn't public so we catch it's ancestor - if (she.ToString ().StartsWith ("Microsoft.Web.Services.Timestamp.TimestampFault")) { - // this is expected - } - else - Fail ("Expected TimestampFault but got " + she.ToString ()); - } - catch (Exception e) { - Fail ("Expected TimestampFault but got " + e.ToString ()); - } - } - - [Test] - public void ValidMessage () - { - SoapEnvelope env = new SoapEnvelope (); - // valid until 2020 - env.LoadXml (soapTimestampEnvelope); - - TimestampInputFilter tsInput = new TimestampInputFilter (); - tsInput.ProcessMessage (env); - AssertEquals ("Envelope", "", env.Envelope.OuterXml); - AssertEquals ("Created", "2002-11-14T19:03:27Z", env.Context.Timestamp.Created.ToString (WSTimestamp.TimeFormat)); - AssertEquals ("Expires", "2020-11-14T19:08:27Z", env.Context.Timestamp.Expires.ToString (WSTimestamp.TimeFormat)); - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Timestamp/TimestampOutputFilterTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Timestamp/TimestampOutputFilterTest.cs deleted file mode 100644 index 46b662bb3f2..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Timestamp/TimestampOutputFilterTest.cs +++ /dev/null @@ -1,66 +0,0 @@ -// -// TimestampOutputFilterTest.cs - NUnit Test Cases for TimestampOutputFilter -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services; -using Microsoft.Web.Services.Timestamp; -using System; -using System.Web.Services.Protocols; -using System.Xml; - -// note: due to compiler confusion between classes and namespace (like Timestamp) -// I renamed the test namespace from "MonoTests.Microsoft.Web.Services.Timestamp" -// to "MonoTests.MS.Web.Services.Timestamp". -namespace MonoTests.MS.Web.Services.Timestamp { - - // Reference: - // 1. Inside the Web Services Enhancements Pipeline - // http://msdn.microsoft.com/library/en-us/dnwebsrv/html/insidewsepipe.asp - - [TestFixture] - public class TimestampOutputFilterTest : Assertion { - - [Test] - public void TimestampWithoutHeader () - { - SoapEnvelope env = new SoapEnvelope (); - XmlElement body = env.CreateBody (); - env.Envelope.AppendChild (body); - - string xml = env.Envelope.OuterXml; - Assert ("Envelope.Header", xml.IndexOf ("") < 0); - - TimestampOutputFilter tsOutput = new TimestampOutputFilter (); - tsOutput.ProcessMessage (env); - xml = env.Envelope.OuterXml; - Assert ("Envelope.Header", xml.IndexOf ("") > 0); - - // not static - more difficult to check - Assert ("Envelope.Timestamp.Created", xml.IndexOf ("") > 0); - Assert ("Envelope.Timestamp.Expired", xml.IndexOf ("") > 0); - } - - [Test] - public void TimestampWithHeader () - { - SoapEnvelope env = new SoapEnvelope (); - XmlElement header = env.CreateHeader (); - env.Envelope.AppendChild (header); - XmlElement body = env.CreateBody (); - env.Envelope.AppendChild (body); - - TimestampOutputFilter tsOutput = new TimestampOutputFilter (); - tsOutput.ProcessMessage (env); - // not static - more difficult to check - string xml = env.Envelope.OuterXml; - Assert ("Envelope.Timestamp.Created", xml.IndexOf ("") > 0); - Assert ("Envelope.Timestamp.Expired", xml.IndexOf ("") > 0); - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Timestamp/TimestampTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Timestamp/TimestampTest.cs deleted file mode 100644 index 27ca423edd9..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Timestamp/TimestampTest.cs +++ /dev/null @@ -1,204 +0,0 @@ -// -// TimestampTest.cs - NUnit Test Cases for Timestamp -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Timestamp; -using System; -using System.Xml; - -// note: due to compiler confusion between classes and namespace (like Timestamp) -// I renamed the test namespace from "MonoTests.Microsoft.Web.Services.Timestamp" -// to "MonoTests.MS.Web.Services.Timestamp". -namespace MonoTests.MS.Web.Services.Timestamp { - - [TestFixture] - public class TimestampTest : Assertion { - - // compiler conflict between namespace Timestamp and class Timestamp - private Microsoft.Web.Services.Timestamp.Timestamp ts; - - private static string empty = ""; - private static string test1 = "2001-09-13T08:42:00Z2001-10-13T09:00:00Z"; - private static string test2 = "2001-09-13T08:42:00Z2001-10-13T09:00:00Z2001-09-13T08:44:00Z"; - private static string test3 = "2001-09-13T08:42:00Z2001-10-13T09:00:00Z2001-09-13T08:44:00Z"; - private static string test4 = "2001-09-13T08:42:00Z2001-10-13T09:00:00Z2001-09-13T08:44:00Z"; - - [SetUp] - void SetUp () - { - ts = new Microsoft.Web.Services.Timestamp.Timestamp (); - } - - [Test] - public void Properties () - { - // test values - DateTime testTime = DateTime.UtcNow; - long testTTL = 1; - // default values - AssertEquals ("Created (default)", DateTime.MinValue, ts.Created); - AssertEquals ("Expires (default)", DateTime.MaxValue, ts.Expires); - AllTests.AssertEquals ("TTL (default)", 300000, ts.Ttl); - // new ttl values - ts.Ttl = testTTL; - AllTests.AssertEquals ("TTL (test)", 1, ts.Ttl); - ts.Ttl = 0; - AllTests.AssertEquals ("TTL (0)", 0, ts.Ttl); - AssertEquals ("Expires (0)", DateTime.MaxValue, ts.Expires); - AssertNotNull ("Receivers", ts.Receivers); - AssertEquals ("Receivers.Count", 0, ts.Receivers.Count); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void Ttl_Negative () - { - ts.Ttl = -1; - } - - [Test] - [ExpectedException (typeof (TimestampFormatException))] - public void CheckInvalid () - { - // default object is incomplete - ts.CheckValid (); - } - - // Note: All valid (no exception are thrown) but all EXPIRED ! - [Test] - public void CheckValid () - { - XmlDocument doc = new XmlDocument (); - doc.LoadXml (test1); - ts.LoadXml (doc.DocumentElement); - ts.CheckValid (); - - doc.LoadXml (test2); - ts.LoadXml (doc.DocumentElement); - ts.CheckValid (); - - doc.LoadXml (test3); - ts.LoadXml (doc.DocumentElement); - ts.CheckValid (); - - doc.LoadXml (test4); - ts.LoadXml (doc.DocumentElement); - ts.CheckValid (); - } - - [Test] - public void GetXml () - { - XmlDocument doc = new XmlDocument (); - XmlElement xel = ts.GetXml (doc); - // minimal XML - AssertEquals ("Xml", empty, xel.OuterXml); - - ts.Ttl = 60000; // one minute - xel = ts.GetXml (doc); - // TTL has no change in XML - AssertEquals ("Xml", empty, xel.OuterXml); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void LoadXml_Null () - { - ts.LoadXml (null); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void LoadXml_BadElement () - { - XmlDocument doc = new XmlDocument (); - // bad element (Timestamp case is invalid) - doc.LoadXml (""); - ts.LoadXml (doc.DocumentElement); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void LoadXml_BadNamespace () - { - XmlDocument doc = new XmlDocument (); - // bad namespace (invalid year in URL) - doc.LoadXml (""); - ts.LoadXml (doc.DocumentElement); - } - - // sample taken from http://msdn.microsoft.com/library/en-us/dnglobspec/html/ws-security.asp - [Test] - public void LoadXml () - { - XmlDocument doc = new XmlDocument (); - doc.LoadXml (test1); - ts.LoadXml (doc.DocumentElement); - - XmlElement xel = ts.GetXml (doc); - AssertEquals ("Xml", test1, xel.OuterXml); - AssertEquals ("Xml Actor", "", ts.Actor); - AssertEquals ("Xml Created", "2001-09-13T08:42:00Z", ts.Created.ToString (WSTimestamp.TimeFormat)); - AssertEquals ("Xml Expires", "2001-10-13T09:00:00Z", ts.Expires.ToString (WSTimestamp.TimeFormat)); - AssertEquals ("Xml Receivers.Count", 0, ts.Receivers.Count); - AllTests.AssertEquals ("Xml Ttl", 300000, ts.Ttl); - } - - // sample taken from http://msdn.microsoft.com/library/en-us/dnglobspec/html/ws-security.asp - [Test] - public void LoadXmlWithOneIntermediary () - { - XmlDocument doc = new XmlDocument (); - doc.LoadXml (test2); - ts.LoadXml (doc.DocumentElement); - - XmlElement xel = ts.GetXml (doc); - AssertEquals ("Xml", test2, xel.OuterXml); - AssertEquals ("Xml Actor", "", ts.Actor); // Actor is part of element - AssertEquals ("Xml Created", "2001-09-13T08:42:00Z", ts.Created.ToString (WSTimestamp.TimeFormat)); - AssertEquals ("Xml Expires", "2001-10-13T09:00:00Z", ts.Expires.ToString (WSTimestamp.TimeFormat)); - AssertEquals ("Xml Receivers.Count", 1, ts.Receivers.Count); - AllTests.AssertEquals ("Xml Ttl", 300000, ts.Ttl); - } - - // WSE supports wsu:Id for Created and Expires elements - [Test] - public void LoadXmlWithCreatedAndExpiresIds () - { - XmlDocument doc = new XmlDocument (); - doc.LoadXml (test3); - ts.LoadXml (doc.DocumentElement); - - XmlElement xel = ts.GetXml (doc); - AssertEquals ("Xml", test3, xel.OuterXml); - AssertEquals ("Xml Actor", "", ts.Actor); // Actor is part of element - AssertEquals ("Xml Created", "2001-09-13T08:42:00Z", ts.Created.ToString (WSTimestamp.TimeFormat)); - AssertEquals ("Xml Expires", "2001-10-13T09:00:00Z", ts.Expires.ToString (WSTimestamp.TimeFormat)); - AssertEquals ("Xml Receivers.Count", 1, ts.Receivers.Count); - AllTests.AssertEquals ("Xml Ttl", 300000, ts.Ttl); - } - - // WSE _doesn't_ support wsu:Id for Timestamp and Received elements - [Test] - public void LoadXmlWithAllIds () - { - XmlDocument doc = new XmlDocument (); - doc.LoadXml (test4); - ts.LoadXml (doc.DocumentElement); - - XmlElement xel = ts.GetXml (doc); - // FIXME (WSE) AssertEquals ("Xml", test4, xel.OuterXml); - AssertEquals ("Xml Actor", "", ts.Actor); // Actor is part of element - AssertEquals ("Xml Created", "2001-09-13T08:42:00Z", ts.Created.ToString (WSTimestamp.TimeFormat)); - AssertEquals ("Xml Expires", "2001-10-13T09:00:00Z", ts.Expires.ToString (WSTimestamp.TimeFormat)); - AssertEquals ("Xml Receivers.Count", 1, ts.Receivers.Count); - AllTests.AssertEquals ("Xml Ttl", 300000, ts.Ttl); - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Timestamp/WSTimestampTest.cs b/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Timestamp/WSTimestampTest.cs deleted file mode 100644 index 906b82d0f7a..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/Microsoft.Web.Services.Timestamp/WSTimestampTest.cs +++ /dev/null @@ -1,73 +0,0 @@ -// -// WSTimestampTest.cs - NUnit Test Cases for WSTimestamp -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using NUnit.Framework; -using Microsoft.Web.Services.Timestamp; -using System; - -// note: due to compiler confusion between classes and namespace (like Timestamp) -// I renamed the test namespace from "MonoTests.Microsoft.Web.Services.Timestamp" -// to "MonoTests.MS.Web.Services.Timestamp". -namespace MonoTests.MS.Web.Services.Timestamp { - - [TestFixture] - public class WSTimestampTest : Assertion { - - [Test] - public void Constructor () - { - WSTimestamp wsts = new WSTimestamp (); - AssertNotNull ("Constructor", wsts); - } - - [Test] - public void PublicConstStrings () - { - AssertEquals ("NamespaceURI", "http://schemas.xmlsoap.org/ws/2002/07/utility", WSTimestamp.NamespaceURI); - AssertEquals ("Prefix", "wsu", WSTimestamp.Prefix); - AssertEquals ("TimeFormat", "yyyy-MM-ddTHH:mm:ssZ", WSTimestamp.TimeFormat); - } - - [Test] - public void AttributeNamesConstructor () - { - // test constructor - WSTimestamp.AttributeNames an = new WSTimestamp.AttributeNames (); - AssertNotNull ("AttributeNames Constructor", an); - } - - [Test] - public void AttributeNames () - { - // test public const strings - AssertEquals ("Actor", "Actor", WSTimestamp.AttributeNames.Actor); - AssertEquals ("Delay", "Delay", WSTimestamp.AttributeNames.Delay); - AssertEquals ("Id", "Id", WSTimestamp.AttributeNames.Id); - AssertEquals ("ValueType", "ValueType", WSTimestamp.AttributeNames.ValueType); - } - - [Test] - public void ElementNamesConstructor () - { - // test constructor - WSTimestamp.ElementNames en = new WSTimestamp.ElementNames (); - AssertNotNull ("ElementNames Constructor", en); - } - - [Test] - public void ElementNames () - { - // test public const strings - AssertEquals ("Created", "Created", WSTimestamp.ElementNames.Created); - AssertEquals ("Expires", "Expires", WSTimestamp.ElementNames.Expires); - AssertEquals ("Received", "Received", WSTimestamp.ElementNames.Received); - AssertEquals ("Timestamp", "Timestamp", WSTimestamp.ElementNames.Timestamp); - } - } -} \ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Test/standalone/WSE2/Microsoft.Web.Services.Messaging/README b/mcs/class/Microsoft.Web.Services/Test/standalone/WSE2/Microsoft.Web.Services.Messaging/README deleted file mode 100644 index 4614f828705..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/standalone/WSE2/Microsoft.Web.Services.Messaging/README +++ /dev/null @@ -1,5 +0,0 @@ -These are some standalone tests that should be compiled with: - -mcs source.cs /r:Microsoft.Web.Services.dll - -You need be using WSE2 as the default. you can do this by make DEFAULT_WSE2=1 install from inside the Microsoft.Web.Services directory. diff --git a/mcs/class/Microsoft.Web.Services/Test/standalone/WSE2/Microsoft.Web.Services.Messaging/simple_soap.tcp_testmessage.cs b/mcs/class/Microsoft.Web.Services/Test/standalone/WSE2/Microsoft.Web.Services.Messaging/simple_soap.tcp_testmessage.cs deleted file mode 100644 index 8b905401ea5..00000000000 --- a/mcs/class/Microsoft.Web.Services/Test/standalone/WSE2/Microsoft.Web.Services.Messaging/simple_soap.tcp_testmessage.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Microsoft.Web.Services; -using Microsoft.Web.Services.Messaging; - -using System; -using System.Net; -using System.Threading; -using System.Xml; - -namespace Test -{ - - public class MessageDriver - { - public static void Main () - { - - Uri receiverUri = new Uri ("soap.tcp://localhost/math"); - MathSoapListener listener = new MathSoapListener (); - SoapReceivers.Add (receiverUri, listener); - - SoapEnvelope env = new SoapEnvelope (); - env.CreateBody (); - env.Body.InnerXml = "3366"; - env.Context.Action = "urn:math:add"; - SoapSender sender = new SoapSender (receiverUri); - sender.Send (env); - - Thread.Sleep (1000); - - } - - } - - public class MathSoapListener : SoapReceiver - { - - protected override void Receive (SoapEnvelope e) - { - double x = XmlConvert.ToDouble (e.SelectSingleNode ("//x").InnerText); - double y = XmlConvert.ToDouble (e.SelectSingleNode ("//y").InnerText); - Console.WriteLine ("Message received, x = {0}, y = {1}, x + y = {2}", x, y, x + y); - } - - } - -} diff --git a/mcs/class/Microsoft.Web.Services/mswse.pub b/mcs/class/Microsoft.Web.Services/mswse.pub deleted file mode 100644 index 695f1b38774..00000000000 Binary files a/mcs/class/Microsoft.Web.Services/mswse.pub and /dev/null differ