[xmlsec] xml digital signature and newlines

dk at pdx.edu dk at pdx.edu
Wed Nov 30 11:28:39 PST 2005


Hello All,
   i have a weird problem. I generated XML digital signature and dumped it into
a xmldsig.txt file.
when i am trying read this xmlfile in chuncks like
fread(tempbuffer, 1, 900, xmlfile);

where tempbuffer is a temporary character buffer
xmlfile is a pointer to the xmlfile.

then later i did
fseek(xmlfile, 900, SEEK_SET);

the file pointer is not seeking to the exact location for example.. for the
first time the following is read
<?xml version="1.0" encoding="UTF-8"?>
<!--
XML Security Library example: Simple signature template file for sign1 example.
-->
<Envelope xmlns="urn:envelope">
  <Data>AAABV4AJACYABwAIAAAAAQAIABZTYW1wbGUgQXBwbGljYXRpb24=</Data>
  <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
    <SignedInfo>
      <CanonicalizationMethod
Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
      <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
      <Reference URI="">
        <Transforms>
          <Transform
Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
        </Transforms>
        <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
        <DigestValue>Jmo893F0/j7Uw8T7katq89rDYVk=</DigestValue>
      </Reference>
    </SignedInfo>

<SignatureValue>HdVAe/z9KXCCFpIs9e77X4DUdKmPyq21oa4JDuc4fn3j8KMZnQoTWEQ6kJsWyzp1
/aFwNR


IN THE second time the following is read
EQ6kJsWyzp1
/aFwNRSpft3Rd4KDZyczGsR6PCv+Pu8E0c+Cao5hb7NTduKbkqSxztViotSoZ1mT
hqNAfC7eWlfy9iLk4Mo+vaewNhBcCz+quJ6kXJV84LFzvi1kucBptwaWCXDyW2sc
wns8cphNLPopa0xLfYVg4hRellUNy+ypbODkqQHwQH+IoQu6MRNK0iF7v6Ju8py2
qkfblgl8z+4wOaGXAm03A7aedUV8IFpRajMZzRSfH3jmwcb92aVF/Bz1cOo0kGo6
czXcUYXHVPuWUr5gEVqe1g==</SignatureValue>
    <KeyInfo>
        <KeyName>C:\Program Files\Common
Files\PostureAgent\Plugins\rsakey.pem</KeyName>
    </KeyInfo>
  </Signature>
</Envelope>

If you notice, the first 19 characters in the buffer read in the second time is
repeated.

For various examples i tried out, i noticed that
No. of new lines in the buffer read in the first time = No. of characters
repeated during second read operation.

Please help me. This sounds to be simple problem, but it is taking a lot of
time.
Thanks,
Divya




More information about the xmlsec mailing list