views:

356

answers:

3

Hi,

I'm trying to implement a single-sign-on link from application written in JAVA, to another web app written in PHP.

I'd like a way to encrypt the username in .JSP and then decrypt in PHP.

I need to find functions matching functions that will allow this.

+1  A: 

The encryption algorithm, block mode, and padding just need to be defined the same. PHP its own set of mcrypt libraries that supports many common symmetrical encryption algorithms. Although if possible i'd suggest using a different token like system for sharing authentication.

Have a unique token that is only valid for that session not for that user, then store it in the server side database which both your php and jsp pages have access to. This way no decryption need take place.

Martin Dale Lyness
A: 

Well pick any publicly available encryption method. An encryption is just an algorithm, in most cases should be possible to implement it in any language.

There's not really an encryption that works in PHP and not JSP, or vice versa.

Ian Elliott
A: 

You can use AES encryption.

  • PHP - mcrypt library or phpseclib
  • Java - JCE (build in JRE since v1.4.2)

or some other crypt solution, which have library for both.

MicTech