[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:

  <MyMessage Id="id12345">
      ¦ТTБ¦¦¦- ¦¬TА¦¬¦-¦¦TВ! ----------- this is message body in UTF-8
  <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
      <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>

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

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

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,

More information about the xmlsec mailing list