Lincoln, Adym wrote:
> Hi all,
>
> I am trying to use XML::Simple to process encrypted (possibly binary) data
> from an XML text file. The perldoc on XML::Simple doesn't mention anything
> either way about XMLin() and binary data. The only mention of 'binary' at
> all in the doc is related to XMLout(), saying it can not dump binary data.
>
> Has anyone ever had an success at reading in binary and/or extended
> characters using XML::Simple?
>
> Background:
> -----------
> Basically, I am :
> - Using Crypt:DES_PP and Crypt::CBC to encrypt userids and passwords.
Why not use DES_PP on both ends - makes more sense to use the same
encryption/decryption module for both ?
> - These encrypted values are stored within a small XML config file.
> - I then try and use XML::Simple to process the XML config file and then
> reverse the decryption using Crypt::CBC.
>
> Thing is I get an error once I put the encrpyted text into the XML file:
>
> <snip>
> not well-formed (invalid token) at line 14, column 43, byte 559 at
> /usr/lib/perl5/vendor_perl/5.8/cygwin/XML/Parser.pm line 187
> at /usr/lib/perl5/vendor_perl/5.8/cygwin/XML/Parser.pm line 192
> XML::Parser::parse('XML::Parser=HASH(0x105c811c)',
> '*XML::Simple::XML_FILE') called at ../inc/XML/Simple.pm line 334
> XML::Simple::build_tree_xml_parser('XML::Simple=HASH(0x1058a630)',
> './batch-sql.xml', './batch-sql.xml') called at ../inc/XML/Simple.pm line 277
> XML::Simple::build_tree('XML::Simple=HASH(0x1058a630)',
> './batch-sql.xml', './batch-sql.xml') called at ../inc/XML/Simple.pm line 220
> XML::Simple::XMLin('XML::Simple=HASH(0x1058a630)', './batch-sql.xml')
> called at C:/My Data/projects/planit/nix/bin/test-xml-encryption.pl line 130
> </snip>
>
> I thought if I wrapped the encrypted data in CDATA tags the problem would go
> away, but it hasn't. The XML file looks like the following (some of this
> text may not display correctly):
>
> <batch-sql>
> <notifications>
> <email-addr type="development">[EMAIL PROTECTED]</email-addr>
> </notifications>
> <directories>
> <directory name="base">..</directory>
> <directory name="inbound">inbound</directory>
> <directory name="working">working</directory>
> <directory name="logs">logs</directory>
> </directories>
> <server>
> <usr><![CDATA[Salted__›;Ôåñ4\jÔa Ú. `1a¯Nˆ%]]></usr>
> <pwd><![CDATA[Salted__Beú´;ˆ,%r|jP§uŒ²˜”]]></pwd>
> <sid>ORACLE_SID</sid>
> </server>
> </batch-sql>
>
> I've isolated it to XML::Simple and the encrypted data as I have eliminated
> the following:
> - The CDATA tags are not causing the issue, replacing the encrypted text with
> plain text while keeping the CDATA tags and it works
> - The Crypt::CBC works fine if I just do the encryption/decryption with
> variables and don't involve the XML file.
>
> I've tried a bunch of different searches on Google about XML::Simple and
> binary data and reading the extended character set, but nothing has come up
> yet...perhaps I'm not asking the question correctly for Google. Any help
> would be greatly appreciated...
Why not convert the binary encrypted data to ASCII (since they're
basically integers from 0-255) and convert back before decrypting ?
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs