我怎样才能加密/使用AES CBC + CTS(密文偷)模式在PHP解密数据? [英] How can I encrypt/decrypt data using AES CBC+CTS (ciphertext stealing) mode in PHP?

查看:2272
本文介绍了我怎样才能加密/使用AES CBC + CTS(密文偷)模式在PHP解密数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要加密和解密的AES CTS模式数据(密文偷,有时也被称为AES-XTS)在PHP中进行互操作写在.NET平台远程系统。在.NET 4中,这种模式是原生支持 >。

I have to encrypt and decrypt data in AES CTS mode (ciphertext stealing, sometimes referred as AES-XTS) in PHP to interoperate with a remote system written in .NET platform. In .NET 4, this mode is supported natively.

对于PHP,我无法找到一个解决方案,根据说明书上,mcrypt的似乎并没有对这种模式的支持。

For PHP, I cannot find a solution, based on the manual, mcrypt does not seem to have support for this mode.

任何人都可以请解释平原CBC和CBC-CTS之间的区别?是否有可能使PHP后者的工作,利用现有的模块/库?

Could anyone please explain the difference between plain CBC and CBC-CTS? Is it possible to make the latter work in PHP with using existing modules/libraries?

推荐答案

我发现AES算法的C的实现,你可以找到它的源$ C ​​$ C的这里

I have found an implementation of AES algorithm in C, you can find it with source code here.

笔者的老的实现被用在的Andr​​oid 。所以我认为,实现将是非常有前途的。

The author's older implementation was used in Android. So I think the implementation would be very promising.

最后,你已经下载了源$ C ​​$ C后,再检查文件 aesxam.c ,有CTS与CBC文件加密一个很好的例子

Finally, after you have downloaded the source code, then check the file aesxam.c, there is a very good example of CTS with CBC for file encryption.

所有的学分转到布赖恩格莱德曼

布莱恩格莱德曼现在维护自己的GitHub 回购的AES

Brian Gladman now maintains his own github repo for AES.

这篇关于我怎样才能加密/使用AES CBC + CTS(密文偷)模式在PHP解密数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