I have encrypted .txt files located on my server (Host B). Let's say what they are encrypted with is called ENCRYPTION #1.
A user (Host A) wants to request a specific file from my server by sending over information such as filename and username. Before he should get the requested file there are a few steps to do as he can not take any use of the file in the current state (ENCRYPTION #1).
What has to be done is:
- Open up the requested file and save the content in a variable.
- Decrypt the content of the variable via PHP (ENCRYPTION #1 to plain text).
- Encrypt the plain text again but this time using ENCRYPTION #2 (Plain text to ENCRYPTION #2).
- Create a new .txt file with the content encrypted with ENCRYPTION #2.
- Send the now with ENCRYPTION #2 encrypted .txt file back to Host A as requested.
I have the encrypting scripts and everything already done but what I do not have an idea of is how to run the .txt file through a PHP script on Host B before sending it back to Host A.
Could anyone here point me to a direction that helps me get this done or show me some kind of example?