Coldfusion 9解密大块数据?

发布于 2024-12-23 22:23:54 字数 991 浏览 1 评论 0原文

当我要解密的数据超过 63973 字符串长度时,我收到错误。这是涉及的代码:

我在一个单独的包含文件中设置静态密钥和其他值,cfencode 混淆,位于 Web 根目录下方:

<cfset request.encryptKey = "xxxxxxxxxxxxxxxxxxxxxx=="> <!---// Key in base 64 //--->
<cfset request.encryptAlgorithm = "AES/CBC/PKCS5Padding" />
<cfset request.encryptEncoding = "Base64" />
<cfset request.encryptIV = BinaryDecode("xxxxxxxxxxxxxxxxxxxxxxxxxxxxx9b0", "hex") />

选择算法、编码和盐以使加密/解密与其他语言加密/解密兼容,如.Net,用于未来的扩展/兼容性。

我的加密/解密看起来像这样:

<cfset resultEncrypt = #Encrypt(unencrypted_text, request.encryptKey, request.encryptAlgorithm, request.encryptEncoding, request.encryptIV)#>

<cfset resultDecrypt = #Decrypt(encrypted_text, request.encryptKey, request.encryptAlgorithm, request.encryptEncoding, request.encryptIV)#>

当加密字符串的大小(通过 Len(加密字符串)测量)超过 63973(通常看起来是 64000)时,解密函数失败。

错误是:“尝试时发生错误加密或解密您的输入字符串:输入和输出编码不相同..”

其他时候它不会失败,事实上它就像一个魅力。 有什么想法我做错了吗?

I am getting an error when my data to decrypt is over 63973 string length. here is the code involved:

I set the static key and other values in a separate include file, cfencode obfuscated, located below the web root:

<cfset request.encryptKey = "xxxxxxxxxxxxxxxxxxxxxx=="> <!---// Key in base 64 //--->
<cfset request.encryptAlgorithm = "AES/CBC/PKCS5Padding" />
<cfset request.encryptEncoding = "Base64" />
<cfset request.encryptIV = BinaryDecode("xxxxxxxxxxxxxxxxxxxxxxxxxxxxx9b0", "hex") />

The Algorithm, encoding and salt were selected to make the encrypt/decrypt compatible with other language encrypt/decrypt, like .Net, for future expansion/compatibility.

My encrypt/decrypt looks like this:

<cfset resultEncrypt = #Encrypt(unencrypted_text, request.encryptKey, request.encryptAlgorithm, request.encryptEncoding, request.encryptIV)#>

<cfset resultDecrypt = #Decrypt(encrypted_text, request.encryptKey, request.encryptAlgorithm, request.encryptEncoding, request.encryptIV)#>

The decrypt function is failing when the size (measured by Len(encrypted string)) of the encrypted string is over 63973, which typically seems to be 64000.

The error is: "An error occurred while trying to encrypt or decrypt your input string: The input and output encodings are not same.."

It does not fail other times, as a matter of fact it works like a charm.
Any ideas what I am doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小女人ら 2024-12-30 22:23:58

字符串可以是任意长度,受 ColdFusion 服务器上可用内存量的限制。但是,长文本检索 (CLOB) 的默认大小限制为 64K。 ColdFusion Administrator 允许您增加数据库字符串传输的限制,但这样做会降低服务器性能。要更改限制,请在数据源的“高级设置”页面上选择“启用长文本检索”选项。 查看文档

Strings can be any length, limited by the amount of available memory on the ColdFusion server. However, the default size limit for long text retrieval (CLOB) is 64K. The ColdFusion Administrator lets you increase the limit for database string transfers, but doing so can reduce server performance. To change the limit, select the Enable retrieval of long text option on the Advanced Settings page for the data source. see the documentation

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文