00001
00002 import unittest, sys, sha, base64
00003 from ZSI import _get_element_nsuri_name
00004 from ZSI.parse import ParsedSoap
00005 from ZSI.wstools.c14n import Canonicalize
00006 from ZSI.wstools.Namespaces import WSA200403, SOAP
00007 from cStringIO import StringIO
00008
00009
00010 class CanonicalizeFromTestCase(unittest.TestCase):
00011 "c14n tests, this has nothing to do with ws-addressing."
00012
00013 def setUp(self):
00014 self.ps = ParsedSoap(XML_INST1)
00015 self.el = filter(lambda el: _get_element_nsuri_name(el) == (WSA200403.ADDRESS, "From"),
00016 self.ps.header_elements)[0]
00017
00018 def tearDown(self):
00019 del self.ps
00020 del self.el
00021
00022 def check_c14n(self):
00023 """http://www.w3.org/TR/xml-c14n
00024 """
00025 s = StringIO()
00026 Canonicalize(self.el, s, unsuppressedPrefixes=None)
00027 cxml = s.getvalue()
00028 d1 = base64.encodestring(sha.sha(C14N_INC1).digest()).strip()
00029 d2 = base64.encodestring(sha.sha(cxml).digest()).strip()
00030 self.assertEqual(d1, d2)
00031 self.assertEqual(d1, C14N_INC1_DIGEST)
00032
00033 def check_c14n_exc(self):
00034 """http://www.w3.org/TR/xml-exc-c14n/
00035 """
00036 s = StringIO()
00037 Canonicalize(self.el, s, unsuppressedPrefixes=[])
00038 cxml = s.getvalue()
00039 d1 = base64.encodestring(sha.sha(C14N_EXCL1).digest()).strip()
00040 d2 = base64.encodestring(sha.sha(cxml).digest()).strip()
00041 self.assertEqual(d1, C14N_EXCL1_DIGEST)
00042 self.assertEqual(d1, d2)
00043
00044 def check_c14n_exc2_unsuppressed(self):
00045 """http://www.w3.org/TR/xml-exc-c14n/
00046 The method of canonicalization described in this specification receives
00047 an InclusiveNamespaces PrefixList parameter, which lists namespace prefixes
00048 that are handled in the manner described by the Canonical XML Recommendation
00049 """
00050 s = StringIO()
00051 Canonicalize(self.el, s, unsuppressedPrefixes=['xsi', 'xsd'])
00052 cxml = s.getvalue()
00053 d1 = base64.encodestring(sha.sha(C14N_EXCL2).digest()).strip()
00054 d2 = base64.encodestring(sha.sha(cxml).digest()).strip()
00055 self.assertEqual(d1, C14N_EXCL2_DIGEST)
00056 self.assertEqual(d1, d2)
00057
00058 def check_c14n_exc3(self):
00059 """http://www.w3.org/TR/xml-exc-c14n/
00060 tests if a namespace defined in a parent node to the top node
00061 to be canonicalized is added when discovered that this namespace
00062 is used.
00063 """
00064 self.ps = ParsedSoap(XML_INST2)
00065 self.el = self.ps.body
00066
00067 s = StringIO()
00068 Canonicalize(self.el, s, unsuppressedPrefixes=[])
00069 cxml = s.getvalue()
00070 print cxml
00071 d1 = base64.encodestring(sha.sha(C14N_EXCL3).digest()).strip()
00072 d2 = base64.encodestring(sha.sha(cxml).digest()).strip()
00073 self.assertEqual(d1, C14N_EXCL3_DIGEST)
00074 self.assertEqual(d1, d2)
00075
00076 def xcheck_c14n_exc4(self):
00077 RCVDIGEST = "jhTbi7gWlY9oLqsRr+EZ0bokRFA="
00078 CALDIGEST = "IkMyI4zCDlK41qE7sZxvkFHJioU="
00079
00080 d1 = base64.encodestring(sha.sha(WRONG).digest()).strip()
00081 d2 = base64.encodestring(sha.sha(CORRECT).digest()).strip()
00082
00083 ps = ParsedSoap(XML_INST4)
00084 el = filter(lambda el: _get_element_nsuri_name(el) == (WSA200403.ADDRESS, "MessageID"),
00085 ps.header_elements)[0]
00086
00087 s = StringIO()
00088 Canonicalize(el, s, unsuppressedPrefixes=[])
00089 cxml = s.getvalue()
00090 print "-- "*20
00091 print cxml
00092 print "-- "*20
00093 d3 = base64.encodestring(sha.sha(cxml).digest()).strip()
00094
00095 self.assertEqual(d1, RCVDIGEST)
00096 self.assertEqual(d2, CALDIGEST)
00097 self.assertEqual(d3, CALDIGEST)
00098
00099
00100 def makeTestSuite():
00101 suite = unittest.TestSuite()
00102
00103 suite.addTest(unittest.makeSuite(CanonicalizeFromTestCase, "xcheck"))
00104 return suite
00105
00106
00107 C14N_EXCL1_DIGEST = "xSOXT+dlQwo5uT9PbK08of6W9PM="
00108 C14N_EXCL1 = """<wsa:From xmlns:ns3="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" ns3:Id="id-7680063" soapenv:mustUnderstand="0"><wsa:Address>http://bosshog.lbl.gov:9999/wsrf/services/SecureCounterService</wsa:Address><wsa:ReferenceProperties><ns1:CounterKey xmlns:ns1="http://counter.com" ns3:Id="10112">10577413</ns1:CounterKey></wsa:ReferenceProperties></wsa:From>"""
00109
00110 C14N_INC1_DIGEST = "qdU4f7/+BeHV/JlVGIPM90fNeV8="
00111 C14N_INC1 = """<wsa:From xmlns:ns1="http://counter.com" xmlns:ns3="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ns3:Id="id-7680063" soapenv:mustUnderstand="0"><wsa:Address>http://bosshog.lbl.gov:9999/wsrf/services/SecureCounterService</wsa:Address><wsa:ReferenceProperties><ns1:CounterKey ns3:Id="10112">10577413</ns1:CounterKey></wsa:ReferenceProperties></wsa:From>"""
00112
00113 C14N_EXCL2_DIGEST = "+IEqF6DRo36Bh93A06S7C4Cmcuo="
00114 C14N_EXCL2 = """<wsa:From xmlns:ns3="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ns3:Id="id-7680063" soapenv:mustUnderstand="0"><wsa:Address>http://bosshog.lbl.gov:9999/wsrf/services/SecureCounterService</wsa:Address><wsa:ReferenceProperties><ns1:CounterKey xmlns:ns1="http://counter.com" ns3:Id="10112">10577413</ns1:CounterKey></wsa:ReferenceProperties></wsa:From>"""
00115
00116
00117 C14N_EXCL3_DIGEST = "VJvTr+Mx3TeWsQY6iwGbhAJ9/eA="
00118 C14N_EXCL3 = """<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="id-28219008"><RequestSecurityTokenResponse xmlns="http://schemas.xmlsoap.org/ws/2004/04/trust"><wsa:EndpointReference xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"><wsa:Address>http://131.243.2.147:8888/wsrf/services/DelegationService</wsa:Address><wsa:ReferenceProperties><ns1:DelegationKey xmlns:ns1="http://www.globus.org/08/2004/delegationService">8adaa710-ba01-11da-bc99-cbed73daa755</ns1:DelegationKey></wsa:ReferenceProperties></wsa:EndpointReference></RequestSecurityTokenResponse></soapenv:Body>"""
00119
00120
00121 XML_INST1 = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Header>
00122 <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
00123 <ds:SignedInfo>
00124 <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces PrefixList="soapenv wsa xsd xsi" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/></ds:CanonicalizationMethod>
00125 <ds:SignatureMethod Algorithm="http://www.globus.org/2002/04/xmlenc#gssapi-sign"/>
00126 <ds:Reference URI="#id-8409752">
00127 <ds:Transforms>
00128 <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces PrefixList="wsa xsd xsi" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/></ds:Transform>
00129 </ds:Transforms>
00130 <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
00131 <ds:DigestValue>m9pihAqIBdcdk7ytDvccj89eWi8=</ds:DigestValue>
00132 </ds:Reference>
00133 <ds:Reference URI="#id-11434871">
00134 <ds:Transforms>
00135 <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces PrefixList="xsd xsi" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/></ds:Transform>
00136 </ds:Transforms>
00137 <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
00138 <ds:DigestValue>ofD+Ket5kzR2u/5jWKbFTMtmigk=</ds:DigestValue>
00139 </ds:Reference>
00140 <ds:Reference URI="#id-19645447">
00141 <ds:Transforms>
00142 <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces PrefixList="xsd xsi" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/></ds:Transform>
00143 </ds:Transforms>
00144 <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
00145 <ds:DigestValue>SoQ7RlJa3r94weDWBuWAg/BvydQ=</ds:DigestValue>
00146 </ds:Reference>
00147 <ds:Reference URI="#id-5428820">
00148 <ds:Transforms>
00149 <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces PrefixList="xsd xsi" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/></ds:Transform>
00150 </ds:Transforms>
00151 <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
00152 <ds:DigestValue>z6sCEkkRJrCuY/C0S5b+46WfyMs=</ds:DigestValue>
00153 </ds:Reference>
00154 <ds:Reference URI="#id-7680063">
00155 <ds:Transforms>
00156 <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces PrefixList="xsd xsi" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/></ds:Transform>
00157 </ds:Transforms>
00158 <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
00159 <ds:DigestValue>+IEqF6DRo36Bh93A06S7C4Cmcuo=</ds:DigestValue>
00160 </ds:Reference>
00161 <ds:Reference URI="#id-28476580">
00162 <ds:Transforms>
00163 <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces PrefixList="xsd xsi" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/></ds:Transform>
00164 </ds:Transforms>
00165 <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
00166 <ds:DigestValue>NFltkKAJpmMkPbJQj5MW1qVceto=</ds:DigestValue>
00167 </ds:Reference>
00168 </ds:SignedInfo>
00169 <ds:SignatureValue>AAAAAAAAAAMAAAvZTrXlZjRSO7tP12tId+lehprEKgk=</ds:SignatureValue>
00170 <ds:KeyInfo>
00171 <wsse:SecurityTokenReference><wsse:Reference URI="#SecurityContextToken-32970611" ValueType="http://www.globus.org/ws/2004/09/security/sc#GSSAPI_CONTEXT_TOKEN"/></wsse:SecurityTokenReference>
00172 </ds:KeyInfo>
00173 </ds:Signature><wsc:SecurityContextToken wsu:Id="SecurityContextToken-32970611" xmlns:wsc="http://schemas.xmlsoap.org/ws/2004/04/sc" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><wsc:Identifier>3b1ef410-ab3d-11da-9436-88b687faed94</wsc:Identifier></wsc:SecurityContextToken></wsse:Security><wsa:MessageID wsu:Id="id-11434871" soapenv:mustUnderstand="0" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">uuid:3d592ca0-ab3d-11da-9436-88b687faed94</wsa:MessageID><wsa:To wsu:Id="id-19645447" soapenv:mustUnderstand="0" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</wsa:To><wsa:Action wsu:Id="id-5428820" soapenv:mustUnderstand="0" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">http://counter.com/CounterPortType/addResponse</wsa:Action><wsa:From ns3:Id="id-7680063" soapenv:mustUnderstand="0" xmlns:ns1="http://counter.com" xmlns:ns3="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><wsa:Address>http://bosshog.lbl.gov:9999/wsrf/services/SecureCounterService</wsa:Address><wsa:ReferenceProperties><ns1:CounterKey ns3:Id="10112">10577413</ns1:CounterKey></wsa:ReferenceProperties></wsa:From><wsa:RelatesTo RelationshipType="wsa:Reply" wsu:Id="id-28476580" soapenv:mustUnderstand="0" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">uuid:1141449047.05</wsa:RelatesTo></soapenv:Header><soapenv:Body wsu:Id="id-8409752" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><addResponse xmlns="http://counter.com">13</addResponse></soapenv:Body></soapenv:Envelope>"""
00174
00175
00176 XML_INST2 = """<?xml version="1.0" encoding="UTF-8"?>
00177 <soapenv:Envelope
00178 xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
00179 xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"
00180 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
00181 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Header>
00182 <wsse:Security soapenv:mustUnderstand="1"
00183 xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:BinarySecurityToken
00184 EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"
00185 ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509PKIPathv1"
00186 wsu:Id="CertId-1851922"
00187 xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">MIIGbDCCA6owggKSoAMCAQICAh07MA0GCSqGSIb3DQEBBQUAMGkxEzARBgoJkiaJk/IsZAEZFgNv
00188
00189 cmcxGDAWBgoJkiaJk/IsZAEZFghET0VHcmlkczEgMB4GA1UECxMXQ2VydGlmaWNhdGUgQXV0aG9y
00190
00191 aXRpZXMxFjAUBgNVBAMTDURPRUdyaWRzIENBIDEwHhcNMDUxMjIxMjExNzUzWhcNMDYxMjIxMjEx
00192
00193 NzUzWjBfMRMwEQYKCZImiZPyLGQBGRYDb3JnMRgwFgYKCZImiZPyLGQBGRYIZG9lZ3JpZHMxDzAN
00194
00195 BgNVBAsTBlBlb3BsZTEdMBsGA1UEAxMUTWF0dCBSb2RyaWd1ZXogODkzMzAwggEiMA0GCSqGSIb3
00196
00197 DQEBAQUAA4IBDwAwggEKAoIBAQCec6hEiQcu1lIa2pS/KxgmXbkfKLKrOm6AxPrfkht6Ja91+rdY
00198
00199 TLQ4a21S792hglezFbylzLkDmCzYp43fH1xh0LlLea+YzUB7LoUnG29qv73CylSYqDnJWAU+sHhw
00200
00201 fr3Hqpp6GxbxPqXJXcICs1lKbwinsgZQxMsml25O6ZF0x772b1kyiL4IsKwaS9/BQQCWCDA6vcMX
00202
00203 4cKx67EYtDqopRfMUf9Ne3MAOpsfp17U/yeznDemjuxL5Q+zI1Qbq3Kx1kpFcLXKlSNz258EPF/u
00204
00205 /9sOLME3EVp/9n+MjvgHJsTXvlMahF6Ci1UF+clZgMLjEhDHaLghiaagt7t8tqVnAgMBAAGjZjBk
00206
00207 MBEGCWCGSAGG+EIBAQQEAwIF4DAOBgNVHQ8BAf8EBAMCBPAwHwYDVR0jBBgwFoAUyhkdEo5upDhd
00208
00209 QtQxDgjb2Y0XDV0wHgYDVR0RBBcwFYETTUtSb2RyaWd1ZXpAbGJsLmdvdjANBgkqhkiG9w0BAQUF
00210
00211 AAOCAQEAgRZkSHe4Gn9djOBlkn+5iGL5fiWb9LbZDeomS9OzfFePAP9G/8ihl+RLBZXgSdLXZm9v
00212
00213 d6Ep+yVD4YHs0cZzaFlPnPxv6h6yWva+nEsTKkbm70yJrv1nsWP1k+nuBY6U6OQsa6um6Z1OCU6H
00214
00215 u6uPSlyuedV93Vf77THU/1nv6Awf9pFhKolQVlmtQ4zfS9M4WNlNIAZYGgldaFjHVYQYee07Mb4S
00216
00217 Y5EIGUQ6XiabX5C1xbynxniNTL5p4beW/dPZ6w7znHxHpJScoqELAVg2WbQhlcKQaKZPOO1fHy0/
00218
00219 VM907Q1v541/FAhO1+5sTEYf1JPhsNYvNXMw+Z9ukb1PSzCCArowggGioAMCAQICBFSZyLUwDQYJ
00220
00221 KoZIhvcNAQEEBQAwXzETMBEGCgmSJomT8ixkARkWA29yZzEYMBYGCgmSJomT8ixkARkWCGRvZWdy
00222
00223 aWRzMQ8wDQYDVQQLEwZQZW9wbGUxHTAbBgNVBAMTFE1hdHQgUm9kcmlndWV6IDg5MzMwMB4XDTA2
00224
00225 MDMyMjE4NTQwOFoXDTA2MDMyMzA2NTkwOFowdDETMBEGCgmSJomT8ixkARkWA29yZzEYMBYGCgmS
00226
00227 JomT8ixkARkWCGRvZWdyaWRzMQ8wDQYDVQQLEwZQZW9wbGUxHTAbBgNVBAMTFE1hdHQgUm9kcmln
00228
00229 dWV6IDg5MzMwMRMwEQYDVQQDEwoxNDE5MzY0NTMzMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAMpt
00230
00231 7hUlms1nmxRfeSlJQP7omyLujGCKkTTU0CAG2r40eKOqHNtCeFYCXT5/oCMrgB7YyEmxuUz57bJP
00232
00233 sGPyHnsCAwEAAaMxMC8wDgYDVR0PAQH/BAQDAgSwMB0GCCsGAQUFBwEOAQH/BA4wDDAKBggrBgEF
00234
00235 BQcVATANBgkqhkiG9w0BAQQFAAOCAQEALEPirNkcuhZB4/nouueISh/x+tD3GAgvAEERsVdJyWrF
00236
00237 EceT9v0xN2FI00sk2U5yi5wCOhyCZfwN79/dVo0CGB8OqpG5rJ4GnhJ/eea8h98ZVqR0oRWb7IcG
00238
00239 FhqU1ja930dCZGpoaBKjy39HHgzQTFuvwXjaWyoV6C7sAE1Aw3PSafMGaHxjJoK386KpolVxZbrq
00240
00241 DpeKZoxPZKBC7+hyv4vO7KG6s9G/tmIkTroMKEtHHz7NhZHkv+h1aO8g8p57j9uZ8EvdUWUcnwiS
00242
00243 EWXM9AMmho4Z5rex2cdE/s3d+Wa7IFhYoo61VW6v4amSHQH/o4Vdt0pN4hh+/9y32lp89g==</wsse:BinarySecurityToken><ds:Signature
00244 xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
00245 <ds:SignedInfo>
00246 <ds:CanonicalizationMethod
00247 Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
00248 <ds:SignatureMethod
00249 Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
00250 <ds:Reference URI="#id-25484440">
00251 <ds:Transforms>
00252 <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
00253 </ds:Transforms>
00254 <ds:DigestMethod
00255 Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
00256 <ds:DigestValue>xqoPUGjk97yY+StAheOFmeaHgbw=</ds:DigestValue>
00257 </ds:Reference>
00258 <ds:Reference URI="#id-28219008">
00259 <ds:Transforms>
00260 <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
00261 </ds:Transforms>
00262 <ds:DigestMethod
00263 Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
00264 <ds:DigestValue>VJvTr+Mx3TeWsQY6iwGbhAJ9/eA=</ds:DigestValue>
00265 </ds:Reference>
00266 <ds:Reference URI="#id-18539969">
00267 <ds:Transforms>
00268 <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
00269 </ds:Transforms>
00270 <ds:DigestMethod
00271 Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
00272 <ds:DigestValue>W1PrEK32GMCbF6FTEmlYiYwqAeQ=</ds:DigestValue>
00273 </ds:Reference>
00274 <ds:Reference URI="#id-14816181">
00275 <ds:Transforms>
00276 <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
00277 </ds:Transforms>
00278 <ds:DigestMethod
00279 Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
00280 <ds:DigestValue>lWhqYlKqBnB4LwkRWyXMwHy18hc=</ds:DigestValue>
00281 </ds:Reference>
00282 <ds:Reference URI="#id-8120088">
00283 <ds:Transforms>
00284 <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
00285 </ds:Transforms>
00286 <ds:DigestMethod
00287 Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
00288 <ds:DigestValue>2Zjgz4McHaxMLfpBbqelAqWvRsU=</ds:DigestValue>
00289 </ds:Reference>
00290 <ds:Reference URI="#id-8450175">
00291 <ds:Transforms>
00292 <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
00293 </ds:Transforms>
00294 <ds:DigestMethod
00295 Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
00296 <ds:DigestValue>knsi7QmfOvjrn5mWClmsbCpZ32A=</ds:DigestValue>
00297 </ds:Reference>
00298 <ds:Reference URI="#id-19744521">
00299 <ds:Transforms>
00300 <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
00301 </ds:Transforms>
00302 <ds:DigestMethod
00303 Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
00304 <ds:DigestValue>/yBXQ0yxPqpgSGYym/DA08k0dXM=</ds:DigestValue>
00305 </ds:Reference>
00306 </ds:SignedInfo>
00307 <ds:SignatureValue>
00308
00309 LuGNfoVBzUIoF0AU0lzJkH9kAOi+PQVG8hMrCIEjWh1lifSG/bquhu/qZVq78x3UR+tGK411hWuQ
00310 nGle1GvY0A==
00311 </ds:SignatureValue>
00312 <ds:KeyInfo Id="KeyId-17834932">
00313 <wsse:SecurityTokenReference wsu:Id="STRId-9973812"
00314 xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><wsse:Reference
00315 URI="#CertId-1851922"
00316 ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509PKIPathv1"/></wsse:SecurityTokenReference>
00317 </ds:KeyInfo>
00318 </ds:Signature>
00319 <wsu:Timestamp wsu:Id="id-25484440"
00320 xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><wsu:Created>2006-03-23T00:11:14Z</wsu:Created><wsu:Expires>2006-03-23T00:16:14Z</wsu:Expires></wsu:Timestamp></wsse:Security><wsa:MessageID
00321 wsu:Id="id-8120088" soapenv:mustUnderstand="0"
00322 xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">uuid:8aec8160-ba01-11da-bc99-cbed73daa755</wsa:MessageID><wsa:To
00323 wsu:Id="id-18539969" soapenv:mustUnderstand="0"
00324 xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</wsa:To><wsa:Action
00325 wsu:Id="id-19744521" soapenv:mustUnderstand="0"
00326 xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">http://www.globus.org/08/2004/delegationService/DelegationFactoryPortType/RequestSecurityTokenResponse</wsa:Action><wsa:From
00327 wsu:Id="id-14816181" soapenv:mustUnderstand="0"
00328 xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><wsa:Address>http://bosshog.lbl.gov:8888/wsrf/services/DelegationFactoryService</wsa:Address></wsa:From><wsa:RelatesTo
00329 RelationshipType="wsa:Reply" wsu:Id="id-8450175"
00330 soapenv:mustUnderstand="0"
00331 xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">uuid:1143072675.25</wsa:RelatesTo></soapenv:Header><soapenv:Body
00332 wsu:Id="id-28219008"
00333 xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><RequestSecurityTokenResponse
00334 xmlns="http://schemas.xmlsoap.org/ws/2004/04/trust"><wsa:EndpointReference
00335 xmlns:ns1="http://www.globus.org/08/2004/delegationService"><wsa:Address>http://131.243.2.147:8888/wsrf/services/DelegationService</wsa:Address><wsa:ReferenceProperties><ns1:DelegationKey>8adaa710-ba01-11da-bc99-cbed73daa755</ns1:DelegationKey></wsa:ReferenceProperties></wsa:EndpointReference></RequestSecurityTokenResponse></soapenv:Body></soapenv:Envelope>"""
00336
00337
00338
00339 CORRECT = """<ns1:MessageID xmlns:ns1="http://schemas.xmlsoap.org/ws/2004/03/addressing" xmlns:ns2="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" ns2:Id="10102">uuid:1143760705.98</ns1:MessageID>"""
00340
00341 WRONG = """<ns1:MessageID xmlns:ns1="http://schemas.xmlsoap.org/ws/2004/03/addressing" xmlns:ns2="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" ns2:Id="10102">uuid:1143760705.98</ns1:MessageID>"""
00342
00343 XML_INST4 = """<?xml version="1.0" encoding="UTF-8"?>
00344 <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ZSI="http://www.zolera.com/schemas/ZSI/"><SOAP-ENV:Header xmlns:ns2="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:ns1="http://schemas.xmlsoap.org/ws/2004/03/addressing"><ns1:MessageID xmlns:ns2="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" ns2:Id="10102">uuid:1143760705.98</ns1:MessageID><ns1:Action xmlns:ns2="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" ns2:Id="10103">http://counter.com/CounterPortType/createCounterRequest</ns1:Action><ns1:To xmlns:ns2="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" ns2:Id="10104">http://131.243.2.159:9080/wsrf/services/SecureCounterService</ns1:To><ns1:From xmlns:ns2="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" ns2:Id="10105"><ns1:Address>http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</ns1:Address></ns1:From><ns2:Security xmlns:ns3="http://www.w3.org/2000/09/xmldsig#" xmlns:ns4="http://schemas.xmlsoap.org/ws/2004/04/sc"><ns3:Signature><ns3:SignedInfo xsi:type="ns3:SignedInfoType"><ns3:CanonicalizationMethod xsi:type="ns3:CanonicalizationMethodType" Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></ns3:CanonicalizationMethod><ns3:SignatureMethod xsi:type="ns3:SignatureMethodType" Algorithm="http://www.globus.org/2002/04/xmlenc#gssapi-sign"></ns3:SignatureMethod><ns3:Reference xsi:type="ns3:ReferenceType" URI="#10102"><ns3:DigestMethod xsi:type="ns3:DigestMethodType" Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></ns3:DigestMethod><ns3:DigestValue xsi:type="ns3:DigestValueType">
00345 IkMyI4zCDlK41qE7sZxvkFHJioU=
00346 </ns3:DigestValue></ns3:Reference><ns3:Reference xsi:type="ns3:ReferenceType" URI="#10103"><ns3:DigestMethod xsi:type="ns3:DigestMethodType" Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></ns3:DigestMethod><ns3:DigestValue xsi:type="ns3:DigestValueType">
00347 DyEF6Pa7w3SSEVJ98LIoX2LW85k=
00348 </ns3:DigestValue></ns3:Reference><ns3:Reference xsi:type="ns3:ReferenceType" URI="#10104"><ns3:DigestMethod xsi:type="ns3:DigestMethodType" Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></ns3:DigestMethod><ns3:DigestValue xsi:type="ns3:DigestValueType">
00349 p/2PhmYP+/1UPcpwsRcdlvLmOAg=
00350 </ns3:DigestValue></ns3:Reference><ns3:Reference xsi:type="ns3:ReferenceType" URI="#10105"><ns3:DigestMethod xsi:type="ns3:DigestMethodType" Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></ns3:DigestMethod><ns3:DigestValue xsi:type="ns3:DigestValueType">
00351 KFLeYjf5ohGUIoPoZV/oew9SuUM=
00352 </ns3:DigestValue></ns3:Reference><ns3:Reference xsi:type="ns3:ReferenceType" URI="#10106"><ns3:DigestMethod xsi:type="ns3:DigestMethodType" Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></ns3:DigestMethod><ns3:DigestValue xsi:type="ns3:DigestValueType">
00353 7Gg0SC1wltHVAwiOfdgZsGM9W5g=
00354 </ns3:DigestValue></ns3:Reference></ns3:SignedInfo><ns3:SignatureValue xsi:type="ns3:SignatureValueType">
00355 AAAAAAAAAAEAAAdrBxzrHLZG4NglRglL9F3rKQu0658=
00356 </ns3:SignatureValue><ns3:KeyInfo xsi:type="ns3:KeyInfoType"><ns2:SecurityTokenReference><ns2:Reference URI="#CertId-10107" ValueType="http://www.globus.org/ws/2004/09/security/sc#GSSAPI_CONTEXT_TOKEN"></ns2:Reference></ns2:SecurityTokenReference></ns3:KeyInfo></ns3:Signature><ns4:SecurityContextToken xmlns:ns5="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" ns5:Id="CertId-10107"><ns4:Identifier xsi:type="xsd:anyURI">1000</ns4:Identifier></ns4:SecurityContextToken></ns2:Security></SOAP-ENV:Header><SOAP-ENV:Body xmlns:ns1="http://counter.com"><ns1:createCounter xmlns:ns2="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" ns2:Id="10106"></ns1:createCounter></SOAP-ENV:Body></SOAP-ENV:Envelope>"""
00357
00358 def main():
00359 unittest.main(defaultTest="makeTestSuite")
00360
00361 if __name__ == '__main__':
00362 main()
00363