blautenb    2003/03/08 00:45:17

  Modified:    c/src/canon XSECC14n20010315.cpp
               c/src/dsig DSIGSignature.cpp DSIGSignedInfo.cpp
                        DSIGTransformC14n.cpp DSIGTransformXPath.cpp
               c/src/tools/checksig checksig.cpp
               c/src/utils XSECDOMUtils.cpp XSECDOMUtils.hpp
  Log:
  Fixes for interop tests
  
  Revision  Changes    Path
  1.5       +65 -5     xml-security/c/src/canon/XSECC14n20010315.cpp
  
  Index: XSECC14n20010315.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/canon/XSECC14n20010315.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XSECC14n20010315.cpp      22 Feb 2003 08:47:23 -0000      1.4
  +++ XSECC14n20010315.cpp      8 Mar 2003 08:45:16 -0000       1.5
  @@ -232,6 +232,9 @@
        if (strEquals(node->getPrefix(), (char *) ns.rawBuffer()))
                return true;
   
  +     if (ns.sbStrcmp("") == 0)
  +             return false;           // Attributes are never in default 
namespace
  +
        // Check the attributes
        DOMNamedNodeMap *atts = node->getAttributes();
        if (atts == NULL)
  @@ -409,7 +412,18 @@
        if (c14ntarget != NULL)
                delete c14ntarget;
   
  -};
  +     // Clear out the exclusive namespace list
  +     int size = m_exclNSList.size();
  +
  +     for (int i = 0; i < size; ++i) {
  +
  +             delete [] m_exclNSList[i];
  +
  +     }
  +
  +     m_exclNSList.clear();
  +
  +}
   
   // 
--------------------------------------------------------------------------------
   //           XSECC14n20010315 Comments procesing
  @@ -759,6 +773,10 @@
                if (!visiblyUtilises(e, localName))
                        return false;
   
  +             // If we are the top node, then this has never been printer
  +             if (e == mp_firstElementNode)
  +                     return true;
  +
                // Make sure previous nodes do not use the name space (and have 
it printed)
                parent = e->getParentNode();
   
  @@ -786,7 +804,10 @@
                                }
                        }
   
  -                     parent = parent->getParentNode();
  +                     if (parent == mp_firstElementNode)
  +                             parent = NULL;
  +                     else
  +                             parent = parent->getParentNode();
   
                }
   
  @@ -809,7 +830,13 @@
        // Find the parent and check if the node is already defined or if the 
node
        // was out of scope
        parent = e->getParentNode();
  -     if (m_XPathSelection && !m_XPathMap.hasNode(parent))
  +//   if (m_XPathSelection && !m_XPathMap.hasNode(parent))
  +//           return true;
  +
  +     while (m_XPathSelection && parent != NULL && 
!m_XPathMap.hasNode(parent))
  +             parent = parent->getParentNode();
  +
  +     if (parent == NULL)
                return true;
   
        DOMNamedNodeMap *pmap = parent->getAttributes();
  @@ -1111,7 +1138,40 @@
                                                DOMNode *t = 
