coldfusion decrypt in php
I'm not English speaker, sorry in advance.
I have a ColdFusion 6.1 application, and now I'm trying to migrate to another environment. In the ColdFusion application, the passwords of my users are crypted with a ColdFusion function:
password_encrypted=toBase64(encrypt(text,key));
Does anyone know how can I decrypt it in PHP? I don't know what the cypher algorithm used in CFMX 6.1 is. I think that the name of the a开发者_运维知识库lgorithm is CFMX_COMPAT
, but I don't know if it has an equivalent in PHP.
Thanks!!!
If I'm not mistaken, the default CFMX_COMPAT function is simply a XOR.
So in PHP this would be as simple as:
$password_encrypted = base64_encode($text ^ $key);
Hope this helps.
Edit:
I was curious so I wrote a little script to test, and this might be reversed, here is the encrypt/decrypt.
<?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;
?>
Maybe a dumb question, why not try UN-encrypting
using Coldfusion 6? Insert that into the record as plain text (while in DEV).
Then encrypt with any format you want using PHP. That way you are 100% sure it will be decrypted/understood from Coldfusion to PHP.
As reference here is the 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
精彩评论