我有以下脚本试图从我的数据库中选择一些项目并解密加密的项目,问题是加密密钥是唯一的,company_id
我在表中进行了更改:
<cfset request.ek = "password">
<!-- <cfset encKey = encrypt(request.ek, company_id)> -->
<!-- <cfset decrypted = decrypt(urldecode(arguments.mystring), encKey)> -->
<cfquery name="header" datasource="MyDB">
SELECT TOP 10
ID,
company_id,
encString
FROM
dbo.[TableName];
</cfquery>
<cfoutput>ID|company_id|encString<br></cfoutput>
<cfloop query="header">
<cfoutput>#ID#|#company_id#|#decrypt(urldecode(encString, encrypt(request.eq, company_id)))#<br></cfoutput>
</cfloop>
我收到此错误:
Parameter validation error for the DECRYPT function.
The function accepts 2 to 6 parameters.
编辑。感谢 Scott Stroz,我真的把括号弄乱了。我的代码应该是:
<cfset request.ek = "password">
<!-- <cfset encKey = encrypt(request.ek, company_id)> -->
<!-- <cfset decrypted = decrypt(urldecode(arguments.mystring), encKey)> -->
<cfquery name="header" datasource="MyDB">
SELECT TOP 10
ID,
company_id,
encString
FROM
dbo.[TableName];
</cfquery>
<cfoutput>ID|company_id|encString<br></cfoutput>
<cfloop query="header">
<cfoutput>#ID#|#company_id#|#decrypt(urldecode(encString), encrypt(request.eq, company_id))#<br></cfoutput>
</cfloop>