so my java looks like
String epassword = Crypt.encryptStringToString((String) params.get("password"));
I then store that in a DB. I need to decrypt it with PHP.
Is there a way to do this?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I assume you are using
uk.org.ellery.twiki.Crypt, since that’s the only thing that came up when I search on Google for “encryptStringToString java”.In PHP, you will need to re-implement the class linked here:
http://svn.foswiki.org/trunk/EncryptedPagesPlugin/uk/org/ellery/twiki/Crypt.java
You’re specifically interested in the “decryptString” method.
If it helps, looks like it generates a random salt which is stored with the encrypted value in the first 8 bytes, and the algorithm to apply the actual encryption/decryption is “PBEWithMD5AndDES”, as provided by the standard Java crypto libraries. However, there’s some wrapper code to convert values into hex values and a Base64 string (and vice versa).
Looks like someone has already ported PBEWithMD5AndDES to PHP, so you just need to re-write the Crypt.java file in PHP.