Click here to Skip to main content
15,910,981 members
Home / Discussions / XML / XSL
   

XML / XSL

 
QuestionColorfull string Pin
half-life2-Jul-08 19:39
half-life2-Jul-08 19:39 
AnswerRe: Colorfull string Pin
led mike3-Jul-08 6:00
led mike3-Jul-08 6:00 
GeneralRe: Colorfull string Pin
half-life3-Jul-08 6:08
half-life3-Jul-08 6:08 
Questionchange the att value and name of a node (Visual C++ && DOM - ) Pin
SimplySane2-Jul-08 7:09
SimplySane2-Jul-08 7:09 
AnswerRe: change the att value and name of a node (Visual C++ && DOM - ) Pin
led mike2-Jul-08 10:11
led mike2-Jul-08 10:11 
GeneralRe: change the att value and name of a node (Visual C++ && DOM - ) Pin
SimplySane6-Jul-08 6:18
SimplySane6-Jul-08 6:18 
GeneralRe: change the att value and name of a node (Visual C++ && DOM - ) Pin
led mike7-Jul-08 11:15
led mike7-Jul-08 11:15 
QuestionCalculating DigestValue over URI - URGENT HELP VERY MUCH APPRECIATED Pin
Andy H2-Jul-08 4:34
Andy H2-Jul-08 4:34 
I am trying to digitally sign an XML document in C++. Yes, I know that it is easy in .NET 2.0, but alas cannot use that!

An extract of the XML document is below.

All I am trying to do is calculate the DigestValue over the XML sub-document with Id=MsgOperation. I know that the data from this sub-document is converted into a hash with SHA-1 and then Base64.

The problem I am having is converting the sub-document using EXEC-C14N. I am trying to use the LibXML2 library (very good), to EXEC-C14N the sub-document with:

[code]
CString CDigitalCerts::C14N( const char* pszXml, const bool bExclusive )
{
CString sRet = _T("");
xmlChar* pOutput = NULL;
xmlDocPtr pXmlDoc = xmlReadMemory( pszXml, (int)strlen( pszXml ), _T("xml"), NULL, 0 );
int result = 0;
void* pData = NULL;

xmlOutputBufferPtr buf = 0;

if ( pXmlDoc )
{
result = xmlC14NDocDumpMemory( pXmlDoc,
NULL,
(int)bExclusive,
NULL,
0,
&pOutput );
}

xmlFreeDoc( pXmlDoc );

if ( result > 0 )
{
sRet = (LPCTSTR)pOutput;
}

xmlFree( pOutput );
pOutput = NULL;

return sRet;
}
[/code]

If anyone has used the xmlC14NDocDumpMemory function before from the libxml2 library and can advise what I need to add to its 2nd argv (nodes) or the 4th argv (inclusive_ns_prefixes), I would appreciate it. Or what the <ns1:operation ...="" xmlns:ns1="#unknown"> node once EXEC_C14N'ed looks like I would again be very grateful.

[code]
<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<ns1:Operation Id="MsgOperation" soapenv:mustUnderstand="0" xsi:type="xsd:string" xmlns:ns1="http://www.ros.ie/schemas/service/" xmlns:xsi="http://w
ww.w3.org/2001/XMLSchema-instance">CT1/File</ns1:Operation>
<wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/07/secext">

...

<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<ds:Reference URI="#MsgOperation">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue></ds:DigestValue>
</ds:Reference>

...

</ds:SignedInfo>
<ds:SignatureValue>
</ds:SignatureValue>
<ds:KeyInfo>
<wsse:SecurityTokenReference>
<wsse:Reference URI="#X509Token"/>
</wsse:SecurityTokenReference>
</ds:KeyInfo>
</ds:Signature></wsse:Security> </soapenv:Header>
[/code]
AnswerRe: Calculating DigestValue over URI - URGENT HELP VERY MUCH APPRECIATED Pin
led mike2-Jul-08 4:45
led mike2-Jul-08 4:45 
GeneralRe: Calculating DigestValue over URI - URGENT HELP VERY MUCH APPRECIATED Pin
Andy H2-Jul-08 5:14
Andy H2-Jul-08 5:14 
GeneralRe: Calculating DigestValue over URI - URGENT HELP VERY MUCH APPRECIATED Pin
led mike2-Jul-08 6:36
led mike2-Jul-08 6:36 
GeneralRe: Calculating DigestValue over URI - URGENT HELP VERY MUCH APPRECIATED Pin
Andy H2-Jul-08 10:08
Andy H2-Jul-08 10:08 
GeneralRe: Calculating DigestValue over URI - URGENT HELP VERY MUCH APPRECIATED Pin
led mike2-Jul-08 10:18
led mike2-Jul-08 10:18 
GeneralRe: Calculating DigestValue over URI - URGENT HELP VERY MUCH APPRECIATED Pin
Andy H2-Jul-08 10:46
Andy H2-Jul-08 10:46 
GeneralRe: Calculating DigestValue over URI - URGENT HELP VERY MUCH APPRECIATED Pin
led mike2-Jul-08 11:07
led mike2-Jul-08 11:07 
GeneralRe: Calculating DigestValue over URI - URGENT HELP VERY MUCH APPRECIATED Pin
Andy H2-Jul-08 12:26
Andy H2-Jul-08 12:26 
AnswerRe: Calculating DigestValue over URI - URGENT HELP VERY MUCH APPRECIATED Pin
Andy H3-Jul-08 3:03
Andy H3-Jul-08 3:03 
GeneralRe: Calculating DigestValue over URI - URGENT HELP VERY MUCH APPRECIATED Pin
led mike3-Jul-08 5:58
led mike3-Jul-08 5:58 
GeneralRe: Calculating DigestValue over URI - URGENT HELP VERY MUCH APPRECIATED Pin
Andy H3-Jul-08 6:27
Andy H3-Jul-08 6:27 
GeneralRe: Calculating DigestValue over URI - URGENT HELP VERY MUCH APPRECIATED Pin
led mike3-Jul-08 6:41
led mike3-Jul-08 6:41 
GeneralRe: Calculating DigestValue over URI - URGENT HELP VERY MUCH APPRECIATED Pin
Andy H3-Jul-08 7:56
Andy H3-Jul-08 7:56 
GeneralRe: Calculating DigestValue over URI - URGENT HELP VERY MUCH APPRECIATED Pin
led mike3-Jul-08 8:17
led mike3-Jul-08 8:17 
GeneralRe: Calculating DigestValue over URI - URGENT HELP VERY MUCH APPRECIATED Pin
Andy H3-Jul-08 8:55
Andy H3-Jul-08 8:55 
QuestionHow to add a tag &lt;tag val="N"&gt; to an xml file Pin
SWDevil1-Jul-08 8:57
SWDevil1-Jul-08 8:57 
Questionadding xmlnode with child nodes Pin
manoj221841-Jul-08 6:25
manoj221841-Jul-08 6:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.