Daniel Tryba schrieb:
Philipp Brune <ph***********@t-online.de> wrote:
The problem in this case is that I need arithmetic
support for Big Numbers (>=1024 Bits). The bc* functions
are too slow and do not work in this case.
The encryption doesn't have to be strong if you use SSL for the actual
transer. A weak onetime keypair has to be strong enough to allow the
transfer to complete before you can reasonably assume someone had the
processor time to crack it.
But is the openssl module (http://nl3.php.net/openssl) available on the
target server?
So perhaps anybody knows how I could achieve an encrypted
file download with different keys for every "Download Session" in
php. Is it possible over an ssl / https connection ? Or what am I
missing here ?
What is the quest? Should the file to download be encrypted during
transfer or should an encrypted file be downloaded to a client?
In the first case SSL is good enough but you could use DH key exchange
for authtication for additional security. I don't see the practical
point of the latter case.
First of all, many thanks for your reply !
Well yes, the Provider has installed the OpenSSL module
on the Server, great !
To be more specifically, this is what I want to Achive :
1) Client and Server agree upon a one-time-key.
2) The Client POSTs an Xml String to the Server
in which he tells what file he wants to Download
and some additional Information :
<query filetodownload="abc.def" package="packageoffile">
<account>
<username>Philipp</username>
<password>mypass</password>
</account>
</query>
This POST should also be encrypted with the previously
agreed key.
3) Someone has Stored the file "abc.def" in unencrypted
form in a specific Directory (Protected by an .htaccess file)
on the Server before.
4) The Server Opens the file, encrypts the Data with the
key Exchanged in 1) and sends it to the Client.
5) The Client Decrypts the Data and stores it in a specific
Location.
There were two thougts came in my mind while I was reading your answer :
First, the Download of a file may take up to 30 minutes, for this
short time a smaller key of 128 Bit perhaps could not be cracked
I suppose. So I am going to test, if the bcmath functions
work with this.
Secondly, perhaps the whole Session (Step 1-5) could be
(semi-)transparently encrypted with ssl.
So I would like to know how this could be done, if possible !
Or if it would just be possible to exchange the key over ssl this would
be great! How can this be done ?
Perhaps something like this :
Server & Client establish HTTPS Connection.
Client POSTs a number of randomly generated
bytes to the Server.
The Server Replies with another number of
randomly generated bytes.
Both Quit the HTTPS Connection and
Calculate a Key with the Exchanged Bytes, perhaps
with a simple XOR or something like that.
Would this make sense ? How could it be done ?
Many thanks in advance for any help, suggestions, hints !