Help with OpenSSL Function
| From: | Shanon Swafford | Date: | Tue, 12 Sep 2006 03:06:04 +0000 |
| Subject: | Help with OpenSSL Function | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-241639@lists.php.net to get a copy of this message | ||
Hi guys,
I am trying to use Apache, PHP 4.3, and PHP's Openssl functions to encrypt a
variable.
Currently, I can successfully use the following command to encrypt an
existing file and create a new one:
openssl aes-256-cbc -e -in plain_file.xml -out encrypt_file.xml -k
1234123412341234
Is it possible to use the openssl functions in PHP 4.3 without having to use
the file system?
Can sombody help with the syntax to mimick the above to create a variable
with encrypted data from a plain text variable?
Here is a test I'm running:
It takes the following XML file:
http://71.164.193.239:8082/test.xml
Here is the page:
http://71.164.193.239:8082/test.php
Here is the source:
http://71.164.193.239:8082/test.txt
Problem:
1. It spits out different data every time you refresh the test.php page.
Why? Seems every so often, the encrypted data will be correct.
2. I would like to get rid of shell_exec and the test.xml file.
3. If this is not possible, how can I pass the plain variable to the
shell_exec command?
I also found mcrypt functions, but it is not available on my production
server.
Is there a better way to do this?
Thanks and have a good day,
Shanon