11月23, 2015

PHP的DES加解密函数 与JAVA兼容

PHP可以使用mcrypt_encrypt进行DES加密与解密,但实际上操作,你会发现它与JAVA的DES加密出来的字符串,有些不同。基本上是前半段一样,后半段不一样。找到PHP官方网站上对这个函数的文档,有人回复了,并给出了代码。经测,这样加密解密就跟JAVA中的兼容了。

If you want to be interoperable with other PKCS  #7 padding implementations, like the Legion of the Bouncy Castle Java  cryptography APIs, you should always pad, that is a 8-byte (block size)  padding should be added, even if not necessary


本文链接:https://lxyit.com/article/show/79.html

-- EOF --