Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Encrypting data from Java to PHP?

Posted on 2008-10-09
1
Medium Priority
?
307 Views
Last Modified: 2013-12-13
Anyone know of a way to encrypt data, so the data (not just the communication) is encrypted moving from Java to a PHP page via a rest call / web service?

For instance, the java app can encrypt values before building them into a URL, that php can decode:
https://server.com/?value1=QWER&value2=ASDF
etc..
0
Comment
Question by:ecuguru
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 9

Accepted Solution

by:
mbodewes earned 1500 total points
ID: 22694773
Well you could:

Server:
Let PHP script import a previously generated key pair (you only need one key pair)
Let PHP script send base54 encoded public key (public exponent & modulus) using page

Client:
Let Java parse page and load public key pair
Let Java generate a AES secret key
Let Java encrypt the values using the AES key and CBC mode
Let Java encrypt the AES secret key using the previously parsed public key using RSA PKCSv1.5 encryption
Send the GET request with the required encrypted values and an additional value containing the encrypted AES secret key

Server:
Let PHP script retrieve the encrypted values
Let PHP script decrypt the AES secret key using the RSA PKCSv1.5 decryption and the previously generated private key
Let PHP script decrypt the values using the previously decrypted AES secret key

Note that this does not help against man in the middle attack if the receiver of the AES public key cannot validate its origin. It may be better to first distribute this key to the Java side and use this as a static value.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question