mp_nextNode->getParentNode();
                                                if (m_XPathSelection && 
m_XPathMap.hasNode(t))
                                                        XMLElement = false;
  -                                     
  +                                             else {
  +
  +                                                     // This is a real node 
that we have to check
  +
  +                                                     t = mp_nextNode;
  +                                                     while (t != next) {
  +                                                             DOMNamedNodeMap 
*ta;
  +                                                             int sz;
  +
  +                                                             ta = 
t->getAttributes();
  +
  +                                                             if (ta != NULL)
  +                                                                     sz = 
ta->getLength();
  +                                                             else 
  +                                                                     sz = 0;
  +
  +                                                             for (int j = 0; 
j < sz; ++j) {
  +
  +                                                                     if 
(strEquals(ta->item(j)->getNodeName(), 
  +                                                                             
tmpAtts->item(i)->getNodeName()) == true) {
  +
  +                                                                             
XMLElement = false;
  +                                                                             
break;
  +
  +                                                                     }
  +
  +                                                             }
  +
  +                                                             t = 
t->getParentNode();
  +
  +                                                     }
  +
  +                                             }
  +
                                        }
   
                                                 
  
  
  
  1.8       +37 -1     xml-security/c/src/dsig/DSIGSignature.cpp
  
  Index: DSIGSignature.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/dsig/DSIGSignature.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DSIGSignature.cpp 1 Mar 2003 06:27:28 -0000       1.7
  +++ DSIGSignature.cpp 8 Mar 2003 08:45:16 -0000       1.8
  @@ -278,6 +278,24 @@
   
                break;
   
  +     case CANON_C14NE_NOC :
  +
  +             XSECnew(txfm, TXFMC14n(mp_doc));
  +             chain->appendTxfm(txfm);
  +             ((TXFMC14n *) txfm)->setExclusive();
  +             txfm->stripComments();
  +             
  +             break;
  +
  +     case CANON_C14NE_COM :
  +
  +             XSECnew(txfm, TXFMC14n(mp_doc));
  +             chain->appendTxfm(txfm);
  +             ((TXFMC14n *) txfm)->setExclusive();
  +             txfm->activateComments();
  +
  +             break;
  +
        default :
   
                throw XSECException(XSECException::SigVfyError,
  @@ -921,6 +939,24 @@
   
                XSECnew(txfm, TXFMC14n(mp_doc));
                chain->appendTxfm(txfm);
  +             txfm->activateComments();
  +
  +             break;
  +
  +     case CANON_C14NE_NOC :
  +
  +             XSECnew(txfm, TXFMC14n(mp_doc));
  +             chain->appendTxfm(txfm);
  +             ((TXFMC14n *) txfm)->setExclusive();
  +             txfm->stripComments();
  +             
  +             break;
  +
  +     case CANON_C14NE_COM :
  +
  +             XSECnew(txfm, TXFMC14n(mp_doc));
  +             chain->appendTxfm(txfm);
  +             ((TXFMC14n *) txfm)->setExclusive();
                txfm->activateComments();
   
                break;
  
  
  
  1.4       +12 -0     xml-security/c/src/dsig/DSIGSignedInfo.cpp
  
  Index: DSIGSignedInfo.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/dsig/DSIGSignedInfo.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DSIGSignedInfo.cpp        1 Mar 2003 06:27:28 -0000       1.3
  +++ DSIGSignedInfo.cpp        8 Mar 2003 08:45:16 -0000       1.4
  @@ -336,6 +336,18 @@
   
        }
   
  +     else if (tmpSB.sbStrcmp(URI_ID_EXC_C14N_COM) == 0) {
  +
  +             m_canonicalizationMethod = CANON_C14NE_COM;
  +
  +     }
  +
  +     else if (tmpSB.sbStrcmp(URI_ID_EXC_C14N_NOC) == 0) {
  +
  +             m_canonicalizationMethod = CANON_C14NE_NOC;
  +
  +     }
  +
        else
   
                throw XSECException(XSECException::UnknownCanonicalization);
  
  
  
  1.6       +2 -2      xml-security/c/src/dsig/DSIGTransformC14n.cpp
  
  Index: DSIGTransformC14n.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/dsig/DSIGTransformC14n.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DSIGTransformC14n.cpp     22 Feb 2003 08:47:23 -0000      1.5
  +++ DSIGTransformC14n.cpp     8 Mar 2003 08:45:16 -0000       1.6
  @@ -210,7 +210,7 @@
                m_cMethod = CANON_C14N_NOC;
        }
        else if (strEquals(uri, DSIGConstants::s_unicodeStrURIEXC_C14N_COM)) {
  -             m_cMethod = CANON_C14NE_NOC;
  +             m_cMethod = CANON_C14NE_COM;
        }
        else if (strEquals(uri, DSIGConstants::s_unicodeStrURIEXC_C14N_NOC)) {
                m_cMethod = CANON_C14NE_NOC;
  
  
  
  1.7       +10 -3     xml-security/c/src/dsig/DSIGTransformXPath.cpp
  
  Index: DSIGTransformXPath.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/dsig/DSIGTransformXPath.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DSIGTransformXPath.cpp    1 Mar 2003 06:27:28 -0000       1.6
  +++ DSIGTransformXPath.cpp    8 Mar 2003 08:45:16 -0000       1.7
  @@ -191,7 +191,7 @@
   
                mp_NSMap = mp_xpathNode->getAttributes();
                
  -             // Find the text
  +             // Find the text node
                mp_exprTextNode = findFirstChildOfType(mp_xpathNode, 
DOMNode::TEXT_NODE);
   
                if (mp_exprTextNode == NULL) {
  @@ -199,7 +199,14 @@
                                "Expected Text Node in beneath <XPath> in 
DSIGTransformXPath::load");
                }
   
  -             m_expr << (*(mp_parentSignature->getSBFormatter()) << 
mp_exprTextNode->getNodeValue());
  +             // Gather the text
  +             safeBuffer exprSB;
  +
  +             gatherChildrenText(mp_xpathNode, exprSB);
  +
  +             m_expr << (*(mp_parentSignature->getSBFormatter()) << 
exprSB.rawXMLChBuffer());
  +
  +             //m_expr << (*(mp_parentSignature->getSBFormatter()) << 
mp_exprTextNode->getNodeValue());
                                
        }
   
  
  
  
  1.11      +12 -5     xml-security/c/src/tools/checksig/checksig.cpp
  
  Index: checksig.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/tools/checksig/checksig.cpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- checksig.cpp      1 Mar 2003 06:27:29 -0000       1.10
  +++ checksig.cpp      8 Mar 2003 08:45:16 -0000       1.11
  @@ -257,7 +257,6 @@
        if (errorsOccured) {
   
                cout << "Errors during parse" << endl;
  -             delete parser;
                return (2);
   
        }
  @@ -312,9 +311,17 @@
                char baseURI[(_MAX_PATH * 2) + 10];
                getcwd(path, _MAX_PATH);
   
  -             strcpy(baseURI, "file:///");
  -             strcat(baseURI, path);
  -             strcat(baseURI, "/");
  +             strcpy(baseURI, "file:///");            
  +
  +             // Ugly and nasty but quick
  +             if (filename[0] != '\\' && filename[0] != '/' && filename[1] != 
':') {
  +                     strcat(baseURI, path);
  +                     strcat(baseURI, "/");
  +             } else if (path[1] == ':') {
  +                     path[2] = '\0';
  +                     strcat(baseURI, path);
  +             }
  +
                strcat(baseURI, filename);
   
                // Find any ':' and "\" characters
  
  
  
  1.4       +20 -0     xml-security/c/src/utils/XSECDOMUtils.cpp
  
  Index: XSECDOMUtils.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/utils/XSECDOMUtils.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XSECDOMUtils.cpp  21 Feb 2003 11:53:09 -0000      1.3
  +++ XSECDOMUtils.cpp  8 Mar 2003 08:45:16 -0000       1.4
  @@ -195,3 +195,23 @@
   
   }
   
  +// 
