Page 1 of 1

How to write a basic encryption and pass it to the client?

Posted: Sat Aug 09, 2008 6:43 pm
by Aric_Holland
Hi,

I've been curious about encryption, and how to apply that to PHP.

Well, basically what I want to do is have client data such as a variable get sent to my xml-rpc server. I want the server to decrypt the data.

How would i go upon doing this?

Heres how the client code works:

<?php
$data = xu_rpc_http_concise(
array(
'method' => "server_version",
'host' => $host,
'uri' => $uri,
'port' => 80
)
);

function decrypt_data($param) {
// decrypt the data string...
}

print "Decrypted Data: $data";

?>
Ok heres the server code:

function server_version($method_name,$params,$app_data)
{
// now lets just say this string is encrypted.... - but its not!
$encrypted = "2342384928ejfkjsd";
return $encrypted;
}


So how would I go upon doing this? can you provide me a basic encryption code that will be able to have the server data encrypt and then be decrypted on the client side?


Much Appreciated,

Aric Holland

Re: How to write a basic encryption and pass it to the client?

Posted: Sat Aug 09, 2008 9:17 pm
by alex.barylski
1. Secret key encryption
2. Public key encryption

SSL, Blowfish are two keywords for you to Google.

Re: How to write a basic encryption and pass it to the client?

Posted: Sun Aug 10, 2008 2:29 am
by Apollo
PHP contains builtin functions for encryption and decription: mcrypt_encrypt and mcrypt_decrypt