0 Replies Latest reply on Jun 6, 2012 5:09 PM by talofer99

    Issues with encrypt/decrypt

    talofer99 Level 2

      I got a system that is behaving strange what appears to be randomly.

      I create a CURD cfc for this table and to store the password I use  

      Encrypt and when it's been red from the CFC it gets decrypt by the cfc.

      Here is the few lines of code from the CFC that is in charge of it.


      On update (same method is doen on crate as well):

      <cfif isdefined("arguments.fu_password")>fu_password=<CFQUERYPARAM value="#left(encrypt(trim(arguments.fu_password), this.encKey),250)#" cfsqltype="cf_sql_varchar" maxlength="250">,</cfif>


      On read (after I query the database):

      <cfloop query="qReadFrontend_Users">

                              <cfset qReadFrontend_Users.fu_password[currentrow] = #Decrypt(qReadFrontend_Users.fu_password[currentrow], this.encKey)#>



      It worked well (I use this method everywhere I need to save the data encrypted) for a long time, and IT STILL works well on my server. But about 2 months a go I started to get errors that the input/output of the encryption is not the same.

      The MUST strange thing is that the errors will be sent to me WITOUT the page being viewed been relocated to the error page (which is what happens when an error accurse on that system). And on top of that the CFC would RETURN the SQL with the RIGTH INFO !! IE it decrypts the info but yet say there was a problem.


      I then added this to the CFC …

      <cftry> <!--- THIS IS A TEST --->

                              <cfloop query="qReadFrontend_Users">

                              <cfset qReadFrontend_Users.fu_password[currentrow] = #Decrypt(qReadFrontend_Users.fu_password[currentrow], this.encKey)#>



                                          <cfcatch type="any">

                                                      <cfmail from="****" to="*****" subject="FRONT END USERS CFC CF CATCH EMAIL !!!!" type="html">


                                                                  <cfdump var="#cfcatch#">



                                                                  <cfdump var="#arguments#">  



                                                                  <cfdump var="#qReadFrontend_Users#">



                                                                  <cfdump var="#this#">



                                                                  <cfdump var="#cgi#">



                                                      <cfreturn qReadFrontend_Users>                    





      And I started getting emails. in all of the emails the RETRURNED query is fine, as I mentioned above.


      I also checked the DB, outputting each row and its decrypt password, the problems is not in the DATA IT SELF, the data is k-ok !.


      And again this happens totally on random, no pattern to it what so ever.


      My Q' is, did any one encountered something like this?

      My first guess was that the SQL is not ok in some why, but I have NO idea what to look for.

      Please HELP : )