You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@santuario.apache.org by bu...@apache.org on 2010/05/07 15:08:40 UTC

DO NOT REPLY [Bug 44983] XSLT transformation should not be canonicalized

https://issues.apache.org/bugzilla/show_bug.cgi?id=44983

--- Comment #1 from hagelkruys@a-trust.at 2010-05-07 09:08:36 EDT ---
I have the same problem, I am using XSLT on an enveloped Signature Transform.
In my case the dsig namespace is inserted into the resulting data and passed to
the hash function. 

for a quick fix/test I've inserted a test-function and replaced the c14n



test-function: converts DOMNode to safeBuffer
safeBuffer test(xercesc::DOMNode *node)
{
    DOMImplementationLS* impl =
DOMImplementationRegistry::getDOMImplementation(L"LS");
    DOMWriter* wrt = impl->createDOMWriter();

    MemBufFormatTarget* target = new MemBufFormatTarget();
    wrt->writeNode(target,*node);

    char* t = new char[target->getLen()+1];
    memset(t,'\0',target->getLen()+1);
    memcpy(t,target->getRawBuffer(),target->getLen());
    safeBuffer ret = t;
    delete[] t;

    wrt->release();
    delete target;

    return ret;
}


and changes in DSIGTransformXSL::appendTransformer

    // Create the XSLT transform
    XSECnew(x, TXFMXSL(mp_txfmNode->getOwnerDocument()));
    input->appendTxfm(x);

/*
    // Again use C14n (convenient) to translate to a SafeBuffer

    XSECC14n20010315 c14n(mp_txfmNode->getOwnerDocument(), mp_stylesheetNode);
    safeBuffer sbStyleSheet;
    unsigned int size, count;
    unsigned char buf[512];
    size = 0;

    while ((count = c14n.outputBuffer(buf, 512)) != 0) {

        sbStyleSheet.sbMemcpyIn(size, buf, count);
        size += count;

    }

    sbStyleSheet[size] = '\0';        // Terminate as though a string
*/

    safeBuffer sbStyleSheet = test(mp_stylesheetNode);


I will build an XSECDomToSafeBuffer class with the same syntax as
XSECC14n20010315, so there should only be small changes except the class :)
Coming in the next few days...

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.