You might try using the trim function when setting the variable.

<cfset txtoutput = #Trim(get_report.report)#>

This will remove the trailing spaces that might be invalidating the encrypted
string.

-----Original Message-----
From: Marcus [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 20, 2000 8:22 AM
To: Cf-Talk
Subject: Does Anyone understand encrypt/decrypt??? [CF-Talk]


Greets,

I am attempting to encrypt a text file and store it in an SQL table.

First, I create a name, and then see if the file exists...
<cfset outfile = "\\web1\reports\cr_store\#answer3#"> (where answer3 is the
filename)
<cfif fileexists ("#outfile#")>

Then, read the file into a variable
<cffile action = "read" file="#outfile#" Variable="txtoutput">

Create a key
<cfset key='1234567'>

Then encrypt it
<CFSET encrypted = encrypt(txtoutput, key)>

and then I store '#encrypted#' in a text field in an SQL7 table.
Not bad so far...

Now, when I try and view the file, I again set the key,
<cfset key='1234567'>

And retrieve the field from a query I ran
<cfset txtoutput = #get_report.report#>

then I attempt to decrypt the file
<cfset decrypted = decrypt(txtoutput, key)>

And I get the error...

The value to be decrypted is no valid.

Any ideas????

Marcus the Desperate

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send
a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to