--------------------------------------------------------------------------------
  +//           Gather text from children
  +// 
--------------------------------------------------------------------------------
  +
  +void gatherChildrenText(DOMNode * parent, safeBuffer &output) {
  +
  +     DOMNode * c = parent->getFirstChild();
  +
  +     output.sbXMLChIn(DSIGConstants::s_unicodeStrEmpty);
  +
  +     while (c != NULL) {
  +
  +             if (c->getNodeType() == DOMNode::TEXT_NODE)
  +                     output.sbXMLChCat(c->getNodeValue());
  +
  +             c = c->getNextSibling();
  +
  +     }
  +
  +}
  
  
  
  1.4       +7 -1      xml-security/c/src/utils/XSECDOMUtils.hpp
  
  Index: XSECDOMUtils.hpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/utils/XSECDOMUtils.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XSECDOMUtils.hpp  22 Feb 2003 08:47:26 -0000      1.3
  +++ XSECDOMUtils.hpp  8 Mar 2003 08:45:16 -0000       1.4
  @@ -136,6 +136,12 @@
   safeBuffer DSIG_EXPORT &makeQName(safeBuffer & qname, const XMLCh *prefix, 
char * localName);
   
   // 
--------------------------------------------------------------------------------
  +//           Gather text from children
  +// 
--------------------------------------------------------------------------------
  +
  +void DSIG_EXPORT gatherChildrenText(DOMNode * parent, safeBuffer &output);
  +
  +// 
--------------------------------------------------------------------------------
   //           String Functions 
   // 
--------------------------------------------------------------------------------
   
  
  
  

Reply via email to