Decrypt coldfusion in php

I'm not English speaking, sorry in advance.

I have a ColdFusion 6.1 application and now I'm trying to switch to a different environment. In the ColdFusion application, my user passwords are encrypted using the ColdFusion function:

password_encrypted=toBase64(encrypt(text,key));

Does anyone know how I can decrypt it in PHP? I do not know what the encryption algorithm used in CFMX 6.1 is. I think the algorithm name is CFMX_COMPAT , but I do not know if it has an equivalent in PHP.

Thanks!!!

+4
source share
2 answers

If I'm not mistaken, the default CFMX_COMPAT function is just XOR.

So, in PHP, it will be as simple as:

 $password_encrypted = base64_encode($text ^ $key); 

Hope this helps.

Edit:

I was curious, so I wrote a little script for testing, and this can be undone, here is the encryption / decryption.

 <?php $text = 'test'; $key = 'asdf'; $password_encrypted = base64_encode($key ^ $text); echo $password_encrypted . "<br>\n"; $password_decrypted = base64_decode($password_encrypted) ^ $key; echo $password_decrypted; ?> 
+5
source

Perhaps a dumb question, why not try UN-encrypting use Coldfusion 6? Insert this into the record as plain text (while in DEV).

Then encrypt any format you want to use with PHP. Thus, you are 100% sure that it will be decrypted / understood from Coldfusion to PHP.

The reference here is CF 6 encrypt () fn: http://livedocs.adobe.com/coldfusion/6/CFML_Reference/functions-pt175.htm

and here is decrypt () fn: http://livedocs.adobe.com/coldfusion/6/CFML_Reference/functions-pt170.htm#1103962

+2
source

All Articles