Diffie–Hellman key exchange agreement

Hi,

I'm in the process of making a Diffie–Hellman algorithm and I actually got stuck how to do the key exchange agreement between both web sites. The website (ReqData.html) takes the info from the user and encrypts it and posts the encrypted info to the website (SendData.php) to decrypts it. The difficult point for me was how to put the agreement in ReqData.html using javascript and SendData.php using php... please have a look at both codes and help me to create the code.... thank
------------ ReqData.html---------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>

 <script>

 var time = new Date();		
var curr_date = parseInt(time.getHours()+1);
var p = 13;
var g= 8;
var a ;
var A;
var K=0;
var s;
var inc;
alert('p'+p);
alert('g'+g);
 
 
 
 
function frmSubmit()
{
    var Message = '';
    // var alphaExp = /^[a-zA-Z0-9]+$/;
    if (document.frmForm.firstname.value=='') {
        Message = 'First name cannot be null\n';
        }
    else {
    if(!(document.frmForm.firstname.value.match(/^[a-zA-Z]+$/)))
        Message = 'First name can contain only letters, no numbers or special characters\n';
    }
    if (document.frmForm.lastname.value=='') {
        Message += 'Last name cannot be null\n';
        }
        else {
        if (!(document.frmForm.lastname.value.match(/^[a-zA-Z]+$/)))
            Message += 'Last name can contain only letters, no numbers or special characters\n';
        }
    if (document.frmForm.comment.value=='') {
        Message += 'Comment cannot be null\n';
        }

	if (Message != '')
    {
        alert(Message);
        return false;
    }
    return true;
}
 



 </script>
 <title> Dispute Encription</title>
    <head />
    <body onload="diffhellman();">

        <h2>
           Opening a Dispute
        </h2>
        <form name="frmForm" onsubmit="return frmSubmit()" action="SendData.php" method="post">
        First name:
        <input type="text" name="firstname" />
        <br />
        Last name:
        <input type="text" name="lastname" />
        <br />
        Please write your claim :<br />
        <textarea value="" id="comment" name="comment" onchange="" /></textarea>
                
        <br />
        
        <input type="hidden"  id="encrypted" name="encrypted" /></input>
        <br />
        <input type="submit" value="Submit" />
</form>
    </body>
</html>

---------------- SendData.php----------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>



<?php


?>


 <title> Dispute Decription</title>
    <head />
    <body>
        <h2>
            Showing Dispute Encription and Decription
        </h2>
        <form name="frmForm" action="RecCode.php" method="post">
        <br />
        Encrypted value :<br />
        <textarea id="encrypted" name="encrypted" /><?php  ?> </textarea>
		<br />
		Decrypted value :<br />
        <textarea id="decrypted" name="decrypted" /><?php ?> </textarea>
		

        </form>
    </body>
</html>

Open in new window

AussieSilverAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

StealthyDevCommented:
Hi, please look at the below links and use your own technique.

http://www.adamsinfo.com/diffie-hellman-key-exchange/

http://www.example-code.com/php/dh_key_exchange.asp

Regards.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.