コード例 #1
0
ファイル: test_t9.py プロジェクト: acigna/pywez
 def check_c14n_exc(self):
     """http://www.w3.org/TR/xml-exc-c14n/
     """
     s = StringIO()
     Canonicalize(self.el, s, unsuppressedPrefixes=[])
     cxml = s.getvalue()
     d1 = base64.encodestring(local_sha(C14N_EXCL1).digest()).strip()
     d2 = base64.encodestring(local_sha(cxml).digest()).strip()
     self.assertEqual(d1, C14N_EXCL1_DIGEST)
     self.assertEqual(d1, d2)
コード例 #2
0
ファイル: test_t9.py プロジェクト: acigna/pywez
 def check_c14n_exc(self):
     """http://www.w3.org/TR/xml-exc-c14n/
     """
     s = StringIO()
     Canonicalize(self.el, s, unsuppressedPrefixes=[])
     cxml = s.getvalue()
     d1 = base64.encodestring(local_sha(C14N_EXCL1).digest()).strip()
     d2 = base64.encodestring(local_sha(cxml).digest()).strip()
     self.assertEqual(d1, C14N_EXCL1_DIGEST)
     self.assertEqual(d1, d2)
コード例 #3
0
ファイル: test_t9.py プロジェクト: acigna/pywez
 def check_c14n_exc2_unsuppressed(self):
     """http://www.w3.org/TR/xml-exc-c14n/
     The method of canonicalization described in this specification receives 
     an InclusiveNamespaces PrefixList parameter, which lists namespace prefixes 
     that are handled in the manner described by the Canonical XML Recommendation 
     """
     s = StringIO()
     Canonicalize(self.el, s, unsuppressedPrefixes=['xsi', 'xsd'])
     cxml = s.getvalue()
     d1 = base64.encodestring(local_sha(C14N_EXCL2).digest()).strip()
     d2 = base64.encodestring(local_sha(cxml).digest()).strip()
     self.assertEqual(d1, C14N_EXCL2_DIGEST)
     self.assertEqual(d1, d2)
コード例 #4
0
ファイル: test_t9.py プロジェクト: acigna/pywez
 def check_c14n_exc2_unsuppressed(self):
     """http://www.w3.org/TR/xml-exc-c14n/
     The method of canonicalization described in this specification receives 
     an InclusiveNamespaces PrefixList parameter, which lists namespace prefixes 
     that are handled in the manner described by the Canonical XML Recommendation 
     """
     s = StringIO()
     Canonicalize(self.el, s, unsuppressedPrefixes=['xsi', 'xsd'])
     cxml = s.getvalue()
     d1 = base64.encodestring(local_sha(C14N_EXCL2).digest()).strip()
     d2 = base64.encodestring(local_sha(cxml).digest()).strip()
     self.assertEqual(d1, C14N_EXCL2_DIGEST)
     self.assertEqual(d1, d2)
コード例 #5
0
ファイル: test_t9.py プロジェクト: acigna/pywez
    def check_c14n_exc3(self):
        """http://www.w3.org/TR/xml-exc-c14n/
        tests if a namespace defined in a parent node to the top node 
        to be canonicalized is added when discovered that this namespace
        is used.
        """
        self.ps = ParsedSoap(XML_INST2)
        self.el = self.ps.body

        s = StringIO()
        Canonicalize(self.el, s, unsuppressedPrefixes=[])
        cxml = s.getvalue()
        #print cxml
        d1 = base64.encodestring(local_sha(C14N_EXCL3).digest()).strip()
        d2 = base64.encodestring(local_sha(cxml).digest()).strip()
        self.assertEqual(d1, C14N_EXCL3_DIGEST)
        self.assertEqual(d1, d2)
コード例 #6
0
ファイル: test_t9.py プロジェクト: acigna/pywez
    def check_c14n_exc3(self):
        """http://www.w3.org/TR/xml-exc-c14n/
        tests if a namespace defined in a parent node to the top node 
        to be canonicalized is added when discovered that this namespace
        is used.
        """
        self.ps = ParsedSoap(XML_INST2)
        self.el = self.ps.body

        s = StringIO()
        Canonicalize(self.el, s, unsuppressedPrefixes=[])
        cxml = s.getvalue()
        #print cxml
        d1 = base64.encodestring(local_sha(C14N_EXCL3).digest()).strip()
        d2 = base64.encodestring(local_sha(cxml).digest()).strip()
        self.assertEqual(d1, C14N_EXCL3_DIGEST)
        self.assertEqual(d1, d2)
コード例 #7
0
ファイル: test_t9.py プロジェクト: pombredanne/ZSI
    def xcheck_c14n_exc4(self):
        RCVDIGEST = "jhTbi7gWlY9oLqsRr+EZ0bokRFA="
        CALDIGEST = "IkMyI4zCDlK41qE7sZxvkFHJioU="

        d1 = base64.encodestring(local_sha(WRONG).digest()).strip()
        d2 = base64.encodestring(local_sha(CORRECT).digest()).strip()

        ps = ParsedSoap(XML_INST4)
        el = filter(lambda el: _get_element_nsuri_name(el) == (WSA200403.ADDRESS, "MessageID"), ps.header_elements)[0]

        s = StringIO()
        Canonicalize(el, s, unsuppressedPrefixes=[])
        cxml = s.getvalue()
        #        print "-- "*20
        #        print cxml
        #        print "-- "*20
        d3 = base64.encodestring(local_sha(cxml).digest()).strip()

        self.assertEqual(d1, RCVDIGEST)
        self.assertEqual(d2, CALDIGEST)
        self.assertEqual(d3, CALDIGEST)
コード例 #8
0
ファイル: test_t9.py プロジェクト: acigna/pywez
    def xcheck_c14n_exc4(self):
        RCVDIGEST = "jhTbi7gWlY9oLqsRr+EZ0bokRFA="
        CALDIGEST = "IkMyI4zCDlK41qE7sZxvkFHJioU="

        d1 = base64.encodestring(local_sha(WRONG).digest()).strip()
        d2 = base64.encodestring(local_sha(CORRECT).digest()).strip()

        ps = ParsedSoap(XML_INST4)
        el = filter(
            lambda el: _get_element_nsuri_name(el) ==
            (WSA200403.ADDRESS, "MessageID"), ps.header_elements)[0]

        s = StringIO()
        Canonicalize(el, s, unsuppressedPrefixes=[])
        cxml = s.getvalue()
        #        print "-- "*20
        #        print cxml
        #        print "-- "*20
        d3 = base64.encodestring(local_sha(cxml).digest()).strip()

        self.assertEqual(d1, RCVDIGEST)
        self.assertEqual(d2, CALDIGEST)
        self.assertEqual(d3, CALDIGEST)