[xmlsec] decrypting badly encoded xml

Aleksey Sanin aleksey at aleksey.com
Sat Jun 13 12:49:44 PDT 2009

Hm... I don't think you can do anything about this. At least,
not easily. xmlsec calls xmlParseInNodeContext from libxml2
and it expects a well formed XML. You can patch both libraries and
specify encoding manually though.


Michael K wrote:
> I am AES decoding some <EncryptedData> containing strings that was not utf-8 compliant.
> When I decode the <EncryptedData> I get the error....
> Entity: line 4: parser error : Input is not proper UTF-8, indicate encoding !
> Bytes: 0xE2 0x3F 0x3F 0x41
> <text>II The Way Forward�??A New Approach</text>
>                         ^
> Entity: line 8: parser error : chunk is not well balanced
>                 </navLabel>
>                            ^
> The call to xmlSecEncCtxDecrypt(encCtx, enc_node) fails because of this utf-8 problem. There are other tags encrypted between the <EncryptedData> tags (other than this one that has a problem) than I cannot recover because of this failure.  
> Is there a way of forcing the xmlsec/libxml to ignore the utf-8 problem ?  
> I have no control of the encrypted data so I cannot correct the original problem.
> Michael
> _______________________________________________
> xmlsec mailing list
> xmlsec at aleksey.com
> http://www.aleksey.com/mailman/listinfo/xmlsec

More information about the xmlsec mailing list