+++ /dev/null
-//
-// 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")]
+++ /dev/null
-2003-09-06 Sebastien Pouliot <spouliot@videotron.ca>
-
- * AssemblyInfo.cs: Removed AllowPartiallyTrustedCallers
-
-2003-09-04 Sebastien Pouliot <spouliot@videotron.ca>
-
- * AssemblyInfo.cs: Added. Copied from corlib and ajusted for WSE.
- * Locale.cs: Added. Copied from corlib.
- * ChangeLog: Added
\ No newline at end of file
+++ /dev/null
-2004-11-25 Raja R Harinath <rharinath@novell.com>
-
- * Makefile (dist-local): Use cp -p.
-
-2004-03-30 Sebastien Pouliot <sebastien@ximian.com>
-
- * Microsoft.Web.Services.dll.2.sources: Added Mono.Xml.XmlCanonicalizer
- * Microsoft.Web.Services.dll.sources: Added Mono.Xml.XmlCanonicalizer
-
-2004-03-23 Sebastien Pouliot <sebastien@ximian.com>
-
- * mswse.pub: New. Microsoft WSE public key to be used for
- strongnaming the Microsoft.Web.Service assembly.
-
-2003-12-08 Peter Williams <peter@newton.cx>
-
- * Makefile: Update Makefile to use embedded tabs instead
- of ECHO_ESCAPE. Fixes build on OS X.
-
-2003-10-26 Todd Berman <tberman@gentoo.org>
-
- * 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 <spouliot@videotron.ca>
-
- * Microsoft.Web.Services.dll.2.sources: Added IMutableSecurityToken.cs
- in Microsoft.Web.Services.Security (new in WSE2)
-
-2003-10-22 Todd Berman <tberman@gentoo.org>
-
- * 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 <tberman@gentoo.org>
-
- * Makefile: Fixed up the test target so it works now
-
-2003-10-08 Todd Berman <tberman@gentoo.org>
-
- * Microsoft.Web.Services.dll2.sources: Added RelatesTo.cs
-
-2003-10-08 Todd Berman <tberman@gentoo.org>
-
- * 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 <tberman@gentoo.org>
-
- * Microsoft.Web.Services.dll.2.sources: Added ReferenceProperties.cs
-
-2003-10-07 Todd Berman <tberman@gentoo.org>
-
- * Microsoft.Web.Services.dll.2.sources: Added OpenElementElement.cs
-
-2003-10-05 Sebastien Pouliot <spouliot@videotron.ca>
-
- * 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 <tberman@gentoo.org>
-
- * Microsoft.Web.Services.dll.2.sources: Added QualifiedName.cs
-
-2003-10-05 Todd Berman <tberman@gentoo.org>
-
- * Microsoft.Web.Services.dll.2.sources: Added AddressList.cs
-
-2003-10-05 Todd Berman <tberman@gentoo.org>
-
- * 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 <spouliot@videotron.ca>
-
- * Microsoft.Web.Services.dll.sources: Added ChainStream to build.
- * Microsoft.Web.Services.dll.2.sources: Added ChainStream to build.
-
-2003-10-04 Todd Berman <tberman@gentoo.org>
-
- * Microsoft.Web.Services.Addressing/Action.cs: implemented
-
-2003-09-30 Todd Berman <tberman@gentoo.org>
-
- * Microsoft.Web.Services.Addressing/AttributedUriString.cs: implemented
-
-2003-09-30 Todd Berman <tberman@gentoo.org>
-
- * 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 <tberman@gentoo.org>
-
- * Microsoft.Web.Services.Addressing/AttributedUriString.cs: stubs
- * Microsoft.Web.Services.Xml/OpenAttributeElement.cs: implemented
-
-2003-09-29 Todd Berman <tberman@gentoo.org>
-
- * Microsoft.Web.Services.Addressing/AddressingHeaders.cs: Partially
- stubbed.
- * Microsoft.Web.Services/SoapContext.cs: using AddressingHeaders now.
-
-2003-09-25 Todd Berman <tberman@gentoo.org>
-
- * 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 <spouliot@videotron.ca>
-
- * 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 <spouliot@videotron.ca>
-
- * Microsoft.Web.Services.dll.sources: Added another shared (and
- renamed) file from System.Security assembly (Signature.cs ->
- SignedXmlSignature.cs).
-
-2003-09-05 Sebastien Pouliot <spouliot@videotron.ca>
-
- * Microsoft.Web.Services.dll.sources: Added stubbed classes from
- Microsoft.Web.Services.Configuration to fix compilation.
-
-2003-09-04 Sebastien Pouliot <spouliot@videotron.ca>
-
- * 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 <duncan@ximian.com>
-
- * Integrate the files from Sebastien.
-
-2003-09-02 Duncan Mak <duncan@ximian.com>
-
- * Microsoft.Web.Services/Soap.cs:
- * Microsoft.Web.Services/IXmlElement.cs: Implemented.
-
-2003-09-02 Daniel Kornhauser <dkor@alum.mit.edu>
-
- * Microsoft.Web.Services: All Exceptions in this assembly
- implemented.
+++ /dev/null
-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
+++ /dev/null
-Microsoft.Web.Services.Configuration/ConfigurationBaseTest.cs
+++ /dev/null
-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
+++ /dev/null
-//
-// Microsoft.Web.Services.Addressing.Action.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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);
- }
-
- }
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Addressing.Address.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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;
- }
- }
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Addressing.AddressList.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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; }
- }
- }
-}
+++ /dev/null
-//
-// 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)
- {
- }
- }
-}
-
+++ /dev/null
-//
-// Microsoft.Web.Services.Addressing.AddressingHeaders.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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; }
- }
-
- }
-
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Addressing.AttributedQName.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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; }
- }
-
- }
-
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Addressing.AttributedUri
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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; }
- }
-
- }
-
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Addressing.AttributedUriString
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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; }
- }
-
- }
-
-}
+++ /dev/null
-2003-10-12 Todd Berman <tberman@gentoo.org>
-
- * AddressingHeaders.cs: implemented
- * EndpointReferenceType.cs: fixes
-
-2003-10-08 Todd Berman <tberman@gentoo.org>
-
- * RelatesTo.cs: Implemented
- * ReplyTo.cs: Implemented
- * To.cs: Implemented
-
-2003-10-08 Todd Berman <tberman@gentoo.org>
-
- * FaultTo.cs: Implemented
- * From.cs: Implemented
- * MessageID.cs: Implemented
- * Recipient.cs: Implemented
-
-2003-10-07 Todd Berman <tberman@gentoo.org>
-
- * ReferenceProperties.cs: Implemented
- * ServiceName.cs: Partially Implemented
- * EndpointReferenceType.cs: Implemented
- * EndpointReference.cs: Implemented
-
-2003-10-05 Todd Berman <tberman@gentoo.org>
-
- * AddressList.cs: Implemented.
- * AttributedQName.cs: Implemented.
- * PortType.cs: Implemented
- * ChangeLog: Added.
+++ /dev/null
-//
-// Microsoft.Web.Services.Addressing.EndpointReference
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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;
- }
-
- }
-
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Addressing
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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; }
- }
-
- }
-
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Addressing.FaultTo.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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;
- }
- }
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Addressing.From.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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;
- }
- }
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Addressing.MessageID.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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);
-
- }
- }
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Addressing.PortType.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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);
- }
-
- }
-
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Addressing.Recipient.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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;
- }
- }
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Addressing.ReferenceProperties.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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);
- }
- }
-
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Addressing.RelatesTo.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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;
- }
- }
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Addressing.ReplyTo
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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;
- }
-
- }
-
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Addressing.ServiceName.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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; }
- }
- }
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Addressing.To
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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;
- }
-
- }
-
-}
+++ /dev/null
-2003-10-26 Todd Berman <tberman@gentoo.org>
-
- * WebServicesConfiguration.cs: Allowing the MessagingConfiguration to
- stay the same one (prevents double socket binding attempts)
-
-2003-10-22 Todd Berman <tberman@gentoo.org>
-
- * WebServicesConfiguration.cs: Added MessagingConfiguration
- * FilterConfiguration.cs: #if'd out some stuff breaking wse2
-
-2003-10-05 Sebastien Pouliot <spouliot@videotron.ca>
-
- * FilterConfiguration.cs: Added Trace[In/Out]putFilters support.
- * WebServicesConfiguration.cs: now reads <microsoft.web.services>
- <diagnostics><trace>
-
-2003-09-06 Sebastien Pouliot <spouliot@videotron.ca>
-
- * 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 <spouliot@videotron.ca>
-
- * ConfigurationBase.cs: New. Limited implementation to fix compile.
- * FilterConfiguration.cs: New. Stub to fix compile.
- * WebServicesConfiguration.cs: New. Stub to fix compile.
+++ /dev/null
-//
-// 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"));
- }
- }
-}
+++ /dev/null
-//
-// 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 <filters> 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; }
- }
- }
-}
+++ /dev/null
-//
-// 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);
- }
- }
-}
+++ /dev/null
-2003-10-05 Sebastien Pouliot <spouliot@videotron.ca>
-
- * 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.
+++ /dev/null
-//
-// 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 ("<?xml version=\"1.0\" encoding=\"utf-8\"?>{0}<log/>", 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 ();
- }
- }
- }
-}
+++ /dev/null
-//
-// 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);
- }
- }
-}
+++ /dev/null
-//
-// 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);
- }
- }
-}
+++ /dev/null
-2003-09-04 Sebastien Pouliot <spouliot@videotron.ca>
-
- * DimeAttachmentCollection.cs: Fixed compilation issues
- * DimeReader.cs: Fixed compilation issues
+++ /dev/null
-//
-// 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; }
- }
- }
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Dime.DimeAttachmentCollection.cs
-//
-// Name: Daniel Kornhauser <dkor@alum.mit.edu>
-//
-// 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);
- }
- }
-}
-
-
+++ /dev/null
-//\r
-// Microsoft.Web.Services.DimeFormatException.cs\r
-//\r
-// Author: Daniel Kornhauser dkor@alum.mit.edu\r
-//\r
-// (C) Copyright, Ximian, Inc.\r
-//\r
-\r
-using System;\r
-using System.Web.Services.Protocols;\r
-using System.Xml;\r
-\r
-namespace Microsoft.Web.Services.Dime {\r
-\r
- [Serializable]\r
- public class DimeFormatException: SoapHeaderException\r
- {\r
- public DimeFormatException (string message)\r
- : base (String.Empty, XmlQualifiedName.Empty)\r
- {\r
- }\r
- \r
- public DimeFormatException (string message, Exception ex)\r
- : base (message, XmlQualifiedName.Empty, ex)\r
- {\r
- }\r
- }\r
-}\r
- \r
+++ /dev/null
-//
-// 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 ();
- }
- }
-}
+++ /dev/null
-//
-// 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
- {
- }
-}
+++ /dev/null
-//
-// Microsfot.Web.Services.TypeFormatEnum.cs
-//
-// Author: Daniel Kornhauser <dkor@alum.mit.edu>
-//
-// (C) Copyright, Ximian, Inc.
-//
-
-
-namespace Microsoft.Web.Services.Dime {
-
- public enum TypeFormatEnum
- {
- Unchanged = 0,
- MediaType = 16,
- AbsoluteUri = 32,
- Unknown = 48,
- None = 64
- }
-}
+++ /dev/null
-2004-01-26 Todd Berman <tberman@sevenl.net>
-
- * SoapTcpChannel.cs: fix from Sami Vaaraniemi <sami@capehill.net>
-
-2003-10-25 Todd Berman <tberman@gentoo.org>
-
- * SoapTcpChannel.cs: fixes for csc
- * SoapTcpListener.cs: fix for csc
- * SoapTcpTransport.cs: fix for csc
-
-2003-10-22 Todd Berman <tberman@gentoo.org>
-
- * 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.
+++ /dev/null
-// Microsoft.Web.Services.Messaging.ISoapFormmatter.cs
-//
-// Author: Duncan Mak <duncan@ximian.com>
-//
-// (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);
- }
-}
+++ /dev/null
-//\r
-// Microsoft.Web.Services.Messaging.ISoapTransport.cs\r
-//\r
-// Author: Daniel Kornhauser <dkor@alum.mit.edu>\r
-//\r
-// (C) Ximian, Inc. 2003.\r
-//\r
-\r
-using System;\r
-using System.IO;\r
-using System.Net;\r
-using Microsoft.Web.Services;\r
-\r
-namespace Microsoft.Web.Services.Messaging {\r
-\r
- public interface ISoapTransport {\r
-\r
- ICredentials Credentials { get; set; }\r
-\r
- int IdleTimeout { get; set; }\r
- \r
- //string Scheme { get; }\r
- \r
- IAsyncResult BeginSend ( \r
- SoapEnvelope envelope,\r
- Uri destination,\r
- AsyncCallback callback,\r
- object state);\r
- \r
- void EndSend (IAsyncResult result);\r
-\r
- void RegisterPort (Uri to, Type port);\r
-\r
- void RegisterPort (Uri to, SoapReceiver receiver);\r
-\r
- void Send (SoapEnvelope envelop, Uri destination);\r
- \r
- void UnregisterAll ();\r
-\r
- void UnregisterPort (Uri to);\r
-\r
- }\r
-}\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
+++ /dev/null
-//
-// Microsoft.Web.Services.Messaging.Configuration.MessagingConfiguration.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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; }
- }
-
- }
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Messaging.SoapChannel.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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);
- }
- }
- }
- }
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Messaging.SoapChannelCollection.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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; }
- }
- }
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Messaging.SoapDimeFormatter.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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 ();
- }
- }
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Messaging.SoapPlainFormatter.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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();
- }
- }
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Messaging.SoapPort.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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; }
- }
- }
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Messaging.SoapReceiver.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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);
- }
- }
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Messaging.SoapReceivers
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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; }
- }
- }
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Messaging.SoapSender
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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;
- }
- }
- }
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Messaging.SoapTcpChannel.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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"; }
- }
-
- }
-
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Messaging.SoapTcpListener.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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; }
- }
- }
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Messaging.SoapTcpTransport.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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; }
- }
-
- }
-
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Messaging.SoapTransport.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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; }
- }
- }
- }
-}
+++ /dev/null
-//\r
-// Microsoft.Web.Services.PolicyEnforcementException.cs\r
-//\r
-// Author Daniel Kornhauser dkor@alum.mit.edu\r
-//\r
-// (C) Copyright, Ximian, Inc. 2003.\r
-//\r
-\r
-using System;\r
-using System.Web.Services.Protocols;\r
-using System.Xml;\r
-\r
-namespace Microsoft.Web.Services.Policy {\r
-\r
- [Serializable]\r
- public class PolicyEnforcementException : SoapException\r
- {\r
- public PolicyEnforcementException (string message)\r
- : base (message, XmlQualifiedName.Empty)\r
- {\r
- }\r
- }\r
-}\r
-\r
+++ /dev/null
-2003-09-07 Sebastien Pouliot <spouliot@videotron.ca>
-
- * 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 <spouliot@videotron.ca>
-
- * ReferralInputFilter.cs: Stubbed for compilation (configuration).
- * ReferralOutputFilter.cs: Stubbed for compilation (configuration)
-
-2003-09-04 Sebastien Pouliot <spouliot@videotron.ca>
-
- * ReferralCollection.cs: Added missing ICollection properties.
+++ /dev/null
-//
-// Microsoft.Web.Services.Referral.Desc.cs
-//
-// Name: Daniel Kornhauser <dkor@alum.mit.edu>
-//
-// 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;
- }
- }
- }
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Referral.For.cs
-//
-// Name: Daniel Kornhauser <dkor@alum.mit.edu>
-//
-// 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;
- }
- }
- }
-}
+++ /dev/null
-//
-// Microsoft.Web.Service.Referral.If.cs
-//
-// Name: Daniel Kornhauser <dkor@alum.media.mit.edu>
-//
-// 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;
-
- }
- }
- }
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Referral.Referral.cs
-//
-// Authors:
-// Duncan Mak (duncan@ximian.com)
-// Daniel Kornhauser <dkor@alum.mit.edu>
-//
-// 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 ();
- }
- }
- }
-}
+++ /dev/null
-//
-// 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; }
- }
- }
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Referral.ReferralException.cs
-//
-// Authors:
-// Daniel Kornhauser <dkor@alum.mit.edu>
-// 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) {}
- }
-}
-
+++ /dev/null
-//
-// Microsoft.Web.Services.Referral.ReferralFormatException.cs
-//
-// Authors:
-// Daniel Kornhauser <dkor@alum.mit.edu>
-// 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;
- }
- }
-}
+++ /dev/null
-//
-// 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
- }
- }
-}
+++ /dev/null
-//
-// 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
- }
- }
-}
+++ /dev/null
-2003-10-26 Todd Berman <tberman@gentoo.org>
-
- * RoutingFault.cs: Implementation
- * Path.cs: More Implementation
- * Found.cs: Implementation
-
-2003-10-26 Todd Berman <tberman@gentoo.org>
-
- * RoutingOutputFilter.cs: Adding ReplyTo
-
-2003-10-22 Todd Berman <tberman@gentoo.org>
-
- * RoutingOutputFilter.cs: Quick WSE2 hack for the To and Action fields,
- still needs a lot of implementation.
-
-2003-09-07 Sebastien Pouliot <spouliot@videotron.ca>
-
- * 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 <spouliot@videotron.ca>
-
- * RoutingInputFilter.cs: Stubbed for compilation (configuration).
- * RoutingOutputFilter.cs: Stubbed for compilation (configuration).
-
-2003-09-04 Sebastien Pouliot <spouliot@videotron.ca>
-
- * Path.cs: Corrected typos to fix compilation.
- * Via.cs: Corrected typos to fix compilation.
- * ViaCollection.cs: Corrected typos to fix compilation.
+++ /dev/null
-//
-// Microsoft.Web.Services.Routing.Found.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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; }
- }
- }
-}
+++ /dev/null
-//
-// 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
- }
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Routing.RoutingFault.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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; }
- }
- }
-}
+++ /dev/null
-// Microsoft.Web.Services.Routing.RoutingFormatException.cs\r
-//\r
-// Author: Daniel Kornhauser <dkor@alum.mit.edu>\r
-//\r
-// (C) Ximian, Inc. 2003\r
-\r
-using System;\r
-using System.Web.Services.Protocols;\r
-using System.Xml;\r
-\r
-\r
-namespace Microsoft.Web.Services.Routing {\r
-\r
- [Serializable]\r
- public class RoutingFormatException : SoapHeaderException\r
- {\r
- public RoutingFormatException (string message) : base (message, XmlQualifiedName.Empty)\r
- {\r
- }\r
-\r
- public RoutingFormatException (string message, Exception ex) : base (message, XmlQualifiedName.Empty, ex)\r
- {\r
- }\r
- }\r
-}\r
+++ /dev/null
-//
-// 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
- }
- }
-}
+++ /dev/null
-//
-// 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
- }
- }
-}
+++ /dev/null
-//
-// Microsfot.Web.Services.Routing.Via.cs
-//
-// Author: Daniel Kornhauser <dkor@alum.mit.edu>
-//
-// 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);
- }
-
- }
-}
-
-
+++ /dev/null
-//
-// Microsoft.Web.Services.Routing.ViaCollection.cs
-//
-// Author: Daniel Kornhauser <dkor@alum.mit.edu>
-//
-// 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);
- }
- }
-}
+++ /dev/null
-//
-// 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 () {}
- }
-}
+++ /dev/null
-2003-10-05 Sebastien Pouliot <spouliot@videotron.ca>
-
- * X509Certificate.cs: Class is sealed (corcompare). Implemented
- GetSubjectAlternativeName for WSE2.
- * X509CertificateCollection.cs: Removed Item[] set (corcompare).
-
-2003-09-04 Sebastien Pouliot <spouliot@videotron.ca>
-
- * FileCertificateStore.cs: Fixed compilation.
+++ /dev/null
-//
-// 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 () {}
- }
-}
+++ /dev/null
-using System;\r
-\r
-namespace Microsoft.Web.Services.Security.X509 {\r
-\r
- public interface ICertificateStore {\r
-\r
- void Close ();\r
-\r
- IntPtr Handle {\r
- get;\r
- }\r
-\r
- X509CertificateCollection GetCollection ();\r
- }\r
-}\r
+++ /dev/null
-//\r
-// MemoryCertificateStore.cs: Handles an in-memory certificate store.\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-\r
-using System;\r
-\r
-namespace Microsoft.Web.Services.Security.X509 {\r
-\r
- internal class MemoryCertificateStore : ICertificateStore {\r
-\r
- private string _storeName;\r
- private X509CertificateStore.StoreOpenFlags _flags;\r
- private X509CertificateStore.StoreLocation _location;\r
- private IntPtr _handle;\r
- private X509CertificateCollection _coll;\r
-\r
- public MemoryCertificateStore (X509CertificateStore.StoreLocation location, string storeName, X509CertificateStore.StoreOpenFlags flags) \r
- {\r
- _location = location;\r
- _storeName = storeName;\r
- _flags = flags;\r
- _coll = new X509CertificateCollection ();\r
- }\r
-\r
- public void Close () \r
- {\r
- }\r
-\r
- public IntPtr Handle {\r
- get { return (IntPtr) _coll.GetHashCode (); }\r
- }\r
-\r
- public X509CertificateCollection GetCollection () \r
- {\r
- if (_flags == X509CertificateStore.StoreOpenFlags.ReadOnly) {\r
- // return a copy of the collection so changes aren't persisted\r
- X509CertificateCollection copy = new X509CertificateCollection ();\r
- foreach (X509Certificate x in _coll) {\r
- copy.Add (x);\r
- }\r
- return copy;\r
- }\r
- else\r
- return _coll;\r
- }\r
- }\r
-}\r
+++ /dev/null
-//
-// 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 ());
- }
- }
-}
+++ /dev/null
-//
-// 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);
- }
- }
-}
+++ /dev/null
-//\r
-// X509CertificateStore.cs: Handles certificate stores.\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-\r
-using System;\r
-using System.Security.Cryptography;\r
-using System.Security.Cryptography.X509Certificates;\r
-using System.Text;\r
-\r
-namespace Microsoft.Web.Services.Security.X509 {\r
-\r
- public class X509CertificateStore {\r
-\r
- [Serializable]\r
- public enum StoreLocation {\r
- CurrentService = 262144,\r
- CurrentUser = 65536,\r
- CurrentUserGroupPolicy = 458752,\r
- LocalMachine = 131072,\r
- LocalMachineEnterprise = 589824,\r
- LocalMachineGroupPolicy = 524288,\r
- Services = 327680,\r
- Unknown = 0,\r
- Users = 393216\r
- }\r
-\r
- [Flags]\r
- [Serializable]\r
- public enum StoreOpenFlags {\r
- CreateNew = 8192,\r
- DeferClose = 4,\r
- Delete = 16,\r
- None = 0,\r
- OpenExisting = 16384,\r
- ReadOnly = 32768\r
- }\r
-\r
- [Serializable]\r
- public enum StoreProvider {\r
- Collection = 11,\r
- File = 3,\r
- Memory = 1,\r
- System = 10\r
- } \r
-\r
- public const string CAStore = "CA";\r
- public const string MyStore = "My";\r
- public const string RootStore = "Root";\r
- public const string TrustStore = "Trust";\r
- public const string UnTrustedStore = "Disallowed";\r
-\r
- private const string storeAlreadyOpened = "store already opened";\r
- private const string storeNotOpened = "store not opened";\r
-\r
- private StoreOpenFlags storeOpenFlags;\r
- private StoreProvider storeProvider;\r
- private StoreLocation storeLocation;\r
- private string storeName;\r
- private ICertificateStore store;\r
-\r
- public X509CertificateStore (StoreProvider provider, StoreLocation location, string storeName)\r
- {\r
- storeProvider = provider;\r
- storeLocation = location;\r
- this.storeName = storeName;\r
- }\r
-\r
- ~X509CertificateStore () \r
- {\r
- if (store != null) {\r
- store.Close ();\r
- store = null;\r
- }\r
- }\r
-\r
- public X509CertificateCollection Certificates {\r
- get { \r
- if (store == null)\r
- return null;\r
- return store.GetCollection (); \r
- }\r
- }\r
-\r
- public IntPtr Handle {\r
- get { \r
- if (store == null)\r
- return (IntPtr) 0;\r
- return store.Handle; \r
- }\r
- }\r
-\r
- public StoreLocation Location {\r
- get { return storeLocation; }\r
- }\r
-\r
- public bool Open () \r
- {\r
- return InternalOpen (StoreOpenFlags.None);\r
- }\r
-\r
- public bool OpenRead () \r
- {\r
- return InternalOpen (StoreOpenFlags.ReadOnly);\r
- }\r
-\r
- internal bool InternalOpen (StoreOpenFlags flags) \r
- {\r
- if (store != null)\r
- throw new InvalidOperationException (storeAlreadyOpened);\r
-\r
- storeOpenFlags = flags;\r
- switch (storeProvider) {\r
- case StoreProvider.Collection:\r
- store = null;\r
- break;\r
- case StoreProvider.File:\r
- store = null;\r
- break;\r
- case StoreProvider.Memory:\r
- store = new MemoryCertificateStore (storeLocation, storeName, flags);\r
- break;\r
- case StoreProvider.System:\r
- store = null;\r
- break;\r
- default:\r
- throw new NotSupportedException ("Unknown store provider");\r
- }\r
- return (store != null);\r
- }\r
-\r
- public void Close ()\r
- {\r
- store.Close ();\r
- store = null;\r
- storeOpenFlags = StoreOpenFlags.None;\r
- }\r
-\r
- internal bool Compare (byte[] array1, byte[] array2) \r
- {\r
- if ((array1 == null) && (array2 == null))\r
- return true;\r
- if ((array1 == null) || (array2 == null))\r
- return false;\r
- if (array1.Length != array2.Length)\r
- return false;\r
- for (int i=0; i < array1.Length; i++) {\r
- if (array1 [i] != array2 [i])\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- public X509CertificateCollection FindCertificateByHash (byte[] certHash)\r
- {\r
- if (certHash == null)\r
- throw new ArgumentNullException ("certHash");\r
- if (store != null)\r
- throw new InvalidOperationException (storeNotOpened);\r
- \r
- X509CertificateCollection results = new X509CertificateCollection ();\r
- if (store != null) {\r
- X509CertificateCollection certs = store.GetCollection ();\r
- // apply filter\r
- foreach (X509Certificate c in certs) {\r
- if (Compare (c.GetCertHash (), certHash))\r
- results.Add (c);\r
- }\r
- }\r
- return results;\r
- }\r
-\r
- public X509CertificateCollection FindCertificateByKeyIdentifier (byte[] keyIdentifier)\r
- {\r
- if (keyIdentifier == null)\r
- throw new ArgumentNullException ("keyIdentifier");\r
- if (store != null)\r
- throw new InvalidOperationException (storeNotOpened);\r
- \r
- X509CertificateCollection results = new X509CertificateCollection ();\r
- if (store != null) {\r
- X509CertificateCollection certs = store.GetCollection ();\r
- // apply filter\r
- foreach (X509Certificate c in certs) {\r
- if (Compare (c.GetKeyIdentifier (), keyIdentifier))\r
- results.Add (c);\r
- }\r
- }\r
- return results;\r
- }\r
-\r
- public X509CertificateCollection FindCertificateBySubjectName (string subjectstring)\r
- {\r
- if (subjectstring == null)\r
- throw new ArgumentNullException ("subjectstring");\r
- if (store != null)\r
- throw new InvalidOperationException (storeNotOpened);\r
-\r
- X509CertificateCollection results = new X509CertificateCollection ();\r
- if (store != null) {\r
- X509CertificateCollection certs = store.GetCollection ();\r
- // apply filter\r
- foreach (X509Certificate c in certs) {\r
- if (c.GetName() != subjectstring)\r
- results.Add (c);\r
- }\r
- }\r
- return results;\r
- }\r
-\r
- public X509CertificateCollection FindCertificateBySubjectString (string subjectsubstring)\r
- {\r
- if (subjectsubstring == null)\r
- throw new ArgumentNullException ("subjectsubstring");\r
- if (store != null)\r
- throw new InvalidOperationException (storeNotOpened);\r
-\r
- X509CertificateCollection results = new X509CertificateCollection ();\r
- if (store != null) {\r
- X509CertificateCollection certs = store.GetCollection ();\r
- // apply filter\r
- foreach (X509Certificate c in certs) {\r
- if (c.GetName ().IndexOf (subjectsubstring) > 0)\r
- results.Add (c);\r
- }\r
- }\r
- return results;\r
- }\r
-\r
- public static X509CertificateStore CurrentUserStore (string storeName) \r
- {\r
- return new X509CertificateStore (StoreProvider.System, StoreLocation.CurrentUser, storeName);\r
- }\r
-\r
- public static X509CertificateStore LocalMachineStore (string storeName) \r
- {\r
- return new X509CertificateStore (StoreProvider.System, StoreLocation.LocalMachine, storeName);\r
- }\r
- }\r
-}\r
+++ /dev/null
-//
-// 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; }
- }
- }
-}
+++ /dev/null
-//
-// 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; }
- }
- }
-}
+++ /dev/null
-//\r
-// AuthenticationKey.cs: Handles WS-Security AuthenticationKey\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-// Licensed under MIT X11 (see LICENSE) with this specific addition:\r
-//\r
-// \93This source code may incorporate intellectual property owned by Microsoft \r
-// Corporation. Our provision of this source code does not include any licenses\r
-// or any other rights to you under any Microsoft intellectual property. If you\r
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need \r
-// to contact Microsoft directly.\94 \r
-//\r
-\r
-using System.Security.Cryptography;\r
-// temp\r
-//using System.Security.Cryptography.Xml;\r
-\r
-namespace Microsoft.Web.Services.Security {\r
-\r
- public class AuthenticationKey {\r
-\r
- private AsymmetricAlgorithm asymKey;\r
- private SymmetricAlgorithm symKey;\r
-\r
- public AuthenticationKey (AsymmetricAlgorithm key) \r
- {\r
- asymKey = key;\r
- }\r
-\r
- public AuthenticationKey (SymmetricAlgorithm key) \r
- {\r
- symKey = key;\r
- }\r
-\r
- public bool CheckSignature (SignedXml signedXml) \r
- {\r
- if (asymKey != null) {\r
- return signedXml.CheckSignature (asymKey);\r
- }\r
- else {\r
- HMACSHA1 hmac = new HMACSHA1 (symKey.Key);\r
- return signedXml.CheckSignature (hmac);\r
- }\r
- }\r
- }\r
-}\r
+++ /dev/null
-//
-// 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);
- }
- }
- }
-}
+++ /dev/null
-2004-03-30 Sebastien Pouliot <sebastien@ximian.com>
-
- * XmlDsigExcC14NTransform.cs: Updated to match current System.Security
- XmlDSigC14NTransform.
- * XmlDSigExcC14NWithCommentsTransform.cs: Updated to match current
- System.Security XmlDSigC14NWithCommentsTransform.
-
-2003-11-06 Sebastien Pouliot <spouliot@videotron.ca>
-
- * 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 <spouliot@videotron.ca>
-
- * 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 <spouliot@videotron.ca>
-
- * 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 <spouliot@videotron.ca>
-
- * 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 <tberman@gentoo.org>
-
- * Nonce.cs: WSE2 Compilation fix
-
-2003-10-24 Sebastien Pouliot <spouliot@videotron.ca>
-
- * 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 <spouliot@videotron.ca>
-
- * 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 <spouliot@videotron.ca>
-
- * 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 <spouliot@videotron.ca>
-
- * 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 <spouliot@videotron.ca>
-
- * SecurityOutputFilter.cs: Added missing "1" to soap:mustUnderstand
-
-2003-10-04 Sebastien Pouliot <spouliot@videotron.ca>
-
- * 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 <spouliot@videotron.ca>
-
- * 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 <spouliot@videotron.ca>
-
- * 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.
+++ /dev/null
-//\r
-// DecryptionKey.cs: Handles WS-Security DecryptionKey\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-// Licensed under MIT X11 (see LICENSE) with this specific addition:\r
-//\r
-// \93This source code may incorporate intellectual property owned by Microsoft \r
-// Corporation. Our provision of this source code does not include any licenses\r
-// or any other rights to you under any Microsoft intellectual property. If you\r
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need \r
-// to contact Microsoft directly.\94 \r
-//\r
-\r
-using System;\r
-\r
-namespace Microsoft.Web.Services.Security {\r
-\r
- public abstract class DecryptionKey {\r
-\r
- private string name;\r
-\r
- protected DecryptionKey () {}\r
-\r
- public string Name {\r
- get { return name; }\r
- set { name = value; }\r
- }\r
- }\r
-}\r
+++ /dev/null
-//
-// 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;
- }
- }
-}
+++ /dev/null
-//
-// 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;
- }
- }
-}
+++ /dev/null
-//
-// 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
- }
- }
-}
+++ /dev/null
-//\r
-// EncryptionKey.cs: \r
-// Abstract class for AsymmetricEncryptionKey and SymmetricEncryptionKey\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-// Licensed under MIT X11 (see LICENSE) with this specific addition:\r
-//\r
-// \93This source code may incorporate intellectual property owned by Microsoft \r
-// Corporation. Our provision of this source code does not include any licenses\r
-// or any other rights to you under any Microsoft intellectual property. If you\r
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need \r
-// to contact Microsoft directly.\94 \r
-//\r
-\r
-using System.Security.Cryptography.Xml;\r
-\r
-namespace Microsoft.Web.Services.Security {\r
-\r
- public abstract class EncryptionKey {\r
-\r
- private KeyInfo ki;\r
-\r
- public EncryptionKey () \r
- {\r
- ki = new KeyInfo ();\r
- }\r
-\r
- public KeyInfo KeyInfo {\r
- get { return ki; }\r
- }\r
- }\r
-}\r
+++ /dev/null
-//\r
-// IDecryptionKeyProvider.cs: \r
-// Defines IDecryptionKeyProvider interface\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-// Licensed under MIT X11 (see LICENSE) with this specific addition:\r
-//\r
-// \93This source code may incorporate intellectual property owned by Microsoft \r
-// Corporation. Our provision of this source code does not include any licenses\r
-// or any other rights to you under any Microsoft intellectual property. If you\r
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need \r
-// to contact Microsoft directly.\94 \r
-//\r
-\r
-using System.Security.Cryptography.Xml;
-\r
-namespace Microsoft.Web.Services.Security {\r
-\r
- public interface IDecryptionKeyProvider {\r
-\r
- DecryptionKey GetDecryptionKey (string algorithmUri, KeyInfo keyInfo);\r
-\r
- }\r
-}\r
+++ /dev/null
-//
-// 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();
-
- }
-}
+++ /dev/null
-//\r
-// IPasswordProvider.cs: \r
-// Defines IPasswordProvider interface\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-// Licensed under MIT X11 (see LICENSE) with this specific addition:\r
-//\r
-// \93This source code may incorporate intellectual property owned by Microsoft \r
-// Corporation. Our provision of this source code does not include any licenses\r
-// or any other rights to you under any Microsoft intellectual property. If you\r
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need \r
-// to contact Microsoft directly.\94 \r
-//\r
-\r
-namespace Microsoft.Web.Services.Security {\r
-\r
- public interface IPasswordProvider {\r
-\r
- string GetPassword (UsernameToken token);\r
-\r
- }\r
-}\r
+++ /dev/null
-//
-// 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);
- }
-}
+++ /dev/null
-//\r
-// ISecurityElement.cs: \r
-// Defines ISecurityElement interface\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-// Licensed under MIT X11 (see LICENSE) with this specific addition:\r
-//\r
-// \93This source code may incorporate intellectual property owned by Microsoft \r
-// Corporation. Our provision of this source code does not include any licenses\r
-// or any other rights to you under any Microsoft intellectual property. If you\r
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need \r
-// to contact Microsoft directly.\94 \r
-//\r
-\r
-namespace Microsoft.Web.Services.Security {\r
-\r
- // complete!\r
- public interface ISecurityElement {}\r
-\r
-}\r
+++ /dev/null
-//
-// 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;
- }
- }
- }
-}
+++ /dev/null
-//
-// 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);
- }
- }
-}
+++ /dev/null
-//
-// 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; }
- }
- }
-}
+++ /dev/null
-//
-// 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
- }
-}
+++ /dev/null
-//
-// 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);
- }
- }
- }
-}
+++ /dev/null
-//
-// 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);
- }
- }
- }
- }
-}
+++ /dev/null
-//
-// 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) {}
- }
-}
+++ /dev/null
-//
-// 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; }
- }
- }
-}
+++ /dev/null
-//
-// 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;
- }
- }
-}
+++ /dev/null
-//
-// 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 () {}
- }
-}
+++ /dev/null
-//
-// 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);
- }
- }
- }
-}
+++ /dev/null
-//\r
-// SecurityCollection.cs: Handles WS-Security SecurityCollection\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-// Licensed under MIT X11 (see LICENSE) with this specific addition:\r
-//\r
-// \93This source code may incorporate intellectual property owned by Microsoft \r
-// Corporation. Our provision of this source code does not include any licenses\r
-// or any other rights to you under any Microsoft intellectual property. If you\r
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need \r
-// to contact Microsoft directly.\94 \r
-//\r
-\r
-using System;\r
-using System.Collections;\r
-\r
-namespace Microsoft.Web.Services.Security {\r
-\r
- public class SecurityCollection : ICollection, IEnumerable {\r
-\r
- private ArrayList list;\r
-\r
- public SecurityCollection ()\r
- {\r
- list = new ArrayList ();\r
- }\r
-\r
- public int Count {\r
- get { return list.Count; }\r
- }\r
-\r
- public bool IsSynchronized {\r
- get { return list.IsSynchronized; }\r
- }\r
-\r
- public Security this [Uri actor] {\r
- get {\r
- if (actor == null)\r
- throw new ArgumentNullException ("actor");\r
- return null;\r
- }\r
- }\r
-\r
- public Security this [string actor] {\r
- get {\r
- if (actor == null)\r
- throw new ArgumentNullException ("actor");\r
- return null;\r
- }\r
- }\r
-\r
- public object SyncRoot {\r
- get { return list.SyncRoot; }\r
- }\r
-\r
- public void Add (Security security) \r
- {\r
- // note: doc says it not ArgumentNullException\r
- if (security == null)\r
- throw new ArgumentException ("security");\r
- if (list.Contains (security))\r
- throw new ArgumentException ("duplicate");\r
- list.Add (security);\r
- }\r
-\r
- public void Clear () \r
- {\r
- list.Clear ();\r
- }\r
-\r
- public bool Contains (string actor) \r
- {\r
- if (actor == null)\r
- throw new ArgumentNullException ("actor");\r
- return false;\r
- }\r
-\r
- public bool Contains (Uri actor) \r
- {\r
- if (actor == null)\r
- throw new ArgumentNullException ("actor");\r
- return false;\r
- }\r
-\r
- public void CopyTo (Array array, int index) \r
- {\r
- if (array == null)\r
- throw new ArgumentNullException ("array");\r
- }\r
-\r
- public IEnumerator GetEnumerator () \r
- {\r
- return list.GetEnumerator ();\r
- }\r
-\r
- public void Remove (string actor) \r
- {\r
- if (actor == null)\r
- throw new ArgumentNullException ("actor");\r
- }\r
-\r
- public void Remove (Uri actor) \r
- {\r
- if (actor == null)\r
- throw new ArgumentNullException ("actor");\r
- }\r
- }\r
-}\r
+++ /dev/null
-//\r
-// SecurityElementCollection.cs: Handles WS-Security SecurityElementCollection\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-// Licensed under MIT X11 (see LICENSE) with this specific addition:\r
-//\r
-// \93This source code may incorporate intellectual property owned by Microsoft \r
-// Corporation. Our provision of this source code does not include any licenses\r
-// or any other rights to you under any Microsoft intellectual property. If you\r
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need \r
-// to contact Microsoft directly.\94 \r
-//\r
-\r
-using System;\r
-using System.Collections;\r
-\r
-namespace Microsoft.Web.Services.Security {\r
-\r
- public class SecurityElementCollection : ICollection, IEnumerable {\r
-\r
- private ArrayList list;\r
-\r
- public SecurityElementCollection () \r
- {\r
- list = new ArrayList ();\r
- }\r
-\r
- public int Count {\r
- get { return list.Count; }\r
- }\r
-\r
- public bool IsSynchronized {\r
- get { return list.IsSynchronized; }\r
- }\r
-\r
- public ISecurityElement this [int index] {\r
- get { return (ISecurityElement) list [index]; }\r
- }\r
-\r
- public object SyncRoot {\r
- get { return list.SyncRoot; }\r
- }\r
-\r
- public void Add (ISecurityElement element) \r
- {\r
- list.Add (element);\r
- }\r
-\r
- public void Clear () \r
- {\r
- list.Clear ();\r
- }\r
-\r
- public void CopyTo (Array array, int index) \r
- {\r
- if (array == null)\r
- throw new ArgumentNullException ("array");\r
- list.CopyTo (array, index);\r
- }\r
-\r
- public IEnumerator GetEnumerator () \r
- {\r
- return list.GetEnumerator ();\r
- }\r
-\r
- public void Remove (ISecurityElement element) \r
- {\r
- if (element == null)\r
- throw new ArgumentNullException ("element");\r
- list.Remove (element);\r
- }\r
- }\r
-}\r
+++ /dev/null
-//\r
-// SecurityFault.cs: Undocument exception when a security fault happens\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-// Licensed under MIT X11 (see LICENSE) with this specific addition:\r
-//\r
-// \93This source code may incorporate intellectual property owned by Microsoft \r
-// Corporation. Our provision of this source code does not include any licenses\r
-// or any other rights to you under any Microsoft intellectual property. If you\r
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need \r
-// to contact Microsoft directly.\94 \r
-//\r
-\r
-using System;\r
-using System.Web.Services.Protocols;\r
-using System.Xml;\r
-\r
-namespace Microsoft.Web.Services.Security {\r
-\r
- internal class SecurityFault : SoapHeaderException {\r
-\r
- public SecurityFault (string message, XmlQualifiedName code) : base (message, code) {}\r
-\r
- }\r
-}\r
+++ /dev/null
-//\r
-// SecurityFormatException.cs: \r
-// Implements SecurityFormatException Exception\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-// Licensed under MIT X11 (see LICENSE) with this specific addition:\r
-//\r
-// \93This source code may incorporate intellectual property owned by Microsoft \r
-// Corporation. Our provision of this source code does not include any licenses\r
-// or any other rights to you under any Microsoft intellectual property. If you\r
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need \r
-// to contact Microsoft directly.\94 \r
-//\r
-\r
-using System;\r
-using System.Web.Services.Protocols;\r
-\r
-namespace Microsoft.Web.Services.Security {\r
-\r
- [Serializable]\r
- public class SecurityFormatException : SoapHeaderException {\r
-\r
- public SecurityFormatException (string message) : base (message, null) {}\r
-\r
- }\r
-}\r
+++ /dev/null
-//
-// 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
- }
- }
- }
-}
+++ /dev/null
-//
-// 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));
- }
- }
- }
- }
-}
+++ /dev/null
-//
-// 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
- }
-}
+++ /dev/null
-//
-// 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) {}
- }
-}
+++ /dev/null
-//\r
-// SecurityTokenCollection.cs: Handles WS-Security SecurityTokenCollection\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-// Licensed under MIT X11 (see LICENSE) with this specific addition:\r
-//\r
-// \93This source code may incorporate intellectual property owned by Microsoft \r
-// Corporation. Our provision of this source code does not include any licenses\r
-// or any other rights to you under any Microsoft intellectual property. If you\r
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need \r
-// to contact Microsoft directly.\94 \r
-//\r
-\r
-using System;\r
-using System.Collections;\r
-\r
-namespace Microsoft.Web.Services.Security {\r
-\r
- public class SecurityTokenCollection : ICollection, IEnumerable {\r
-\r
- private ArrayList list;\r
-\r
- public SecurityTokenCollection () \r
- {\r
- list = new ArrayList ();\r
- }\r
-\r
- public int Count {\r
- get { return list.Count; }\r
- }\r
-\r
- public bool IsSynchronized {\r
- get { return list.IsSynchronized; }\r
- }\r
-\r
- // TODO\r
- public SecurityToken this [string refid] {\r
- get { return null; }\r
- }\r
-\r
- public object SyncRoot {\r
- get { return list.SyncRoot; }\r
- }\r
-\r
- public int Add (SecurityToken token) \r
- {\r
- return list.Add (token);\r
- }\r
-\r
- public void AddRange (ICollection collection) \r
- {\r
- IEnumerator e = collection.GetEnumerator ();\r
- while (e.MoveNext ()) {\r
- if (e.Current is SecurityToken)\r
- list.Add (e.Current as SecurityToken);\r
- else\r
- throw new ArgumentException (e.Current.ToString ());\r
- }\r
- }\r
-\r
- public void Clear () \r
- {\r
- list.Clear ();\r
- }\r
-\r
- public bool Contains (SecurityToken token) \r
- {\r
- return list.Contains (token);\r
- }\r
-\r
- public void CopyTo (Array array, int index) \r
- {\r
- if (array == null)\r
- throw new ArgumentNullException ("array");\r
- list.CopyTo (array, index);\r
- }\r
-\r
- public IEnumerator GetEnumerator () \r
- {\r
- return list.GetEnumerator ();\r
- }\r
-\r
- public void Remove (SecurityToken token) \r
- {\r
- if (token == null)\r
- throw new ArgumentNullException ("token");\r
- list.Remove (token);\r
- }\r
- }\r
-}\r
+++ /dev/null
-//
-// 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);
- }
- }
- }
- }
-}
+++ /dev/null
-//
-// 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) {}
- }
-}
+++ /dev/null
-//
-// 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);
- }
- }
-}
+++ /dev/null
-//\r
-// SignatureKey.cs: Handles WS-Security SignatureKey\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-// Licensed under MIT X11 (see LICENSE) with this specific addition:\r
-//\r
-// \93This source code may incorporate intellectual property owned by Microsoft \r
-// Corporation. Our provision of this source code does not include any licenses\r
-// or any other rights to you under any Microsoft intellectual property. If you\r
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need \r
-// to contact Microsoft directly.\94 \r
-//\r
-\r
-using System.Security.Cryptography;\r
-// temp\r
-using System.Security.Cryptography.Xml;\r
-\r
-namespace Microsoft.Web.Services.Security {\r
-\r
- public class SignatureKey {\r
-\r
- private AsymmetricAlgorithm asymKey;\r
- private SymmetricAlgorithm symKey;\r
-\r
- public SignatureKey (AsymmetricAlgorithm key) \r
- {\r
- asymKey = key;\r
- }\r
-\r
- public SignatureKey (SymmetricAlgorithm key) \r
- {\r
- symKey = key;\r
- }\r
-\r
- public virtual void ComputeSignature (SignedXml signedXml) \r
- {\r
- if (asymKey != null) {\r
- signedXml.SigningKey = asymKey;\r
- signedXml.ComputeSignature ();\r
- }\r
- else {\r
- HMACSHA1 hmac = new HMACSHA1 (symKey.Key);\r
- signedXml.ComputeSignature (hmac);\r
- }\r
- }\r
- }\r
-}\r
+++ /dev/null
-//
-// 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,
- }
-}
+++ /dev/null
-//
-// 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);
- }
- }
- }
-}
+++ /dev/null
-//
-// 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
- }
-}
+++ /dev/null
-//
-// 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
+++ /dev/null
-//\r
-// SymmetricDecryptionKey.cs: Handles WS-Security SymmetricDecryptionKey\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-// Licensed under MIT X11 (see LICENSE) with this specific addition:\r
-//\r
-// \93This source code may incorporate intellectual property owned by Microsoft \r
-// Corporation. Our provision of this source code does not include any licenses\r
-// or any other rights to you under any Microsoft intellectual property. If you\r
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need \r
-// to contact Microsoft directly.\94 \r
-//\r
-\r
-using System;\r
-using System.Security.Cryptography;\r
-using System.Web.Services.Protocols;\r
-\r
-namespace Microsoft.Web.Services.Security {\r
-\r
- public sealed class SymmetricDecryptionKey : DecryptionKey {\r
-\r
- private SymmetricAlgorithm algo;\r
- private byte[] key;\r
-\r
- private bool IsSupported (SymmetricAlgorithm algo) \r
- {\r
- return ((algo is Rijndael) || (algo is TripleDES));\r
- }\r
-\r
- public SymmetricDecryptionKey (SymmetricAlgorithm key) \r
- {\r
- if (!IsSupported (key))\r
- throw new SecurityFault ("Unsupported algorithm", null);\r
- algo = key;\r
- }\r
-\r
- public SymmetricDecryptionKey (SymmetricAlgorithm key, byte[] keyValue) \r
- {\r
- if (!IsSupported (key))\r
- throw new SecurityFault ("Unsupported algorithm", null);\r
- if (keyValue == null)\r
- throw new ArgumentNullException ("KeyValue");\r
-\r
- algo = key;\r
- this.key = keyValue;\r
- }\r
- }\r
-}\r
+++ /dev/null
-//
-// 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; }
- }
- }
-}
+++ /dev/null
-//
-// 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) {}
- }
-}
+++ /dev/null
-//
-// 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 ();
- }
- }
-}
+++ /dev/null
-//
-// 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
- }
-}
+++ /dev/null
-//
-// 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) {}
- }
-}
+++ /dev/null
-//\r
-// WSSecurity.cs: Handles WS-Security WSSecurity\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-// Licensed under MIT X11 (see LICENSE) with this specific addition:\r
-//\r
-// \93This source code may incorporate intellectual property owned by Microsoft \r
-// Corporation. Our provision of this source code does not include any licenses\r
-// or any other rights to you under any Microsoft intellectual property. If you\r
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need \r
-// to contact Microsoft directly.\94 \r
-//\r
-\r
-using System;\r
-\r
-namespace Microsoft.Web.Services.Security {\r
-\r
- public sealed class WSSecurity {\r
-\r
- // LAMESPEC AttributeNames aren't documented\r
- public class AttributeNames {\r
-\r
- public const string EncodingType = "EncodingType";\r
- public const string IdentifierType = "IdentifierType"; \r
- public const string TokenType = "TokenType";\r
- public const string Type = "Type"; \r
- public const string Uri = "URI"; \r
- public const string ValueType = "ValueType"; \r
-\r
- public AttributeNames () {}\r
- }\r
-\r
- // LAMESPEC ElementNames aren't documented\r
- public class ElementNames {\r
-\r
- public const string BinarySecurityToken = "BinarySecurityToken"; \r
- public const string KeyIdentifier = "KeyIdentifier"; \r
- public const string Nonce = "Nonce"; \r
- public const string Password = "Password"; \r
- public const string Reference = "Reference"; \r
- public const string Security = "Security"; \r
- public const string SecurityTokenReference = "SecurityTokenReference";\r
- public const string Username = "Username"; \r
- public const string UsernameToken = "UsernameToken";\r
-\r
- public ElementNames () {}\r
- }\r
-\r
- public const string NamespaceURI = "http://schemas.xmlsoap.org/ws/2002/07/secext";\r
- public const string Prefix = "wsse";\r
-\r
- public WSSecurity () {}\r
- }\r
-}\r
+++ /dev/null
-//
-// 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
- }
-}
+++ /dev/null
-//\r
-// XmlDsigExcC14NTransform.cs: \r
-// Handles WS-Security XmlDsigExcC14NTransform\r
-//\r
-// Author:\r
-// Sebastien Pouliot <sebastien@ximian.com>\r
-// Aleksey Sanin (aleksey@aleksey.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-// (C) 2003 Aleksey Sanin (aleksey@aleksey.com)\r
-// (C) 2004 Novell (http://www.novell.com)\r
-//\r
-\r
-using System;\r
-using System.IO;\r
-using System.Security.Cryptography.Xml;\r
-using System.Xml;\r
-\r
-using Mono.Xml;\r
-\r
-namespace Microsoft.Web.Services.Security {\r
-\r
- public class XmlDsigExcC14NTransform : Transform {\r
-\r
- public const string XmlDsigExcC14NTransformUrl = "http://www.w3.org/2001/10/xml-exc-c14n#";\r
- public const string XmlDsigExcC14NWithCommentsTransformUrl = "http://www.w3.org/2001/10/xml-exc-c14n#WithComments";\r
-\r
- private Type[] input;\r
- private Type[] output;\r
- private XmlCanonicalizer canonicalizer;\r
- private Stream s;\r
- private string prefixList;\r
- private bool comments;\r
-\r
- public XmlDsigExcC14NTransform () : this (false)\r
- {\r
- }\r
-\r
- public XmlDsigExcC14NTransform (bool includeComments) \r
- {\r
- comments = includeComments;\r
- canonicalizer = new XmlCanonicalizer (includeComments, true);\r
- }\r
-\r
- public XmlDsigExcC14NTransform (string inclusiveNamespacesPrefixList)\r
- : this (false, inclusiveNamespacesPrefixList)\r
- {\r
- }\r
-\r
- public XmlDsigExcC14NTransform (bool includeComments, string inclusiveNamespacesPrefixList)\r
- : this (includeComments) \r
- {\r
- prefixList = inclusiveNamespacesPrefixList;\r
- }\r
-\r
- public string InclusiveNamespacesPrefixList {\r
- get { return prefixList; }\r
- set { prefixList = value; }\r
- }\r
-\r
- public override Type[] InputTypes {\r
- get {\r
- if (input == null) {\r
- lock (this) {\r
- // this way the result is cached if called multiple time\r
- input = new Type [3];\r
- input[0] = typeof (System.IO.Stream);\r
- input[1] = typeof (System.Xml.XmlDocument);\r
- input[2] = typeof (System.Xml.XmlNodeList);\r
- }\r
- }\r
- return input;\r
- }\r
- }\r
-\r
- public override Type[] OutputTypes {\r
- get {\r
- if (output == null) {\r
- lock (this) {\r
- // this way the result is cached if called multiple time\r
- output = new Type [1];\r
- output[0] = typeof (System.IO.Stream);\r
- }\r
- }\r
- return output;\r
- }\r
- }\r
- protected override XmlNodeList GetInnerXml () \r
- {\r
- return null; // THIS IS DOCUMENTED AS SUCH\r
- }\r
-\r
- public override object GetOutput () \r
- {\r
- return (object) s;\r
- }\r
-\r
- public override object GetOutput (Type type) \r
- {\r
- if (type != typeof (Stream))\r
- throw new ArgumentException ("type");\r
- return GetOutput ();\r
- }\r
-\r
- public override void LoadInnerXml (XmlNodeList nodeList) \r
- {\r
- // documented as not changing the state of the transform\r
- }\r
-\r
- public override void LoadInput (object obj) \r
- {\r
- if (obj is Stream) {\r
- s = (obj as Stream);\r
- XmlDocument doc = new XmlDocument ();\r
- doc.PreserveWhitespace = true; // REALLY IMPORTANT\r
- doc.Load (obj as Stream);\r
- s = canonicalizer.Canonicalize (doc);\r
- } else if (obj is XmlDocument)\r
- s = canonicalizer.Canonicalize ((obj as XmlDocument));\r
- else if (obj is XmlNodeList)\r
- s = canonicalizer.Canonicalize ((obj as XmlNodeList));\r
- // note: there is no default are other types won't throw an exception\r
- }\r
- }\r
-}\r
+++ /dev/null
-//\r
-// XmlDsigExcC14NWithCommentsTransform.cs: \r
-// Handles WS-Security XmlDsigExcC14NWithCommentsTransform\r
-//\r
-// Author:\r
-// Sebastien Pouliot <sebastien@ximian.com>\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-// (C) 2004 Novell (http://www.novell.com)\r
-//\r
-\r
-using System;\r
-using System.Security.Cryptography.Xml;\r
-using System.Xml;\r
-\r
-namespace Microsoft.Web.Services.Security {\r
-\r
- public class XmlDsigExcC14NWithCommentsTransform : XmlDsigExcC14NTransform {\r
-\r
- public XmlDsigExcC14NWithCommentsTransform ()\r
- : base (true)\r
- {\r
- }\r
-\r
- public XmlDsigExcC14NWithCommentsTransform (string inclusiveNamespacesPrefixList) \r
- : base (true, inclusiveNamespacesPrefixList)\r
- {\r
- }\r
- }\r
-}\r
+++ /dev/null
-//\r
-// XmlEncryption.cs: Handles WS-Security XmlEncryption\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-// Licensed under MIT X11 (see LICENSE) with this specific addition:\r
-//\r
-// \93This source code may incorporate intellectual property owned by Microsoft \r
-// Corporation. Our provision of this source code does not include any licenses\r
-// or any other rights to you under any Microsoft intellectual property. If you\r
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need \r
-// to contact Microsoft directly.\94 \r
-//\r
-\r
-using System;\r
-\r
-namespace Microsoft.Web.Services.Security {\r
-\r
- public sealed class XmlEncryption {\r
-\r
- public sealed class AlgorithmURI {\r
-\r
- public const string AES128 = "http://www.w3.org/2001/04/xmlenc#aes128-cbc";\r
- public const string AES128KeyWrap = "http://www.w3.org/2001/04/xmlenc#kw-aes128";\r
- public const string AES192 = "http://www.w3.org/2001/04/xmlenc#aes192-cbc";\r
- public const string AES192KeyWrap = "http://www.w3.org/2001/04/xmlenc#kw-aes192";\r
- public const string AES256 = "http://www.w3.org/2001/04/xmlenc#aes256-cbc";\r
- public const string AES256KeyWrap = "http://www.w3.org/2001/04/xmlenc#kw-aes256";\r
- public const string DES = "http://www.w3.org/2001/04/xmlenc#des-cbc";\r
- public const string RSA15 = "http://www.w3.org/2001/04/xmlenc#rsa-1_5";\r
- public const string RSAOAEP = "http://www.w3.org/2001/04/xmlenc#rsa-aoep-mgf1pl";\r
- public const string SHA1 = "http://www.w3.org/2000/09/xmldsig#sha1";\r
- public const string SHA256 = "http://www.w3.org/2001/04/xmlenc#sha256";\r
- public const string SHA512 = "http://www.w3.org/2001/04/xmlenc#sha512";\r
- public const string TripleDES = "http://www.w3.org/2001/04/xmlenc#tripledes-cbc";\r
- public const string TripleDESKeyWrap = "http://www.w3.org/2001/04/xmlenc#kw-tripledes";\r
-\r
- public AlgorithmURI () {}\r
- }\r
-\r
- public sealed class AttributeNames {\r
-\r
- public const string Algorithm = "Algorithm";\r
- //LAMESPEC public const string EncodingType = "EncodingType";\r
- public const string Id = "Id";\r
- //LAMESPEC public const string IdentifierType = "IdentifierType";\r
- //LAMESPEC public const string TokenType = "TokenType";\r
- public const string Type = "Type";\r
- //LAMESPEC public const string Uri = "Uri";\r
- public const string URI = "URI";\r
- //LAMESPEC public const string ValueType = "ValueType";\r
-\r
- public AttributeNames () {}\r
- }\r
-\r
- // LAMESPEC ElementNames aren't documented\r
- public sealed class ElementNames {\r
-\r
- public const string CipherData = "CipherData";\r
- public const string CipherValue = "CipherValue";\r
- public const string DataReference = "DataReference";\r
- public const string EncryptedData = "EncryptedData";\r
- public const string EncryptedKey = "EncryptedKey";\r
- public const string EncryptionMethod = "EncryptionMethod";\r
- public const string ReferenceList = "ReferenceList";\r
-\r
- public ElementNames () {}\r
- }\r
-\r
- public sealed class TypeURI {\r
-\r
- public const string Content = "http://www.w3.org/2001/04/xmlenc#Content";\r
- public const string Element = "http://www.w3.org/2001/04/xmlenc#Element";\r
- public const string EncryptedKey = "http://www.w3.org/2001/04/xmlenc#EncryptedKey";\r
-\r
- public TypeURI () {}\r
- }\r
-\r
- public const string NamespaceURI = "http://www.w3.org/2001/04/xmlenc#";\r
- public const string Prefix = "xenc";\r
-\r
- public XmlEncryption () {}\r
- }\r
-}\r
+++ /dev/null
-//
-// 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 () {}
- }
-}
+++ /dev/null
-//
-// 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 () {}
- }
-}
+++ /dev/null
-//
-// 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 () {}
- }
-}
+++ /dev/null
-2003-10-22 Todd Berman <tberman@gentoo.org>
-
- * TimestampOutputFilter.cs: WSE2 Runtime fix
-
-2003-10-05 Sebastien Pouliot <spouliot@videotron.ca>
-
- * TimestampFormatException.cs: Use Locale.GetText and removed I18N todo.
-
-2003-09-04 Sebastien Pouliot <spouliot@videotron.ca>
-
- * TimestampFormatException.cs: Added missing strings and #if for WSE2.
+++ /dev/null
-//\r
-// Received.cs: \r
-// Handles WS-Security "Utility" Timestamp Received\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-// Licensed under MIT X11 (see LICENSE) with this specific addition:\r
-//\r
-// \93This source code may incorporate intellectual property owned by Microsoft \r
-// Corporation. Our provision of this source code does not include any licenses\r
-// or any other rights to you under any Microsoft intellectual property. If you\r
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need \r
-// to contact Microsoft directly.\94 \r
-//\r
-\r
-using System;\r
-using System.Xml;\r
-using Microsoft.Web.Services;\r
-#if !WSE1\r
-using Microsoft.Web.Services.Xml;\r
-#endif\r
-\r
-namespace Microsoft.Web.Services.Timestamp {\r
-\r
- public class Received : IXmlElement {\r
-\r
- private string id;\r
- private string idNS;\r
- private Uri actor;\r
- private long delay;\r
- private DateTime received;\r
-\r
- public Received (Uri actor) \r
- {\r
- if (actor == null)\r
- throw new ArgumentNullException ("actor");\r
- this.actor = actor;\r
- received = DateTime.UtcNow;\r
- }\r
-\r
- public Received (XmlElement element) \r
- {\r
- LoadXml (element);\r
- }\r
-\r
- public Uri Actor {\r
- get { return actor; }\r
- set { \r
- if (value == null)\r
- throw new ArgumentNullException ("actor");\r
- actor = value; \r
- }\r
- }\r
-\r
- public long Delay {\r
- get { return delay; }\r
- set { \r
- if (delay < 0)\r
- throw new ArgumentException ("negative delay");\r
- delay = value;\r
- }\r
- }\r
-\r
- public DateTime Value {\r
- get { return received; }\r
- set { received = value; }\r
- }\r
-\r
- public XmlElement GetXml (XmlDocument document) \r
- {\r
- if (document == null)\r
- throw new System.ArgumentNullException ("document");\r
-\r
- // much cleaner than using StringBuilder!\r
- XmlElement xel = document.CreateElement (WSTimestamp.Prefix, WSTimestamp.ElementNames.Received, WSTimestamp.NamespaceURI);\r
- // xel.SetAttribute (WSTimestamp.AttributeNames.Actor, actor.AbsoluteUri);\r
- if (delay > 0)\r
- xel.SetAttribute (WSTimestamp.AttributeNames.Delay, delay.ToString ());\r
- // FIXME: commented for WSE compatibility\r
- // if (id != null)\r
- // xel.SetAttribute (WSTimestamp.AttributeNames.Id, idNS, id);\r
- xel.InnerText = received.ToString (WSTimestamp.TimeFormat);\r
- return xel;\r
- }\r
-\r
- public void LoadXml (XmlElement element) \r
- {\r
- if (element == null)\r
- throw new System.ArgumentNullException ("element");\r
-\r
- if ((element.LocalName != WSTimestamp.ElementNames.Received) || (element.NamespaceURI != WSTimestamp.NamespaceURI))\r
- throw new System.ArgumentException ("invalid LocalName or NamespaceURI");\r
-\r
- XmlAttribute xa = element.Attributes [WSTimestamp.AttributeNames.Id, WSTimestamp.NamespaceURI];\r
- id = ((xa == null) ? null : xa.Value);\r
- idNS = ((xa == null) ? null : xa.NamespaceURI);\r
-\r
- xa = element.Attributes [WSTimestamp.AttributeNames.Actor];\r
- if (xa == null)\r
- throw new TimestampFormatException (TimestampFormatException.MissingActorAttributeInReceivedElement);\r
- string actorAttribute = xa.InnerText;\r
- if (actorAttribute == null)\r
- throw new TimestampFormatException (TimestampFormatException.MissingActorAttributeInReceivedElement);\r
- actor = new Uri (actorAttribute);\r
-\r
- xa = element.Attributes [WSTimestamp.AttributeNames.Delay];\r
- if (xa != null) {\r
- string delayAttribute = xa.InnerText;\r
- if (delayAttribute.StartsWith ("+"))\r
- throw new TimestampFormatException (TimestampFormatException.DelayAttributeWithPlusSign);\r
- try {\r
- delay = Convert.ToInt64 (delayAttribute);\r
- }\r
- catch {\r
- throw new TimestampFormatException (TimestampFormatException.BadDelayAttribute);\r
- }\r
- }\r
-\r
- received = DateTime.ParseExact (element.InnerText, WSTimestamp.TimeFormat, null);\r
- received = received.ToUniversalTime ();\r
- }\r
- }\r
-}\r
+++ /dev/null
-//\r
-// ReceivedCollection.cs: \r
-// Handles a collection of Received objects\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-// Licensed under MIT X11 (see LICENSE) with this specific addition:\r
-//\r
-// \93This source code may incorporate intellectual property owned by Microsoft \r
-// Corporation. Our provision of this source code does not include any licenses\r
-// or any other rights to you under any Microsoft intellectual property. If you\r
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need \r
-// to contact Microsoft directly.\94 \r
-//\r
-\r
-using System;\r
-using System.Collections;\r
-\r
-namespace Microsoft.Web.Services.Timestamp {\r
-\r
- public class ReceivedCollection : ICollection, IEnumerable {\r
-\r
- private ArrayList list;\r
-\r
- public ReceivedCollection()\r
- {\r
- list = new ArrayList ();\r
- }\r
-\r
- public int Count {\r
- get { return list.Count; }\r
- }\r
-\r
- public bool IsSynchronized {\r
- get { return list.IsSynchronized; }\r
- }\r
-\r
- public Received this [int index] {\r
- get { return (Received) list [index]; }\r
- }\r
-\r
- public object SyncRoot {\r
- get { return list.SyncRoot; }\r
- }\r
-\r
- public void Add (Received received)\r
- {\r
- if (received == null)\r
- throw new System.ArgumentNullException ("received");\r
- list.Add (received);\r
- }\r
-\r
- public bool Contains (Received received)\r
- {\r
- return list.Contains (received);\r
- }\r
-\r
- public void CopyTo (Array array, int index) \r
- {\r
- list.CopyTo (array, index);\r
- }\r
-\r
- public IEnumerator GetEnumerator () \r
- {\r
- return list.GetEnumerator ();\r
- }\r
-\r
- public void Remove (Received received) \r
- {\r
- list.Remove (received);\r
- }\r
- }\r
-}\r
+++ /dev/null
-//\r
-// Timestamp.cs: Handles WS-Security "Utility" Timestamp\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-// Licensed under MIT X11 (see LICENSE) with this specific addition:\r
-//\r
-// \93This source code may incorporate intellectual property owned by Microsoft \r
-// Corporation. Our provision of this source code does not include any licenses\r
-// or any other rights to you under any Microsoft intellectual property. If you\r
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need \r
-// to contact Microsoft directly.\94 \r
-//\r
-\r
-using System;\r
-using System.Web.Services.Protocols;\r
-using System.Xml;\r
-using Microsoft.Web.Services;\r
-#if !WSE1\r
-using Microsoft.Web.Services.Xml;\r
-#endif\r
-\r
-namespace Microsoft.Web.Services.Timestamp {\r
-\r
- // References\r
- // a. Web Services Security Addendum, Version 1.0, August 18, 2002\r
- // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnglobspec/html/ws-security.asp\r
-\r
- public class Timestamp : SoapHeader, IXmlElement {\r
-\r
- private string id;\r
- private string idNS;\r
- private DateTime created;\r
- private string createdId;\r
- private string createdIdNS;\r
- private DateTime expired;\r
- private string expiredId;\r
- private string expiredIdNS;\r
- private ReceivedCollection rcoll;\r
- private long timeToLive;\r
-\r
- public Timestamp () \r
- {\r
- created = DateTime.MinValue;\r
- expired = DateTime.MaxValue;\r
- timeToLive = 300000; // 5 minutes\r
- rcoll = new ReceivedCollection ();\r
- }\r
-\r
- // we must be able to fix both creation and expiration\r
- internal void SetTimestamp (DateTime c) \r
- {\r
- created = c;\r
- expired = created.AddMilliseconds (timeToLive);\r
- }\r
-\r
- public new string Actor {\r
- get { return base.Actor; }\r
- }\r
-\r
- public DateTime Created {\r
- get { return created; }\r
- }\r
-\r
- public DateTime Expires {\r
- get { return expired; }\r
- }\r
-\r
- public ReceivedCollection Receivers {\r
- get { return rcoll; }\r
- }\r
-\r
- public long Ttl {\r
- get { return timeToLive; }\r
- set {\r
- if (value < 0)\r
- throw new System.ArgumentException ("value");\r
- if (value == 0)\r
- expired = DateTime.MaxValue;\r
- timeToLive = value; \r
- }\r
- }\r
-\r
- // syntactically correct\r
- // no checks are done on the dates themselves !\r
- public void CheckValid () \r
- {\r
- if (created == DateTime.MinValue)\r
- throw new TimestampFormatException (TimestampFormatException.MissingCreatedElement);\r
- }\r
-\r
- public XmlElement GetXml (XmlDocument document) \r
- {\r
- if (document == null)\r
- throw new System.ArgumentNullException ("document");\r
-\r
- // much cleaner than using StringBuilder!\r
- XmlElement xel = document.CreateElement (WSTimestamp.Prefix, WSTimestamp.ElementNames.Timestamp, WSTimestamp.NamespaceURI);\r
- // FIXME: commented for WSE preview compatibility\r
- // if (id != null)\r
- // xel.SetAttribute (WSTimestamp.AttributeNames.Id, idNS, id);\r
-\r
- if (created != DateTime.MinValue) {\r
- XmlElement xelCreated = document.CreateElement (WSTimestamp.Prefix, WSTimestamp.ElementNames.Created, WSTimestamp.NamespaceURI);\r
- xelCreated.InnerText = created.ToString (WSTimestamp.TimeFormat);\r
- if (createdId != null)\r
- xelCreated.SetAttribute (WSTimestamp.AttributeNames.Id, createdIdNS, createdId);\r
- xel.AppendChild (xelCreated);\r
- }\r
- if (expired != DateTime.MaxValue) {\r
- XmlElement xelExpires = document.CreateElement (WSTimestamp.Prefix, WSTimestamp.ElementNames.Expires, WSTimestamp.NamespaceURI);\r
- xelExpires.InnerText = expired.ToString (WSTimestamp.TimeFormat);\r
- if (expiredId != null)\r
- xelExpires.SetAttribute (WSTimestamp.AttributeNames.Id, expiredIdNS, expiredId);\r
- xel.AppendChild (xelExpires);\r
- }\r
- for (int i=0; i < rcoll.Count ; i++) \r
- {\r
- XmlElement received = rcoll[i].GetXml (document);\r
- xel.AppendChild (received);\r
- }\r
- return xel;\r
- }\r
-\r
- public void LoadXml (XmlElement element) \r
- {\r
- if (element == null)\r
- throw new System.ArgumentNullException ("element");\r
-\r
- if ((element.LocalName != WSTimestamp.ElementNames.Timestamp) || (element.NamespaceURI != WSTimestamp.NamespaceURI))\r
- throw new System.ArgumentException ("invalid LocalName or NamespaceURI");\r
-\r
- XmlAttribute xa = element.Attributes [WSTimestamp.AttributeNames.Id, WSTimestamp.NamespaceURI];\r
- id = ((xa == null) ? null : xa.Value);\r
- idNS = ((xa == null) ? null : xa.NamespaceURI);\r
-\r
- XmlNodeList xnl = element.GetElementsByTagName (WSTimestamp.ElementNames.Created, WSTimestamp.NamespaceURI);\r
- if (xnl != null) {\r
- switch (xnl.Count) {\r
- case 0:\r
-// throw new TimestampFormatException (TimestampFormatException.MissingCreatedElement);\r
- break;\r
- case 1:\r
- created = DateTime.ParseExact (xnl[0].InnerText, WSTimestamp.TimeFormat, null);\r
- created = created.ToUniversalTime ();\r
- xa = xnl[0].Attributes [WSTimestamp.AttributeNames.Id, WSTimestamp.NamespaceURI];\r
- createdId = ((xa == null) ? null : xa.Value);\r
- createdIdNS = ((xa == null) ? null : xa.NamespaceURI);\r
- break;\r
- default:\r
- throw new TimestampFormatException (TimestampFormatException.DuplicateCreatedElement);\r
- }\r
- }\r
-\r
- xnl = element.GetElementsByTagName (WSTimestamp.ElementNames.Expires, WSTimestamp.NamespaceURI);\r
- if (xnl != null) {\r
- switch (xnl.Count) {\r
- case 0:\r
-// throw new TimestampFormatException (TimestampFormatException.MissingCreatedElement);\r
- break;\r
- case 1:\r
- expired = DateTime.ParseExact (xnl[0].InnerText, WSTimestamp.TimeFormat, null);\r
- expired = expired.ToUniversalTime ();\r
- xa = xnl[0].Attributes [WSTimestamp.AttributeNames.Id, WSTimestamp.NamespaceURI];\r
- expiredId = ((xa == null) ? null : xa.Value);\r
- expiredIdNS = ((xa == null) ? null : xa.NamespaceURI);\r
- break;\r
- default:\r
- throw new TimestampFormatException (TimestampFormatException.DuplicateCreatedElement);\r
- }\r
- }\r
-\r
- xnl = element.GetElementsByTagName (WSTimestamp.ElementNames.Received, WSTimestamp.NamespaceURI);\r
- if (xnl != null) {\r
- for (int i=0; i < xnl.Count; i++) {\r
- Received r = new Received ((XmlElement)xnl [i]);\r
- rcoll.Add (r);\r
- }\r
- }\r
- }\r
- }\r
-}\r
+++ /dev/null
-//\r
-// TimestampFault.cs: Undocument exception when message expires\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-// Licensed under MIT X11 (see LICENSE) with this specific addition:\r
-//\r
-// \93This source code may incorporate intellectual property owned by Microsoft \r
-// Corporation. Our provision of this source code does not include any licenses\r
-// or any other rights to you under any Microsoft intellectual property. If you\r
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need \r
-// to contact Microsoft directly.\94 \r
-//\r
-\r
-using System;\r
-using System.Web.Services.Protocols;\r
-using System.Xml;\r
-\r
-namespace Microsoft.Web.Services.Timestamp {\r
-\r
- internal class TimestampFault : SoapHeaderException {\r
-\r
- public TimestampFault (string message, XmlQualifiedName code) : base (message, code) {}\r
- }\r
-}\r
+++ /dev/null
-//
-// Microsoft.Web.Services.Timestamp.TimestampFormatException.cs
-//
-// Authors:
-// Daniel Kornhauser <dkor@alum.mit.edu>
-// 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
- }
-}
+++ /dev/null
-//\r
-// TimestampInputFilter.cs: Timestamp SOAP Input Filter\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-// Licensed under MIT X11 (see LICENSE) with this specific addition:\r
-//\r
-// \93This source code may incorporate intellectual property owned by Microsoft \r
-// Corporation. Our provision of this source code does not include any licenses\r
-// or any other rights to you under any Microsoft intellectual property. If you\r
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need \r
-// to contact Microsoft directly.\94 \r
-//\r
-\r
-using System;\r
-using System.Xml;\r
-\r
-namespace Microsoft.Web.Services.Timestamp {\r
-\r
- // Reference:\r
- // 1. Inside the Web Services Enhancements Pipeline\r
- // http://msdn.microsoft.com/library/en-us/dnwebsrv/html/insidewsepipe.asp\r
-\r
- public class TimestampInputFilter : SoapInputFilter {\r
-\r
- public TimestampInputFilter () {}\r
-\r
- public override void ProcessMessage (SoapEnvelope envelope) \r
- {\r
- if (envelope == null)\r
- throw new ArgumentNullException ("envelope");\r
-\r
- if (envelope.Header != null) {\r
- XmlNodeList xnl = envelope.Header.GetElementsByTagName (WSTimestamp.ElementNames.Timestamp, WSTimestamp.NamespaceURI);\r
- if ((xnl != null) && (xnl.Count > 0)) {\r
- XmlElement xel = (XmlElement) xnl [0];\r
- envelope.Context.Timestamp.LoadXml (xel);\r
- if (envelope.Context.Timestamp.Expires < DateTime.UtcNow)\r
- throw new TimestampFault ("Message Expired", null);\r
- envelope.Header.RemoveChild (xel);\r
- }\r
- }\r
- }\r
- }\r
-}\r
+++ /dev/null
-//\r
-// TimestampOutputFilter.cs: Timestamp SOAP Output Filter\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-// Licensed under MIT X11 (see LICENSE) with this specific addition:\r
-//\r
-// \93This source code may incorporate intellectual property owned by Microsoft \r
-// Corporation. Our provision of this source code does not include any licenses\r
-// or any other rights to you under any Microsoft intellectual property. If you\r
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need \r
-// to contact Microsoft directly.\94 \r
-//\r
-\r
-using System;\r
-using System.Xml;\r
-\r
-namespace Microsoft.Web.Services.Timestamp {\r
-\r
- public class TimestampOutputFilter : SoapOutputFilter {\r
-\r
- public TimestampOutputFilter () {}\r
-\r
- public override void ProcessMessage (SoapEnvelope envelope) \r
- {\r
- if (envelope == null)\r
- throw new ArgumentNullException ("envelope");\r
-\r
- // internal method\r
- envelope.Context.Timestamp.SetTimestamp (DateTime.UtcNow);\r
- XmlElement xel = envelope.Context.Timestamp.GetXml (envelope);\r
- if (envelope.Header == null) {\r
- XmlElement header = envelope.CreateHeader ();\r
- envelope.Envelope.PrependChild (xel);\r
- }\r
- envelope.Header.AppendChild (xel);\r
- }\r
-\r
- }\r
-}\r
+++ /dev/null
-//\r
-// WSTimestamp.cs: WSTimestamp definitions\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-// Licensed under MIT X11 (see LICENSE) with this specific addition:\r
-//\r
-// \93This source code may incorporate intellectual property owned by Microsoft \r
-// Corporation. Our provision of this source code does not include any licenses\r
-// or any other rights to you under any Microsoft intellectual property. If you\r
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need \r
-// to contact Microsoft directly.\94\r
-//\r
-\r
-using System;\r
-\r
-namespace Microsoft.Web.Services.Timestamp {\r
-\r
- public class WSTimestamp {\r
-\r
- public class AttributeNames {\r
-\r
- public const string Actor = "Actor";\r
- public const string Delay = "Delay";\r
- public const string Id = "Id";\r
- public const string ValueType = "ValueType";\r
-\r
- public AttributeNames () {}\r
- }\r
-\r
- public class ElementNames {\r
-\r
- public const string Created = "Created";\r
- public const string Expires = "Expires";\r
- public const string Received = "Received";\r
- public const string Timestamp = "Timestamp";\r
-\r
- public ElementNames () {}\r
- }\r
-\r
- public const string NamespaceURI = "http://schemas.xmlsoap.org/ws/2002/07/utility";\r
- public const string Prefix = "wsu";\r
- public const string TimeFormat = "yyyy-MM-ddTHH:mm:ssZ";\r
-\r
- public WSTimestamp () {}\r
- }\r
-}\r
+++ /dev/null
-2003-10-12 Todd Berman <tberman@gentoo.org>
-
- * QualifiedName.cs (FromString): fix from nunit tests
-
-2003-10-08 Todd Berman <tberman@gentoo.org>
-
- * QualifiedName.cs: Initial implementation of FromString.
-
-2003-10-07 Todd Berman <tberman@gentoo.org>
-
- * OpenElementElement.cs: implemented
- * OpenElement.cs: implemented
-
-2003-10-05 Todd Berman <tberman@gentoo.org>
-
- * QualifiedName.cs: implemented.
- * ChangeLog: added.
+++ /dev/null
-//
-// 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);
- }
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Xml.OpenAttributeElement.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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; }
- }
-
- }
-
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Xml.OpenElement.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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; }
- }
- }
-
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Xml.OpenElementElement.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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; }
- }
- }
-}
+++ /dev/null
-//
-// Microsoft.Web.Services.Xml.QualifiedName.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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; }
- }
- }
-}
+++ /dev/null
-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
+++ /dev/null
-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
+++ /dev/null
-//
-// Microsoft.Web.Services.AsyncResult.cs
-//
-// Author: Todd Berman <tberman@gentoo.org>
-//
-// (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; }
- }
- }
-}
+++ /dev/null
-//
-// 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 ();
- }
- }
- }
-}
+++ /dev/null
-2003-10-26 Sebastien Pouliot <spouliot@videotron.ca>
-
- * SoapWebResponse.cs: Fixed the wrong context (re-used request).
- * WebServicesClientProtocol.cs: Fixed null pipeline in requests.
-
-2003-10-25 Sebastien Pouliot <spouliot@videotron.ca>
-
- * SoapContext.cs: Now construct the SecurityCollection for
- ExtendedSecurity when null.
-
-2003-10-25 Todd Berman <tberman@gentoo.org>
-
- * AsyncResult.cs: csc fixes
- * SoapContext.cs: csc fixes
-
-2003-10-22 Todd Berman <tberman@gentoo.org>
-
- * 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 <spouliot@videotron.ca>
-
- * 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 <spouliot@videotron.ca>
-
- * SoapContext.cs: Oops - nuked tberman changes :( reapplied
-
-2003-10-04 Sebastien Pouliot <spouliot@videotron.ca>
-
- * 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 <spouliot@videotron.ca>
-
- * Pipeline.cs: Uncommented Microsoft.Web.Services.Configuration;
+++ /dev/null
-//\r
-// HttpSoapContext.cs: Http Soap Contexts\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-\r
-using System;\r
-\r
-namespace Microsoft.Web.Services {\r
-\r
- public sealed class HttpSoapContext {\r
-\r
- // must have an internal one or a public one will be created (winchurn)\r
- internal HttpSoapContext () {}\r
-\r
- [MonoTODO("ASP.NET related")]\r
- public static SoapContext RequestContext { \r
- get { return null; }\r
- }\r
-\r
- [MonoTODO("ASP.NET related")]\r
- public static SoapContext ResponseContext { \r
- get { return null; }\r
- }\r
- }\r
-}\r
+++ /dev/null
-//\r
-// IXmlElement.cs: Interface IXmlElement\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-\r
-using System.Xml;\r
-\r
-namespace Microsoft.Web.Services {\r
-\r
- public interface IXmlElement {\r
-\r
- XmlElement GetXml (XmlDocument document);\r
-\r
- void LoadXml (XmlElement element);\r
- }\r
-}\r
+++ /dev/null
-//
-// 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);
- }
- }
-}
+++ /dev/null
-//\r
-// Soap.cs: SOAP definitions for WSE\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-\r
-using System;\r
-\r
-namespace Microsoft.Web.Services {\r
-\r
- public class Soap {\r
-\r
- public class AttributeNames {\r
-\r
- public const string Actor = "actor";\r
- public const string MustUnderstand = "mustUnderstand";\r
-\r
- public AttributeNames() {}\r
- }\r
-\r
- public class ElementNames {\r
- public const string Body = "Body";\r
- public const string Envelope = "Envelope";\r
- public const string Fault = "Fault";\r
- public const string FaultActor = "faultactor";\r
- public const string FaultCode = "faultcode";\r
- public const string FaultDetail = "detail";\r
- public const string FaultString = "faultstring";\r
- public const string Header = "Header";\r
- public const string Message = "Message";\r
- public const string StackTrace = "StackTrace";\r
-\r
- public ElementNames () {}\r
- }\r
-\r
- public const string ActorNext = "http://schemas.xmlsoap.org/soap/actor/next";\r
- public static readonly Uri ActorNextURI = new Uri (ActorNext);\r
-\r
- public const string DimeContentType = "application/dime";\r
- public const string FaultNamespaceURI = "http://schemas.microsoft.com/wsdk/2002/10/";\r
- public const string NamespaceURI = "http://schemas.xmlsoap.org/soap/envelope/";\r
- public const string Prefix = "soap";\r
- public const string SoapContentType = "text/xml";\r
-\r
- public Soap() {}\r
- }\r
-}\r
+++ /dev/null
-//
-// 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);
- }
- }
-}
+++ /dev/null
-//
-// 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
- }
- }
-}
+++ /dev/null
-//\r
-// SoapFault.cs: Implements SoapFault\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-\r
-using System;\r
-\r
-namespace Microsoft.Web.Services {\r
-\r
- [Serializable]\r
- public class SoapFault {\r
-\r
- public const string InvalidSoapMessage = "Invalid Soap Message";\r
- public const string InvalidXmlMessage = "Invalid Xml Message";\r
- public const string ServerUnavailable = "Server Unavailable";\r
-\r
- public SoapFault () {}\r
- }\r
-}\r
+++ /dev/null
-// Microsoft.Web.Services.SoapFormatException.cs
-//
-// Author: Daniel Kornhauser <dkor@alum.mit.edu>
-//
-// (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)
- {
- }
- }
-}
+++ /dev/null
-//\r
-// SoapIntputFilter.cs: SOAP Input Filter\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-\r
-using System;\r
-using System.Xml;\r
-\r
-namespace Microsoft.Web.Services {\r
-\r
- public abstract class SoapInputFilter {\r
-\r
- public SoapInputFilter () {}\r
-\r
- [MonoTODO("always return true - for now")]\r
- protected virtual bool CanProcessHeader (XmlElement header, SoapContext context) \r
- {\r
- if (header == null)\r
- throw new ArgumentNullException ("header");\r
- if (context == null)\r
- throw new ArgumentNullException ("context");\r
- // The header can be processed if any of the following conditions are true: \r
- // 1. Actor is equal to ActorNext.\r
- if (context.Actor.AbsoluteUri == Soap.ActorNext)\r
- return true;\r
- // 2. Actor matches this node. \r
- // 3. Actor is empty and the IsIntermediary property of context is false. \r
- //if ((context.Actor == null) && (context.IsIntermediary))\r
- return true;\r
- //return false;\r
- }\r
- \r
- public abstract void ProcessMessage (SoapEnvelope envelope);\r
- } \r
-}\r
+++ /dev/null
-//
-// 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++;
- }
- }
- }
-}
+++ /dev/null
-//\r
-// SoapOutputFilter.cs: SOAP Output Filter\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-\r
-using System;\r
-\r
-namespace Microsoft.Web.Services {\r
-\r
- public abstract class SoapOutputFilter {\r
-\r
- public SoapOutputFilter () {}\r
-\r
- public abstract void ProcessMessage (SoapEnvelope envelope);\r
- } \r
-}\r
+++ /dev/null
-//
-// 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++;
- }
- }
- }
-}
+++ /dev/null
-//
-// 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; }
- }
- }
-}
+++ /dev/null
-//
-// 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; }
- }
- }
-}
+++ /dev/null
-//\r
-// UriList.cs: Uri List\r
-//\r
-// Author:\r
-// Sebastien Pouliot (spouliot@motus.com)\r
-//\r
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)\r
-//\r
-\r
-using System;\r
-using System.Collections;\r
-\r
-namespace Microsoft.Web.Services {\r
-\r
- public class UriList : ICollection {\r
-\r
- private ArrayList list;\r
-\r
- public UriList () \r
- {\r
- list = new ArrayList ();\r
- }\r
-\r
- public int Add (Uri uri) \r
- {\r
- return list.Add (uri);\r
- }\r
-\r
- public bool Contains (Uri uri) \r
- {\r
- return list.Contains (uri);\r
- }\r
-\r
- public void CopyTo (Array array, int index) \r
- {\r
- list.CopyTo (array, index);\r
- }\r
-\r
- public IEnumerator GetEnumerator () \r
- {\r
- return list.GetEnumerator ();\r
- }\r
-\r
- public int IndexOf (Uri uri) \r
- {\r
- return list.IndexOf (uri);\r
- }\r
-\r
- public void Insert (int index, Uri uri) \r
- {\r
- list.Insert (index, uri);\r
- }\r
-\r
- public void Remove (Uri uri) \r
- {\r
- list.Remove (uri);\r
- }\r
-\r
- public void RemoveAt (int index)\r
- {\r
- list.RemoveAt (index);\r
- }\r
-\r
- public int Count { \r
- get { return list.Count; }\r
- }\r
-\r
- public bool IsFixedSize { \r
- get { return list.IsFixedSize; }\r
- }\r
-\r
- public bool IsReadOnly { \r
- get { return list.IsReadOnly; }\r
- }\r
-\r
- public bool IsSynchronized { \r
- get { return list.IsSynchronized; }\r
- }\r
-\r
- public Uri this [int index] { \r
- get { return (Uri) list [index]; }\r
- set { list [index] = value; }\r
- }\r
-\r
- public object SyncRoot { \r
- get { return list.SyncRoot; }\r
- }\r
- } \r
-}\r
+++ /dev/null
-//
-// 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;
- }
- }
-}
+++ /dev/null
-//
-// 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;
- }
- }
- }
-}
+++ /dev/null
-2004-03-30 Sebastien Pouliot <sebastien@ximian.com>
-
- * XmlCanonicalizer.cs: New. Copy of System.Security assembly.
- Original by Aleksey Sanin. Modified by Atsushi Enomoto.
+++ /dev/null
-//
-// 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 ("</");
- res.Append (node.Name);
- 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 (<!--), the string value of the node, and the
- // closing 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<!--");
- else
- res.Append ("<!--");
-
- res.Append (NormalizeString (node.Value, XmlNodeType.Comment));
-
- if (state == XmlCanonicalizerState.BeforeDocElement)
- res.Append ("-->\x0A");
- else
- res.Append ("-->");
- }
- }
-
- // Processing Instruction (PI) Nodes-
- // The opening PI symbol (<?), the PI target name of the node,
- // a leading space and the string value if it is not empty, and
- // the closing 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<?");
- else
- res.Append ("<?");
-
- res.Append (node.Name);
- if (node.Value.Length > 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);
- }
- }
-}
-
+++ /dev/null
-using System;\r
-using NUnit.Framework;\r
-using System.Xml;\r
-using Microsoft.Web.Services;\r
-\r
-namespace Microsoft.Web.Services.Addressing.Tests\r
-{\r
- \r
- [TestFixture]\r
- public class ActionTest\r
- {\r
- \r
- [Test]\r
- public void CreateAction ()\r
- {\r
- Action a = new Action("urn:action:test");\r
- Assert.IsTrue (a.Value == "urn:action:test");\r
- }\r
- \r
- [Test]\r
- public void ActionToXml ()\r
- {\r
- Action a = new Action("urn:action:test");\r
- XmlElement element = a.GetXml(new XmlDocument());\r
- Assert.IsTrue (element.OuterXml.Length != 0);\r
- }\r
- \r
- [Test]\r
- public void XmlToAction ()\r
- {\r
- XmlDocument document = new XmlDocument ();\r
- \r
- XmlElement element = document.CreateElement("wsa", "Action", "http://schemas.xmlsoap.org/ws/2003/03/addressing");\r
- element.InnerText = "urn:action:test";\r
- \r
- Action a = new Action (element);\r
- \r
- Assert.IsTrue (a.Value == "urn:action:test");\r
- }\r
- \r
- [Test]\r
- public void RoundTripFromAction ()\r
- {\r
- Action a = new Action ("urn:action:test");\r
- XmlElement element = a.GetXml(new XmlDocument());\r
- \r
- Action b = new Action (element);\r
- \r
- Assert.IsTrue (b.Value == "urn:action:test");\r
- }\r
- \r
- [Test]\r
- public void RoundTripFromXml ()\r
- {\r
- XmlDocument document = new XmlDocument ();\r
- \r
- XmlElement element = document.CreateElement("wsa", "Action", "http://schemas.xmlsoap.org/ws/2003/03/addressing");\r
- element.InnerText = "urn:action:test";\r
- \r
- Action a = new Action (element);\r
- \r
- XmlElement element2 = a.GetXml(new XmlDocument ());\r
- \r
- Assert.IsTrue (element.OuterXml == element2.OuterXml);\r
- \r
- }\r
- \r
- [Test]\r
- public void ImplicitString ()\r
- {\r
- Action a = new Action ("urn:action:test");\r
- \r
- Assert.IsTrue ("urn:action:test" == a);\r
- }\r
- \r
- [Test]\r
- public void ImplicitAction ()\r
- {\r
- Action a = "urn:action:test";\r
- \r
- Assert.IsTrue ("urn:action:test" == a);\r
- \r
- }\r
- \r
- [Test]\r
- [ExpectedException(typeof(ArgumentException))]\r
- public void InvalidElementExceptionTest ()\r
- {\r
- XmlDocument doc = new XmlDocument ();\r
- \r
- XmlElement el = doc.CreateElement("b", "a", "d");\r
- \r
- Action a = new Action (el);\r
- }\r
- \r
- }\r
- \r
- \r
-}\r
+++ /dev/null
-using System;\r
-using System.Xml;\r
-using NUnit.Framework;\r
-using Microsoft.Web.Services.Addressing;\r
-\r
-namespace Microsoft.Web.Services.Addressing.Tests\r
-{\r
- \r
- [TestFixture]\r
- public class AddressTests\r
- {\r
- \r
- [Test]\r
- public void CreateAddress ()\r
- {\r
- Address a = new Address (new Uri("soap.tcp://127.0.0.1/"));\r
- Assert.IsNotNull (a);\r
- }\r
- \r
- [Test]\r
- public void AddressToXml ()\r
- {\r
- Address a = new Address (new Uri("soap.tcp://127.0.0.1/"));\r
- XmlElement e = a.GetXml (new XmlDocument ());\r
- \r
- Assert.IsTrue (e.OuterXml.Length != 0);\r
- }\r
- \r
- [Test]\r
- public void XmlToAddress ()\r
- {\r
- XmlDocument doc = new XmlDocument ();\r
- XmlElement e = doc.CreateElement ("wsa", "Address", "http://schemas.xmlsoap.org/ws/2003/03/addressing");\r
- \r
- e.InnerText = "soap.tcp://127.0.0.1/";\r
- \r
- Address a = new Address (e);\r
- \r
- Assert.IsTrue (a.Value.AbsoluteUri == e.InnerText);\r
- }\r
- \r
- [Test]\r
- public void RoundTripFromAddress ()\r
- {\r
- Address a = new Address (new Uri("soap.tcp://127.0.0.1"));\r
- \r
- XmlElement e = a.GetXml (new XmlDocument ());\r
- \r
- Address b = new Address (e);\r
- \r
- Assert.IsTrue (a.Value.AbsoluteUri == b.Value.AbsoluteUri);\r
- }\r
- \r
- [Test]\r
- public void RoundTripFromXml ()\r
- {\r
- XmlDocument doc = new XmlDocument ();\r
- XmlElement e = doc.CreateElement ("wsa", "Address", "http://schemas.xmlsoap.org/ws/2003/03/addressing");\r
- \r
- e.InnerText = "soap.tcp://127.0.0.1/";\r
- \r
- Address a = new Address (e);\r
- \r
- XmlElement e2 = a.GetXml (new XmlDocument ());\r
- \r
- Assert.IsTrue (e.OuterXml == e2.OuterXml);\r
- }\r
- \r
- [Test]\r
- public void ImplicitUri ()\r
- {\r
- Uri u = new Uri ("soap.tcp://127.0.0.1/");\r
- \r
- Address a = new Address(u);\r
- \r
- Assert.IsTrue (u.AbsoluteUri == ((Uri)a).AbsoluteUri);\r
- }\r
- \r
- [Test]\r
- public void ImplicitAddress ()\r
- {\r
- Uri u = new Uri ("soap.tcp://127.0.0.1");\r
- \r
- Address a = new Address (u);\r
- \r
- Assert.AreEqual (u, (Uri)a);\r
- }\r
- \r
- [Test]\r
- [ExpectedException(typeof(ArgumentException))]\r
- public void InvalidArgumentException()\r
- {\r
- XmlDocument document = new XmlDocument ();\r
- XmlElement e = document.CreateElement ("b", "a", "d");\r
- \r
- Address a = new Address (e);\r
- }\r
- \r
- }\r
- \r
-}\r
+++ /dev/null
-using System;\r
-using NUnit.Framework;\r
-using Microsoft.Web.Services.Addressing;\r
-\r
-namespace Microsoft.Web.Services.Addressing.Tests\r
-{\r
- [TestFixture]\r
- public class AddressListTests\r
- {\r
- [Test]\r
- public void NoTestsYet ()\r
- {\r
- }\r
- }\r
-}\r
+++ /dev/null
-using System;\r
-using NUnit.Framework;\r
-using Microsoft.Web.Services.Addressing;\r
-\r
-namespace Microsoft.Web.Services.Addressing.Tests\r
-{\r
- \r
- [TestFixture]\r
- public class AddressingHeadersTest\r
- {\r
- \r
- [Test]\r
- public void NoTestsYet ()\r
- {\r
- }\r
- \r
- }\r
- \r
-}\r
+++ /dev/null
-using System;\r
-using System.Xml;\r
-using NUnit.Framework;\r
-using Microsoft.Web.Services.Xml;\r
-using Microsoft.Web.Services.Addressing;\r
-\r
-namespace Microsoft.Web.Services.Addressing.Tests\r
-{\r
- [TestFixture]\r
- public class EndpointReferenceTests\r
- {\r
- \r
- [Test]\r
- public void CreateEndpointReferenceFromAddress ()\r
- {\r
- EndpointReference e = new EndpointReference( new Address ( new Uri ("soap.tcp://127.0.0.1") ) );\r
- \r
- Assert.IsNotNull (e.Address.Value);\r
- }\r
- \r
- [Test]\r
- public void CreateEndpointReferenceFromUri ()\r
- {\r
- EndpointReference e = new EndpointReference( new Uri ("soap.tcp://127.0.0.1") );\r
- \r
- Assert.IsNotNull (e.Address.Value);\r
- }\r
- \r
- [Test]\r
- public void MinimalXmlToEndpointReference ()\r
- {\r
- XmlDocument doc = new XmlDocument ();\r
- XmlElement element = doc.CreateElement ("wsa", "EndpointReference", "http://schemas.xmlsoap.org/ws/2003/03/addressing");\r
- \r
- Address a = new Address ( new Uri ("soap.tcp://127.0.0.1") );\r
- \r
- element.AppendChild (a.GetXml (doc));\r
- \r
- EndpointReference e = new EndpointReference (element);\r
- }\r
- \r
- [Test]\r
- public void EndpointReferenceToMinimalXml ()\r
- {\r
- EndpointReference e = new EndpointReference ( new Uri ("soap.tcp://127.0.0.1/") );\r
- XmlElement e2 = e.GetXml (new XmlDocument ());\r
- \r
- Assert.IsTrue (e2.FirstChild.InnerText == "soap.tcp://127.0.0.1/");\r
- }\r
- \r
- [Test]\r
- public void EndpointReferenceToXmlWithPortType ()\r
- {\r
- EndpointReference e = new EndpointReference ( new Uri ("soap.tcp://127.0.0.1/") );\r
- e.PortType = new PortType (new QualifiedName ("a","s","http://schemas.xmlsoap.org/ws/2003/03/addressing"));\r
- \r
- XmlElement element = e.GetXml (new XmlDocument ());\r
- \r
- Assert.IsTrue (element.FirstChild.NextSibling.InnerText == "a:s");\r
- }\r
- \r
- [Test]\r
- public void EndpointReferenceToXmlWithProperties ()\r
- {\r
- EndpointReference e = new EndpointReference (new Uri ("soap.tcp://127.0.0.1/") );\r
- e.ReferenceProperties = new ReferenceProperties ();\r
- \r
- XmlElement element = e.GetXml (new XmlDocument ());\r
- \r
- Assert.IsTrue (element.FirstChild.NextSibling.LocalName == "ReferenceProperties");\r
- }\r
- \r
- [Test]\r
- public void EndpointReferenceToXmlWithServiceName ()\r
- {\r
- EndpointReference e = new EndpointReference (new Uri ("soap.tcp://127.0.0.1/") );\r
- e.ServiceName = new ServiceName( new QualifiedName ("a", "s", "http://schemas.xmlsoap.org/ws/2003/03/addressing"));\r
- e.ServiceName.PortName = "test";\r
- \r
- XmlElement element = e.GetXml (new XmlDocument ());\r
- \r
- Assert.IsTrue (element.FirstChild.NextSibling.Attributes["wsa:PortName"].InnerText == "test");\r
- }\r
- \r
- [Test]\r
- public void RoundTripFromXml ()\r
- {\r
- XmlDocument doc = new XmlDocument ();\r
- XmlElement element = doc.CreateElement ("wsa", "EndpointReference", "http://schemas.xmlsoap.org/ws/2003/03/addressing");\r
- \r
- Address a = new Address ( new Uri ("soap.tcp://127.0.0.1") );\r
- \r
- element.AppendChild (a.GetXml (doc));\r
- \r
- PortType p = new PortType (new QualifiedName ("wsa", "test", "http://schemas.xmlsoap.org/ws/2003/03/addressing"));\r
- \r
- element.AppendChild (p.GetXml (doc));\r
- \r
- EndpointReference e = new EndpointReference (element);\r
- \r
- XmlElement e2 = e.GetXml (new XmlDocument ());\r
- \r
- Assert.IsNotNull (element);\r
- Assert.IsNotNull (e2);\r
- \r
- Assert.IsTrue (element.OuterXml == e2.OuterXml);\r
- }\r
- \r
- [Test]\r
- public void RoundTripFromEndpointReference ()\r
- {\r
- EndpointReference e = new EndpointReference ( new Uri ("soap.tcp://127.0.0.1/") );\r
- XmlElement e2 = e.GetXml (new XmlDocument ());\r
- \r
- EndpointReference er = new EndpointReference (e2);\r
- \r
- Assert.IsTrue (e.Address.Value.AbsoluteUri == er.Address.Value.AbsoluteUri);\r
- }\r
- \r
- //Not going to bother testing the implicit operators, they work fine.\r
- \r
- }\r
-}\r
+++ /dev/null
-2003-09-14 Sebastien Pouliot <spouliot@videotron.ca>
-
- * 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.
+++ /dev/null
-//
-// 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 = "<node attrib=\"value\"/>";
- 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 = "<test><childnode/></test>";
- XmlDocument doc = new XmlDocument ();
- doc.LoadXml (xml);
- CheckForChildNodes (doc.DocumentElement);
- }
-
- [Test]
- public void CheckForDuplicateChildNodes_NoDupes ()
- {
- string xml = "<test><childnode/></test>";
- 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 = "<test><childnode/><childnode/></test>";
- XmlDocument doc = new XmlDocument ();
- doc.LoadXml (xml);
- CheckForDuplicateChildNodes (doc.DocumentElement);
- }
-
- [Test]
- public void CheckForUnrecognizedAttributes_NoAttribute ()
- {
- string xml = "<node/>";
- 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 = "<test attrib=\"value\"/>";
- XmlDocument doc = new XmlDocument ();
- doc.LoadXml (xml);
- CheckForUnrecognizedAttributes (doc.DocumentElement);
- }
-
- [Test]
- public void GetAndRemoveAttribute_AttribPresentNotRequired ()
- {
- string xml = "<test attrib=\"value\"/>";
- 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 = "<test attrib=\"value\"/>";
- 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 = "<test/>";
- 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 = "<test/>";
- 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 = "<test/>";
- 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 = "<test attrib=\"true\"/>";
- 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 = "<test attrib=\"true\"/>";
- 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 = "<test/>";
- 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 = "<test/>";
- 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 = "<test/>";
- 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 = "<test attrib=\"true\"/>";
- 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 = "<test attrib=\"true\"/>";
- 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 = "<test/>";
- 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 = "<test/>";
- 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 = "<test/>";
- 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 = "<element><!-- comment --></element>";
- 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 = "<element/>";
- XmlDocument doc = new XmlDocument ();
- doc.LoadXml (xml);
- ThrowIfElement (doc.DocumentElement);
- }
-
- [Test]
- public void ThrowIfNotComment_NoComment ()
- {
- string xml = "<element><!-- comment --></element>";
- 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 = "<element/>";
- XmlDocument doc = new XmlDocument ();
- doc.LoadXml (xml);
- ThrowIfNotComment (doc.DocumentElement);
- }
- }
-}
+++ /dev/null
-//
-// 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);
- }
- }
-}
+++ /dev/null
-//
-// 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);
- }
- }
-}
+++ /dev/null
-//
-// 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;
- }
- }
-}
+++ /dev/null
-//
-// 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
+++ /dev/null
-//
-// 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
+++ /dev/null
-//
-// 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 ("<Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><SignedInfo><CanonicalizationMethod Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\" /><SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#dsa-sha1\" /><Reference URI=\"http://www.go-mono.com/\"><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><DigestValue>JjDjPDymSPahf7zC6CCqaTz39uQ=</DigestValue></Reference></SignedInfo><SignatureValue>j2Rl0vEKoKbRfOTtEZvYoNSdiJdkCfN+FfuMntTqVMmYFFtl/nWExg==</SignatureValue></Signature>");
- 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 ("<Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><SignedInfo><CanonicalizationMethod Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\" /><SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\" /><Reference URI=\"http://www.go-mono.com/\"><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><DigestValue>JjDjPDymSPahf7zC6CCqaTz39uQ=</DigestValue></Reference></SignedInfo><SignatureValue>l/Anzks1CncmNQsDb2ZgSYEcXcX7sS0jql5fmQcEVAkRDhxwV2Lb+6Z2yPO5F+QZ+54m8w/QJdbQJduyOF0w1blkWd1Iz5ubOt79Cg1f0zO8SYwB1X6j0SzXXB5tTm1hYjKzX/iAqgUJF1o8bscu74A8xCwQio2ay7TWoTEl/Ss=</SignatureValue></Signature>");
- 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 ("<Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><SignedInfo><CanonicalizationMethod Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\" /><SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#hmac-sha1\" /><Reference URI=\"http://www.go-mono.com/\"><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><DigestValue>JjDjPDymSPahf7zC6CCqaTz39uQ=</DigestValue></Reference></SignedInfo><SignatureValue>y5NfXaoCALrMxBsn/wGKNJUNJ7Y=</SignatureValue></Signature>");
- SignedXml signedXml = new SignedXml ();
- signedXml.LoadXml (doc.DocumentElement);
- Assert ("CheckSignature(HMAC)", ak.CheckSignature (signedXml));
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-//
-// 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 = "<wsse:BinarySecurityToken xmlns:vt=\"http://www.go-mono.com/\" ValueType=\"vt:mono\" EncodingType=\"wsse:Base64Binary\" xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\" wsu:Id=\"SecurityToken-eb24c89d-012a-431e-af2d-db6a41f1b88e\" xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/07/secext\" />";
- 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 ("<wsse:BinarySecurityToken "));
- Assert ("GetXml(doc)2", xel.OuterXml.IndexOf ("xmlns:vt=\"http://www.go-mono.com/\"") > 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 ("<wsse:BinarySecurityToken xmlns:vt=\"http://www.go-mono.com/\" ValueType=\"vt:mono\" EncodingType=\"wsse:Base64Binary\" xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\" wsu:Id=\"staticIdUsedForNUnit\" xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/07/secext\" />");
- 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);
- }
- }
-}
+++ /dev/null
-2003-11-06 Sebastien Pouliot <spouliot@videotron.ca>
-
- * 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 <spouliot@videotron.ca>
-
- * 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 <spouliot@videotron.ca>
-
- * ReferenceListTest.cs: Added test to list all references using the
- enumerator.
-
-2003-10-25 Sebastien Pouliot <spouliot@videotron.ca>
-
- * ReferenceListTest.cs: New. Complete unit tests for ReferenceList.
- * WSSecurityTest.cs: Adjusted for WSE2.
-
-2003-10-24 Sebastien Pouliot <spouliot@videotron.ca>
-
- * SignatureTest.cs: New. Basic tests for Signature.
-
-2003-10-22 Sebastien Pouliot <spouliot@videotron.ca>
-
- * 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 <spouliot@videotron.ca>
-
- * EncryptedKeyTest.cs: New. Unit tests for EncryptedKey.
-
-2003-10-18 Sebastien Pouliot <spouliot@videotron.ca>
-
- * X509SecurityTokenTest.cs: New. New. Unit tests for X509SecurityToken.
-
-2003-09-16 Sebastien Pouliot <spouliot@videotron.ca>
-
- * 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
+++ /dev/null
-//
-// 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
+++ /dev/null
-//
-// 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 = "<RSAKeyValue><Modulus>4o+Yqa3y34yOy+55ssgAALoxeVOutACyONctHoLCVxsbHBafJcnxxStlObm1B7aZnR5/ge6YTAPrboUTbpkBJfZ5bRb3jBoYl45tWmM0WDAth1MFO3gxUw6PZXxTK85ef2kPZ2jYPX6a0pA5bMWWuyA4y0sg/gv5RG0GrBn1zLk=</Modulus><Exponent>AQAB</Exponent><P>/DPHYnDUBmnKES9gv89w3UUmcSG7HuM6u1ZW7N0uoG2H6toF6M37RPs2DBEIwqNqr96VSyMhgDcvWXDHyiKhoQ==</P><Q>5fj41n0S3h513mdZF+ZLsg1/qQ1StUgRWGCNPI7/lZfteUOVQJPxKokXLoVRtf1RrsnGyVYIDPQKb+OZ8h2EGQ==</Q><DP>HkcpHMxm6A4zUDTb7Ks+5ZGzt8lQ6bhmCK+o5+719hSwSKW8J+Ly06lFJ9Wzs4pi+JJEYizpjLcTXC2KDt5xgQ==</DP><DQ>QyGxqhMqvdJQgBLVLCfa8ugD2xp7iVW3UoAk2oe3zjhiZyK2X/qPzOXl8XuThbej740RTVai1P0sSss69jVtiQ==</DQ><InverseQ>GAhDRgTDIbUUCZmwVv2tq4J7Iyktwsgpp3Hpa6PHM06tA1XCcOzeTV6H9m2+JCJjakcc8V4p2jl7kBzt+P3txQ==</InverseQ><D>No4HX8xwMF5jQD4DdgZs4b/0C9gXuGZ2g/NkfPVVoK35QDE+T1YqbqT9cgIC0oGoycm/QGVYrO1AstM+k6IqQSrWL8YjonGceUzZN71/VjBMpHEQOdtGTEX4/mMdFjGqNxxrsRgTAH/Wl3LAmraHgbnQcsdBcIy8RpmWZAveowE=</D></RSAKeyValue>";
-
- public const string xml = "<xenc:EncryptedKey Type=\"http://www.w3.org/2001/04/xmlenc#EncryptedKey\" xmlns:xenc=\"http://www.w3.org/2001/04/xmlenc#\"><xenc:EncryptionMethod Algorithm=\"http://www.w3.org/2001/04/xmlenc#rsa-1_5\" /><KeyInfo xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><wsse:SecurityTokenReference><wsse:KeyIdentifier ValueType=\"wsse:X509v3\">MfB7IuMVrXzv++amAm93Tc0Hbas=</wsse:KeyIdentifier></wsse:SecurityTokenReference></KeyInfo><xenc:CipherData><xenc:CipherValue>1WfgPiTV7bpIOCtyKhmYXeTWvl7rykYoeaAqASh6iHQwhS7M61QHEOHw/wS4iphjBGVXsYcNUIFlpZEAkQalxeqLGMJHKkz5Mhd2Ee4N0DWfHlRz5hR7cnwxMKfo/MfzexPfLRcbDuE5iGrYDAb58XQPN3dHLmhCCK+kQ/4KH+E=</xenc:CipherValue></xenc:CipherData><xenc:ReferenceList><xenc:DataReference URI=\"#EncryptedContent-14dac16d-84e9-42bb-aeba-4030da7986d9\" /></xenc:ReferenceList></xenc:EncryptedKey><xenc:EncryptedData Id=\"EncryptedContent-14dac16d-84e9-42bb-aeba-4030da7986d9\" Type=\"http://www.w3.org/2001/04/xmlenc#Content\" xmlns:xenc=\"http://www.w3.org/2001/04/xmlenc#\"><xenc:EncryptionMethod Algorithm=\"http://www.w3.org/2001/04/xmlenc#tripledes-cbc\" /><xenc:CipherData><xenc:CipherValue>A4L9y9NICU8KhOF3ip323wucnpUXbM1De0AOuMaQ2kFRG4wUjw2Wo/u14kQts5uGPNtYWI8/bsBunRr4JVfbMANV+/bPZ3d3v++J+5lrrvvBAaxBu+bCZDwZK45Li/fD</xenc:CipherValue></xenc:CipherData></xenc:EncryptedData>";
-
- 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
+++ /dev/null
-//
-// 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 = "<wsse:KeyIdentifier xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/07/secext\">AA==</wsse:KeyIdentifier>";
- private const string ValueTypeXml = "<wsse:KeyIdentifier xmlns:vt=\"http://www.go-mono.com/\" ValueType=\"vt:mono\" xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/07/secext\">AA==</wsse:KeyIdentifier>";
- private const string WellKnownValueTypeXml = "<wsse:KeyIdentifier ValueType=\"wsse:well-known\" xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/07/secext\">AA==</wsse:KeyIdentifier>";
- private const string BadCustomValueTypeXml = "<wsse:KeyIdentifier ValueType=\"custom\" xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/07/secext\">AA==</wsse:KeyIdentifier>";
-
- [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 ("<wsse:KeyId xmlns:vt=\"http://www.go-mono.com/\" ValueType=\"vt:mono\" xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/07/secext\">AA==</wsse:KeyId>");
- ki.LoadXml (doc.DocumentElement);
- }
-
- [Test]
- [ExpectedException (typeof (ArgumentException))]
- public void LoadXml_BadNamespace ()
- {
- KeyIdentifier ki = new KeyIdentifier (array);
- XmlDocument doc = new XmlDocument ();
- doc.LoadXml ("<wsse:KeyIdentifier xmlns:vt=\"http://www.go-mono.com/\" ValueType=\"vt:mono\" xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2202/07/secext\">AA==</wsse:KeyIdentifier>");
- 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
+++ /dev/null
-//
-// 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 = "<wsse:Nonce xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/12/secext\">GWSRuy1IC4zb2jsA+Sz/rw==</wsse:Nonce>";
- private const string Zero = "<wsse:Nonce xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/12/secext\"></wsse:Nonce>";
-
-
- // 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 ("<wsse:Nonce xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/12/secext\">"));
- Assert ("GetXml.EndsWith", xel.OuterXml.EndsWith ("==</wsse:Nonce>"));
- }
-
- [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 ("<wsse:SecurityTokenRef xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/07/secext\" />");
- n.LoadXml (doc.DocumentElement);
- }
-
- [Test]
- [ExpectedException (typeof (ArgumentException))]
- public void LoadXml_BadNamespace ()
- {
- Nonce n = new Nonce (16);
- XmlDocument doc = new XmlDocument ();
- doc.LoadXml ("<wsse:SecurityTokenRef xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2202/07/secext\" />");
- 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
+++ /dev/null
-//
-// 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
+++ /dev/null
-//
-// 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 = "<xenc:ReferenceList xmlns:xenc=\"http://www.w3.org/2001/04/xmlenc#\" />";
- private const string One = "<xenc:ReferenceList xmlns:xenc=\"http://www.w3.org/2001/04/xmlenc#\"><xenc:DataReference URI=\"#mono\" /></xenc:ReferenceList>";
- private const string NotLocalUri = "<xenc:ReferenceList xmlns:xenc=\"http://www.w3.org/2001/04/xmlenc#\"><xenc:DataReference URI=\"mono\" /></xenc:ReferenceList>";
- private const string NotDataReference = "<xenc:ReferenceList xmlns:xenc=\"http://www.w3.org/2001/04/xmlenc#\"><xenc:Reference URI=\"#mono\" /></xenc:ReferenceList>";
-
- [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 ("<xenc:RefList xmlns:xenc=\"http://www.w3.org/2001/04/xmlenc#\" />");
- rl.LoadXml (doc.DocumentElement);
- }
-
- [Test]
- [ExpectedException (typeof (ArgumentException))]
- public void LoadXml_BadNamespace ()
- {
- ReferenceList rl = new ReferenceList ();
- XmlDocument doc = new XmlDocument ();
- doc.LoadXml ("<xenc:ReferenceList xmlns:xenc=\"http://www.w3.org/2201/04/xmlenc#\" />");
- rl.LoadXml (doc.DocumentElement);
- }
-
- [Test]
- [ExpectedException (typeof (ArgumentNullException))]
- public void LoadXmlNull ()
- {
- ReferenceList rl = new ReferenceList ();
- rl.LoadXml (null);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-//
-// 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
+++ /dev/null
-//
-// 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
+++ /dev/null
-//
-// 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 = "<wsse:SecurityTokenReference xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/07/secext\" />";
- private const string ReferenceMono = "<wsse:SecurityTokenReference xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/07/secext\"><wsse:Reference URI=\"#mono\" /></wsse:SecurityTokenReference>";
- private const string KeyId = "<wsse:SecurityTokenReference xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/07/secext\"><wsse:KeyIdentifier>AA==</wsse:KeyIdentifier></wsse:SecurityTokenReference>";
- private const string Full = "<wsse:SecurityTokenReference xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/07/secext\"><wsse:KeyIdentifier>AA==</wsse:KeyIdentifier><wsse:Reference URI=\"#mono\" /></wsse:SecurityTokenReference>";
- private const string BadReferenceURI = "<wsse:SecurityTokenReference xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/07/secext\"><wsse:Reference URI=\"mono\" /></wsse:SecurityTokenReference>";
-
- [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 ("<wsse:SecurityTokenRef xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/07/secext\" />");
- str.LoadXml (doc.DocumentElement);
- }
-
- [Test]
- [ExpectedException (typeof (ArgumentException))]
- public void LoadXml_BadNamespace ()
- {
- SecurityTokenReference str = new SecurityTokenReference ();
- XmlDocument doc = new XmlDocument ();
- doc.LoadXml ("<wsse:SecurityTokenRef xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2202/07/secext\" />");
- str.LoadXml (doc.DocumentElement);
- }
-
- [Test]
- [ExpectedException (typeof (ArgumentNullException))]
- public void LoadXmlNull ()
- {
- SecurityTokenReference str = new SecurityTokenReference ();
- str.LoadXml (null);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-//
-// 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
+++ /dev/null
-//
-// 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
+++ /dev/null
-//
-// 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
+++ /dev/null
-//
-// 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 = "<KeyInfo xmlns=\"http://www.w3.org/2000/09/xmldsig#\" />";
-
- [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
+++ /dev/null
-//
-// 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 ("<wsse:Username>me</wsse:Username>") > 0);
- Assert ("Password", xml.IndexOf ("<wsse:Password>mine</wsse:Password>") < 0);
- Assert ("Nonce", xml.IndexOf ("<wsse:Nonce>") > 0);
- Assert ("Created", xml.IndexOf ("<wsu:Created>") > 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 ("<wsse:Username>me</wsse:Username>") > 0);
- Assert ("Password", xml.IndexOf ("<wsse:Password Type=\"wsse:PasswordText\">mine</wsse:Password>") > 0);
- Assert ("Nonce", xml.IndexOf ("<wsse:Nonce>") > 0);
- Assert ("Created", xml.IndexOf ("<wsu:Created>") > 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 ("<wsse:Username>me</wsse:Username>") > 0);
- Assert ("Password", xml.IndexOf ("<wsse:Password Type=\"wsse:PasswordDigest\">") > 0);
- Assert ("Nonce", xml.IndexOf ("<wsse:Nonce>") > 0);
- Assert ("Created", xml.IndexOf ("<wsu:Created>") > 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 ("<wsu:timeStamp xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\" />");
- token.LoadXml (doc.DocumentElement);
- }
-
- [Test]
- [ExpectedException (typeof (ConfigurationException))]
- public void LoadXml_WithoutPasswordProvider ()
- {
- string xml = "<wsse:UsernameToken xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\" wsu:Id=\"SecurityToken-a567950c-ceb7-4fb6-b78f-10aeb7078985\" xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/07/secext\"><wsse:Username>me</wsse:Username><wsse:Nonce>U98BosqSRZFZAH9Izw4k7Q==</wsse:Nonce><wsu:Created>2003-09-10T01:33:13Z</wsu:Created></wsse:UsernameToken>";
- 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 = "<wsse:UsernameToken xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\" wsu:Id=\"SecurityToken-a567950c-ceb7-4fb6-b78f-10aeb7078985\" xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/07/secext\"><wsse:Username>me</wsse:Username><wsse:Nonce>U98BosqSRZFZAH9Izw4k7Q==</wsse:Nonce><wsu:Created>2003-09-10T01:33:13Z</wsu:Created></wsse:UsernameToken>";
- 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 = "<wsse:UsernameToken xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\" wsu:Id=\"SecurityToken-c7ef4231-4397-4b4b-ab8d-0ea3fad1f79e\" xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/07/secext\"><wsse:Username>domain_name\\joeblow</wsse:Username><wsse:Password Type=\"wsse:PasswordText\">NoTelinNE1</wsse:Password><wsse:Nonce>QLSVRt9g3e19jJXJYhtBKA==</wsse:Nonce><wsu:Created>2003-07-05T22:37:52Z</wsu:Created></wsse:UsernameToken>";
- 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 = "<wsse:UsernameToken xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\" wsu:Id=\"SecurityToken-536806c1-ef07-4a46-9876-4cae214a7db7\" xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/07/secext\"><wsse:Username>me</wsse:Username><wsse:Password Type=\"wsse:PasswordDigest\">mvFakbZuqOwWZ+ULU0CYy1YAYtM=</wsse:Password><wsse:Nonce>IHMGSS18kXhPqBqRZezDNg==</wsse:Nonce><wsu:Created>2003-09-13T17:51:54Z</wsu:Created></wsse:UsernameToken>";
- 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
+++ /dev/null
-//
-// 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
+++ /dev/null
-//
-// 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 = "<wsse:BinarySecurityToken ValueType=\"wsse:X509v3\" EncodingType=\"wsse:Base64Binary\" xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\" wsu:Id=\"SecurityToken-9a43da12-9834-4119-a3c4-c042bdc56b25\" xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/07/secext\">MIICKjCCAZegAwIBAgIQkcRLDbfYEIRCJnGzl7UAlzAJBgUrDgMCHQUAMCgxJjAkBgNVBAMTHU1vdHVzIFRlY2hub2xvZ2llcyBpbmMuKHRlc3QpMB4XDTAzMDgxMzAwNDM0N1oXDTM5MTIzMTIzNTk1OVowEzERMA8GA1UEAxMIRkFSU0NBUEUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANLLRyH1Yt01vx3smkwHLAHwKMKCF45YMtVMrIa0yeshJvMiMMV6o1rdU6scBj6yE8QFHZWLCnFxEadHJmHxdr41cjLFy0ekIkEerSkRDTkiDHmQxlKhEPZVCU5RJkcOlOaB9RhrmfB287JMkem6Oz9uY9oS0QtzDhLHcHciA51dAgMBAAGjcjBwMBMGA1UdJQQMMAoGCCsGAQUFBwMBMFkGA1UdAQRSMFCAEK7XgIimPbpQoX5X5UDJb8WhKjAoMSYwJAYDVQQDEx1Nb3R1cyBUZWNobm9sb2dpZXMgaW5jLih0ZXN0KYIQna6jOUcO1KJJeOpsug3enDAJBgUrDgMCHQUAA4GBADKKfq3nZ55cTNgzWWjPlMA2R3qnhcLd2NoRPGbBg+OrMwZ842oVcriDPQurPO51E71cliVWNgX6rtT0z1LsEbXqnyCjyDRyWQlR5zaHhoaYtTB7+z3MXujJSeDG6gJ2AeC7inDrB4boBOdI5GyQ5hZCtLvAxIJf+Pt+sp7CeCaG</wsse:BinarySecurityToken>";
-
- 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
+++ /dev/null
-//
-// 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
+++ /dev/null
-//
-// 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
+++ /dev/null
-//
-// 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
+++ /dev/null
-//
-// 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
+++ /dev/null
-//
-// 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));
- }
- }
-}
+++ /dev/null
-2003-09-14 Sebastien Pouliot <spouliot@videotron.ca>
-
- * 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.
+++ /dev/null
-//
-// 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
+++ /dev/null
-//
-// 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", "<wsu:Received xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\">1600-12-31T19:06:13Z</wsu:Received>", 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", "<wsu:Received Delay=\"60\" xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\">1600-12-31T19:06:13Z</wsu:Received>", xel.OuterXml);
-
- string xml = "<wsu:Received Actor=\"http://www.go-mono.com/\" Delay=\"60\" xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\">1600-12-31T19:06:13Z</wsu:Received>";
- 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
+++ /dev/null
-//
-// 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
+++ /dev/null
-//
-// 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 = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Body /></soap:Envelope>";
- static string soapExpiredEnvelope = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Header><wsu:Timestamp xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\"><wsu:Created>2002-11-14T19:03:27Z</wsu:Created><wsu:Expires>2002-11-14T19:08:27Z</wsu:Expires></wsu:Timestamp></soap:Header><soap:Body /></soap:Envelope>";
- static string soapTimestampEnvelope = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Header><wsu:Timestamp xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\"><wsu:Created>2002-11-14T19:03:27Z</wsu:Created><wsu:Expires>2020-11-14T19:08:27Z</wsu:Expires></wsu:Timestamp></soap:Header><soap:Body /></soap:Envelope>";
-
- [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", "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Header></soap:Header><soap:Body /></soap: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
+++ /dev/null
-//
-// 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 ("<soap:Header>") < 0);
-
- TimestampOutputFilter tsOutput = new TimestampOutputFilter ();
- tsOutput.ProcessMessage (env);
- xml = env.Envelope.OuterXml;
- Assert ("Envelope.Header", xml.IndexOf ("<soap:Header>") > 0);
-
- // not static - more difficult to check
- Assert ("Envelope.Timestamp.Created", xml.IndexOf ("<wsu:Created>") > 0);
- Assert ("Envelope.Timestamp.Expired", xml.IndexOf ("<wsu:Expires>") > 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 ("<wsu:Created>") > 0);
- Assert ("Envelope.Timestamp.Expired", xml.IndexOf ("<wsu:Expires>") > 0);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-//
-// 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 = "<wsu:Timestamp xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\" />";
- private static string test1 = "<wsu:Timestamp xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\"><wsu:Created>2001-09-13T08:42:00Z</wsu:Created><wsu:Expires>2001-10-13T09:00:00Z</wsu:Expires></wsu:Timestamp>";
- private static string test2 = "<wsu:Timestamp xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\"><wsu:Created>2001-09-13T08:42:00Z</wsu:Created><wsu:Expires>2001-10-13T09:00:00Z</wsu:Expires><wsu:Received Actor=\"http://x.com/\" Delay=\"60000\">2001-09-13T08:44:00Z</wsu:Received></wsu:Timestamp>";
- private static string test3 = "<wsu:Timestamp xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\"><wsu:Created wsu:Id=\"createdId\">2001-09-13T08:42:00Z</wsu:Created><wsu:Expires wsu:Id=\"expiresId\">2001-10-13T09:00:00Z</wsu:Expires><wsu:Received Actor=\"http://x.com/\" Delay=\"60000\">2001-09-13T08:44:00Z</wsu:Received></wsu:Timestamp>";
- private static string test4 = "<wsu:Timestamp wsu:Id=\"timestampId\" xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\"><wsu:Created wsu:Id=\"createdId\">2001-09-13T08:42:00Z</wsu:Created><wsu:Expires wsu:Id=\"expiresId\">2001-10-13T09:00:00Z</wsu:Expires><wsu:Received Actor=\"http://x.com/\" Delay=\"60000\" wsu:Id=\"receivedId\">2001-09-13T08:44:00Z</wsu:Received></wsu:Timestamp>";
-
- [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 ("<wsu:timeStamp xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\" />");
- ts.LoadXml (doc.DocumentElement);
- }
-
- [Test]
- [ExpectedException (typeof (ArgumentException))]
- public void LoadXml_BadNamespace ()
- {
- XmlDocument doc = new XmlDocument ();
- // bad namespace (invalid year in URL)
- doc.LoadXml ("<wsu:Timestamp xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2003/07/utility\" />");
- 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 <Received> 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 <Received> 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 <Received> 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
+++ /dev/null
-//
-// 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
+++ /dev/null
-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.
+++ /dev/null
-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 = "<v:add xmlns:v='urn:add'><x>33</x><y>66</y></v:add>";
- 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);
- }
-
- }
-
-}