我的 Delphi 应用程序使用 TurboPower LockBox 3 使用 AES 256 加密明文信息.我现在想使用 PHP 解密此信息.但是 TurboPower LockBox 3 存在一些互操作性问题.
My Delphi application uses TurboPower LockBox 3 to encrypt a plaintext information using AES 256. I now want to decrypt this information using PHP. But TurboPower LockBox 3 has some interoperability issues.
请在此处查看 LockBox 3 作者的帖子以了解详细信息:
Please check the post by LockBox 3 author here for details :
http://lockbox.seanbdurkin.id.au/tiki-view_forum_thread.php?comments_parentId=363&topics_offset=1
还有一篇关于 Stackoverflow 的类似帖子
And a similar post on Stackoverflow
Delphi 中的安全密钥对加密解决方案 &PHP?
在 LockBox 3 中,在加密期间,您设置密码.然后将此密码用作生成密钥和 iv 的种子.那么有没有人能够模仿 PHP 端的密钥生成方法?或者有什么方法可以让我获得 LockBox 3 生成的密钥/IV 并将其放入我的 PHP 代码中,以便可以解密文件?
In LockBox 3, during encryption, you set a password. This password is then used as a seed to generate the key and iv. So has anyone been able to mimic the key generation method on PHP side ? Or is there any way i can get the Key/IV being generated by LockBox 3 and put it in my PHP code so the file can be decrypted ?
如前所述,IV nonce 被添加到密文消息中.所以要在 PHP 端获取它,只需提取前 8 个字节即可.
As stated to you before, the IV nonce is prepended to the ciphertext message. So to obtain it on the PHP side, simply extract the first 8 bytes.
您需要决定共享密钥是密码字符串格式还是二进制密钥格式.symetric Key 类 (TSymetricKey) 有一个 SaveToStream() 方法,它按您的预期工作.TCodec 组件有一个 Key 属性,设置密码、链接模式和密码后即可使用.
You need to decide if the shared secret is in password-string format or binary key format. The symetric Key class (TSymetricKey) has a method SaveToStream(), which works as you would expect it to. The TCodec component has a Key property, which will be available after you set the cipher, chaining mode and password.
所有方法都是自文档化的,并且几乎按照它们的阅读方式执行,但是如果您需要一些演示代码,将密钥保存到流中,请告诉我.
All of the methods are self-documenting and do pretty much what they read like, however if you need some demo code, saving a key to a stream, let me know.
这篇关于AES 加密/解密 Delphi &PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
在 SELECT(MYSQL/PHP) 中加入 2 个表Joining 2 tables in SELECT(MYSQL/PHP)(在 SELECT(MYSQL/PHP) 中加入 2 个表)
如何使<option selected=“selected">由How to make lt;option selected=quot;selectedquot;gt; set by MySQL and PHP?(如何使lt;option selected=“selectedgt;由 MySQL 和 PHP 设置?)
使用 PHP 中的数组自动填充选择框Auto populate a select box using an array in PHP(使用 PHP 中的数组自动填充选择框)
PHP SQL SELECT where like search item with multiple wordsPHP SQL SELECT where like search item with multiple words(PHP SQL SELECT where like search item with multiple words)
json_encode 从 MSSQL-SELECT 产生 JSON_ERROR_UTF8json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT(json_encode 从 MSSQL-SELECT 产生 JSON_ERROR_UTF8)
MySQL ORDER BY rand(),名称 ASCMySQL ORDER BY rand(), name ASC(MySQL ORDER BY rand(),名称 ASC)