[xmlsec] Default encoding

Slava Kostin sk1978 at mail333.com
Thu Apr 17 04:35:51 PDT 2003


Hello, Aleksey.

I have a problem with libxmlsec. Can you help me please?
I have just tried to sign a template that is already in UTF-8 encoding:

<RootNode>
  <MyMessage Id="id12345">
      ¦ТTБ¦¦¦- ¦¬TА¦¬¦-¦¦TВ! ----------- this is message body in UTF-8
  </MyMessage>
  <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
    <SignedInfo>
      <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod>
        <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod>
        <Reference URI="#id12345">
           <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod>
           <DigestValue></DigestValue>
        </Reference>
     </SignedInfo>
     <SignatureValue></SignatureValue>
  </Signature>
</RootNode>

I have received such representation using xmlC14NDocDumpMemory()
function from libxml.

Now I'm trying to sign such document.
If I'll put

<?xml version="1.0" encoding="UTF-8"?>

at the very beginning of the document, I'll receive exactly the same
contents of tag <MyMessage> consisting of correctly signed document.

Otherway, If I'll not mention xml version and encoding at the
beginning of the document, I'll receive a body of <MyMessage> in this
representation:

<MyMessage Id="id12345">
  &#x412;&#x441;&#x435;&#x43C; &#x43F;&#x440;&#x438;&#x432;&#x435;&#x442;!
</MyMessage>

And there's a string

<?xml version="1.0"?>

at the beginning of the result document.

I was sure so far that if I'll not indicate an encoding in the
document, it will be concidered as UTF-8 XML document and no other
conversions will be processed. Especially on the output document.
Am I right?

-- 
Best regards,
 Slava                          




More information about the xmlsec mailing list