jeph perro
jeph perro

Reputation: 6422

Encrypt in JSP, Decrypt in PHP

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.

Upvotes: 2

Views: 1435

Answers (3)

MicTech
MicTech

Reputation: 45023

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.

Upvotes: 0

Ian Elliott
Ian Elliott

Reputation: 7686

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.

Upvotes: 1

Martin Dale Lyness
Martin Dale Lyness

Reputation: 590

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.

Upvotes: 1

Related Questions