<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style></head><body lang=BG link=blue vlink="#954F72" style='word-wrap:break-word'><div class=WordSection1><p class=MsoNormal><span lang=EN-US>Hello! I’m trying to sign a simple soap message. The message looks like this:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US><?xml version="1.0" encoding="utf-8"?><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><e:Envelope xmlns:e="http://schemas.xmlsoap.org/soap/envelope/"><o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span lang=EN-US><e:Header /><br> <e:Body><br> <Data>someData</Data><br> </e:Body><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US></e:Envelope></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-US>By no means I’m an expert in network stuff (I’m only a beginner and a hobby programmer). As far as I understand, the result should look something like:<br><br><?xml version="1.0" encoding="utf-8"?><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><e:Envelope xmlns:e="http://schemas.xmlsoap.org/soap/envelope/"><o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span lang=EN-US><e:Header><br> <Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span lang=EN-US> ….. <o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span lang=EN-US> <Reference URI="#signedContent"><o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span lang=EN-US> ……<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span lang=EN-US> </Signature><br></e:Header><br> <e:Body id="signedContent"<br> <Data>someData</Data><br> </e:Body><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US></e:Envelope></span><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-US>So to my understanding the signature goes into the header, and the signature reference points to the body. I’ve put the signature node into the header by calling <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>xmlAddChild(xmlDocGetRootElement(doc)->children, signNode);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>However I don’t know how to tell the library to sign the body. Do I have to place the id attribute in the body by myself, or should I let the library do it? The library isn’t very well documented (or maybe the functions make sense, but not for someone like me). Which functions do I need to call next (I’m using the x509 example as a basis). Probably I should create the reference node like this:<br> xmlNodePtr refNode = xmlSecTmplSignatureAddReference(signNode, xmlSecTransformSha256Id,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> NULL, (const xmlChar*)"signedContent”, NULL);<br>…but I’m not very sure at all. I see that there are other functions like xmlSecTmplReferenceAddTransform (the examples call this with xmlSecTransformEnvelopedId, but I don’t need enveloped, perhaps I should call it with something else?).<br>Sorry for the dumb question again!</span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Sent from <a href="https://go.microsoft.com/fwlink/?LinkId=550986">Mail</a> for Windows</p><p class=MsoNormal><o:p> </o:p></p></div></body></html>