Solved

Encrypting data from Java to PHP?

Posted on 2008-10-09
1
298 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 500 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

717 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