Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 11-10-2008
Member
 
Join Date: Oct 2008
Posts: 76
Encryption in JavaScript, Decryption in PHP

For security reasons, I looking to find out if it is possible to encrypt a string using the JavaScript at the client side and then decrypt the same script using PHP on the server side! Can anybody help me in this.
Reply With Quote
  #2  
Old 11-10-2008
Member
 
Join Date: Jan 2008
Posts: 1,515
How do you want to encrypt it, with a private key or with completely different complex programming?
Reply With Quote
  #3  
Old 11-10-2008
Member
 
Join Date: Oct 2008
Posts: 76
I feel encrypting with the private key will be sufficient. This private key can be generated by the server at its side, so that decryption would be possible.
Reply With Quote
  #4  
Old 11-10-2008
Member
 
Join Date: Apr 2008
Posts: 2,001
ScrEnc is one such thing that will provide for encryption in JavaScript.

Quote:
ScrEnc provides tools to encrypt your JavaScript/JScript, C/C++/MFC scripts before posting them online, or for distribution, preserving full functionality of the script but making them very hard to read. ScrEnc can also decrypt previously encrypted scripts into fully readable source code files, including files encrypted with Windows Script Encoder. ScrEnc also provides other useful features designed to facilitate your code scripts development such as conversion of Windows to Unix text file formats.
Reply With Quote
  #5  
Old 11-10-2008
Member
 
Join Date: May 2008
Posts: 2,293
Here is the problem with that, you're going to have to embed some type of encryption key in the javascript routine which will make decrypting the same text rather trivial by anyone. Have you considered a hash?

For example if this is a password related issue, you can MD5 the password, send it to the server and compare to the password in a database that is also md5 hashed. Make sense? Which is completely irreversible.
Reply With Quote
  #6  
Old 11-10-2008
Member
 
Join Date: Oct 2008
Posts: 76
It seemed to me a little more complicated than that as when i origionally had and used the above the string of random characters were not anything like It%27s%20me%21

u could not read any words it was all completely encrypted or scrambled or something

any ideas??
Reply With Quote
  #7  
Old 11-10-2008
Member
 
Join Date: Feb 2008
Posts: 1,848
If you want to encrypt in JS and decrypt in PHP, you'll have to start by finding a matching algorithm between the two. Take a look at PHP's mcrypt functions and find a compatible JS algorithm. I personally looked at using the AES script execute posted at one time; it uses the CTR (counter) method, and as luck would have it, PHP's mcrypt extension can utilize CTR and rijndael-N (AES) encryption. I never did complete the project though.

Of the three posted, DES might be the easiest to make work, although not the most secure. Security is relative when you're talking about anything on the web anyway
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Encryption in JavaScript, Decryption in PHP"
Thread Thread Starter Forum Replies Last Post
How can be digital signature used in Encryption and decryption process sRIPRIYA Networking & Security 3 03-01-2011 09:11 AM
DES encryption and decryption using C or Java sayanmaji Software Development 5 26-11-2010 03:20 AM
XML encryption and decryption Anirvinya Software Development 5 03-03-2010 03:31 AM
Do you know difference between encryption and decryption? rooki Networking & Security 4 30-11-2009 12:24 PM
Contivity VPN "Unable to complete encryption handshake with remote side. Encryption Mismatch." HudSon AntiVirus Software 2 22-02-2006 03:53 PM


All times are GMT +5.5. The time now is 08:04 AM.