Will:

I am not sure if this could be the reason, but the ENCRYPT function requires
a string. Could the reason be that you are trying to encrypt a number? See
what the Studio help says about ENCRYPT:

=====================
Encrypt
Encrypts a string.

Syntax
Encrypt(string, key)

string
String to be encrypted.

key
String specifying the key used to encrypt string.
========================

Maybe you have to execute a ToString function on the number before you pass
it to ENCRYPT.

Hope that helps,

Dimo Michailov
Certified Cold Fusion 4.5 Web Developer
USA-IT, Inc.
[EMAIL PROTECTED]



-----Original Message-----
From: Will Swain [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 05, 2001 7:16 AM
To: CF-Talk
Subject: encrypt/decrypt


Hi guys,

Got an interesting one here. I am encrypting some details before entering
them in a databse, then decrypting them as the authorised views them.


However, I am getting this error on decryption:

Error Diagnostic Information

An error occurred while evaluating the expression:


 decryptednumber = decrypt(encryptednumber, numberkey)



Error near line 25, column 8.
----------------------------------------------------------------------------
----

The value to be decrypted is not valid


This is the code I have in that location. Interestingly, decrtypting the
name doesn't seem to cuase a problem:

<cfset numberkey = "eagles">

<cfset namekey = "selhurst">

<cfset encryptedname = #getdetails.name#>

<cfset encryptednumber = #getdetails.number#>

<cfset decryptednumber = decrypt(encryptednumber, numberkey)>

<cfset decryptedname = decrypt(encryptedname, namekey)>


This is the code on another page that encrypts the values:

<cfset numberkey = "eagles">

<cfset namekey = "selhurst">

<cfset encryptednumber = encrypt(value_number, numberkey)>

<cfset encryptedname = encrypt(value_name, namekey)>

Any ideas on this anyone??

TIA

Will Swain
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to