Hi,

I have devices that I can configure using encrypted XML files.  Basically,
these devices browse a web server to get specific file.

We can create a plain text xml file on our web server like the following:
<myxml>
 <param1>xxxx</param1>
 <param2>yyyy</param2>
 <param3>zzzz</param3>
</myxml>

Then we can use openssl to encrypt this file on our Apache+PHP web server
with the following command:

openssl aes-256-cbc -e -in plain_file.xml -out encrypt_file.xml -k
1234123412341234

So I'm trying to figure out how to do this "on the fly" using PHP.

I see that PHP has support for openssl (http://us2.php.net/openssl) but all
the examples/docs show file operations and we don't want to touch the file
system.

Would somebody have a sample PHP script to help with this?

Or the equivalent command to take data from stdin and write the encrypted
data to stdout?

I have the following test code, but it returns different encrypted data
every time.  My devices accept this data every 10 to 15 tries which I don't
understand.

<?php

// test.xml is just a plaintext xml file

$output = shell_exec("openssl aes-256-cbc -e -in test.xml -k
1234123412341234");

echo "$output\n";

?>

I would like to get rid of the shell_exec all together or at the least
figure out how to make the openssl command NOT use the test.xml file and
return the same encrypted data all the time.

Thanks a bunch,
Shanon

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to