I'm telling ya, I ran the _exact_ same code you had. Here is my version: <cfparam name="KeyName" default="Do you accept third party out of state checks?"> <cfscript> function Encodify(encodeThis){ var encodedString = ""; encodedString = URLEncodedFormat(Encrypt(encodeThis, KeyName)); return encodedString; } </cfscript> <cfscript> function Decodify(decodeThis){ var decodedString = ""; decodedString = Decrypt(URLDecode(decodeThis), KeyName); return decodedString; } </cfscript>
<cfset myid="1"> Original myID: 1 <cfset myid=Encodify(myid)> <cfoutput>myid=#myid#<br></cfoutput> <cfset myid2=Decodify(myid)> <cfoutput>decoded #myid2#</cfoutput> The only difference is that I used the name, myid2 in the last line of code. ======================================================================= Raymond Camden, Principal Spectra Compliance Engineer for Macromedia Email : [EMAIL PROTECTED] Yahoo IM : morpheus "My ally is the Force, and a powerful ally it is." - Yoda > -----Original Message----- > From: Tyler Silcox [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, December 18, 2001 10:27 AM > To: CF-Talk > Subject: Re: encrypting/decrypting... > > > Did you run it as a UDF? Because that's where the problem > starts...if you > did, then something's screwy here (MS 2000 advanced server, > CF5 (duh.)) I > just added cfusion_encrypt and cfusion_decrypt into the mix > between the > encrypt and url functions in the UDFs and it seems to work > fine now...thanks > for checking it out-> > Tyler > > ----- Original Message ----- > From: "Raymond Camden" <[EMAIL PROTECTED]> > To: "CF-Talk" <[EMAIL PROTECTED]> > Sent: Tuesday, December 18, 2001 10:13 AM > Subject: RE: encrypting/decrypting... > > > Tyler, I ran your code exactly as you have it, and didn't get any > errors. > > ============================================================== > ========= > Raymond Camden, Principal Spectra Compliance Engineer for Macromedia > > Email : [EMAIL PROTECTED] > Yahoo IM : morpheus > > "My ally is the Force, and a powerful ally it is." - Yoda > > > -----Original Message----- > > From: Tyler Silcox [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, December 18, 2001 9:58 AM > > To: CF-Talk > > Subject: encrypting/decrypting... > > > > > > I remember a discussion a little while back about > > encrypting/decrypting > > variables etc and now I'm starting to encrypt some passed > > variables and was > > wondering if y'all could remember some of the finer points of the > > discussion, because I sure don't, and now I'm having some > > problems. I think > > my problems are associated with the way cfscript is running, > > but I could be > > going about the encryption process the wrong way in the > first place... > > > > What I'm trying to do is: > > > > I want to encrypt all cookie, url and form values when passed > > or written to. > > I wrote a couple UDFs that combines the Encrypt and URLEncodedFormat > > functions, along with their counter functions. > > > > <cfparam name="KeyName" default="Do you accept third party > > out of state > > checks?"> > > <cfscript> > > function Encodify(encodeThis){ > > var encodedString = ""; > > encodedString = URLEncodedFormat(Encrypt(encodeThis, KeyName)); > > return encodedString; > > } > > </cfscript> > > <cfscript> > > function Decodify(decodeThis){ > > var decodedString = ""; > > decodedString = Decrypt(URLDecode(decodeThis), KeyName); > > return decodedString; > > } > > </cfscript> > > > > Simple enough, but I'm getting an error when I just try to > > encode certain > > numbers (in this case: 1) > > > > <cfset myid="1"> > > Original myID: 1 > > > > <cfset myid=Encodify(myid)> > > Encoded myid: %21%23%40%24%23%0A > > > > <cfset myid=Decodify(myid)> > > An error occurred while evaluating the expression: > > myid=Decodify(myid) > > The value to be decrypted is not valid > > > > Which is wacked, because if I just take the "Encodified" value > > (%21%23%40%24%23%0A) and write out the functions, instead of > > using the UDF, > > it works: > > > > <cfset myid=URLDecode(myid)> > > URLDecoded myid: !#@$# > > <cfset myid=Decrypt(myid, KeyName)> > > Decrypted myid: 1 > > > > It looks like the pound signs in the encrypted value is what > > it creating the > > error, but I can't figure out why/how cfscript can't handle it. > > > > Can anyone shed some light on what I'm trying to do here? Is > > this a bug in > > the UDF/cfscript implementation? Is this a waste of a UDF? > > Should I be > > using CFusion_Encrypt() or Hash() functions instead? So many > > questions... > > > > Tyler > > ______________________________________________________________ > > __________________ > > Get the mailserver that powers this list at > http://www.coolfusion.com > > FAQ: > http://www.thenetprofits.co.uk/coldfusion/faq > > Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ > > Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists > > > ______________________________________________________________ > ______________ > ____ > Structure your ColdFusion code with Fusebox. Get the official book at > http://www.fusionauthority.com/bkinfo.cfm > FAQ: http://www.thenetprofits.co.uk/coldfusion/faq > Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ > Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists > > ______________________________________________________________ > __________________ > This list and all House of Fusion resources hosted by > CFHosting.com. The place for dependable ColdFusion Hosting. > FAQ: http://www.thenetprofits.co.uk/coldfusion/faq > Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ > Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists > ________________________________________________________________________________ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists