From googling about the place, it seems like you're not using
the same key
to decrypt that was used to encrypt in the first place.
This sample code demonstrates it:
<cfscript>
s = "Secret";
sKeyGood = generateSecretKey("AES");
sKeyBad = generateSecretKey("AES");
sEnc = encrypt(s, sKeyGood, "AES");
sDec = decrypt(sEnc, sKeyBad, "AES");
</cfscript>
<cfdump var="#variables#">
Looking at your code, what you're doing doesn't seem
sensible:
<cfset dPassword =
Decrypt(dbPswd,APPLICATION.Key,"#APPLICATION.pKey1#","#APPLICATION.pKey2#")>
The arguments for decrypt() are:
encrypted_string, key[, algorithm, encoding, IVorSalt,
iterations]
So the latter two arguments you pass would not be KEYS,
they'd be a string
holding an algorithm name, and a string holding an encoding
scheme.
Either that, or your using some very poor variable-naming
standards there.
You also don't need the quotes or the pound-signs in that
expression.
Although that has nothing to do with your problem, it does
clutter up your
code unnecessarily / inappropriately.
--
Adam